Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unstable behaviour of Position Controller in UR10 #73

Open
panagelak opened this issue May 6, 2021 · 15 comments
Open

Unstable behaviour of Position Controller in UR10 #73

panagelak opened this issue May 6, 2021 · 15 comments

Comments

@panagelak
Copy link

Hello,

I recently tested your gazebo_ros2_control plugin (master branch) using position interface with a ur10 robot + MoveIt

by just modifying the rrbot moveit demo for the ur10

I noticed that the joint_trajectory_controller was unstable causing the robot to take a long time to go in the default position
and breaking up like so

ur_problem_with_controllers

Reducing the inertial values by a factor of 100 seemed to fix the problem in the beginning but it becomes unstable after a while
or after using Moveit to move it
(i haven't tested effort or velocity controllers yet since i don't want to tune pid's)

Any ideas?

Thanks a lot!

@brennand
Copy link

brennand commented Jun 9, 2021

Did you ever fix this as I have a very similar behavior.

@newcanopies
Copy link

@panagelak please share a https://gist.github.com of the:

adapted UR10 xacro with the joint_trajectory_controller
moveit config

@panagelak
Copy link
Author

@newcanopies

Hello i wasnt very familiar with gist and it seems i could only share individual files

I made a repo with my config and some simple instructions (for foxy) hope this helps

https://github.com/panagelak/ur10_gazebo_ros_control2

Hope this helps!
Thanks

@newcanopies
Copy link

newcanopies commented Jun 10, 2021

Thank you @panagelak I'm looking into tweaking the parameters ... TBC

related #44 (comment)

related ros-simulation/gazebo_ros_demos#42 (comment)

@newcanopies
Copy link

are you getting the ros2 errors:

[ros2-6] ros2: error: argument Call `ros2 <command> -h` for more detailed usage.: invalid choice: 'control' (choose from 'action', 'bag', 'component', 'daemon', 'doctor', 'extension_points', 'extensions', 'interface', 'launch', 'lifecycle', 'multicast', 'node', 'param', 'pkg', 'run', 'security', 'service', 'test', 'topic', 'wtf')
**[ERROR] [ros2-6]: process has died [pid 10363, exit code 2, cmd 'ros2 control load_start_controller joint_trajectory_controller'].**
[INFO] [gzclient   -2]: process has finished cleanly [pid 10167]
``` [gzserver-1] [INFO] [1623424230.447833300] [gazebo_ros2_control]: Loading controller_manager [INFO] [spawn_entity.py-4]: process has finished cleanly [pid 10172] [INFO] [ros2-5]: process started with pid [10298] [gzserver-1] [WARN] [1623424230.468205600] [gazebo_ros2_control]: Desired controller update period (0.01 s) is slower than the gazebo simulation period (0.001 s). [gzserver-1] [INFO] [1623424230.468415400] [gazebo_ros2_control]: **Loaded gazebo_ros2_control.** [ros2-5] usage: ros2 [-h] Call `ros2 -h` for more detailed usage. ... [ros2-5] ros2: error: argument Call `ros2 -h` for more detailed usage.: invalid choice: 'control' (choose from 'action', 'bag', 'component', 'daemon', 'doctor', 'extension_points', 'extensions', 'interface', 'launch', 'lifecycle', 'multicast', 'node', 'param', 'pkg', 'run', 'security', 'service', 'test', 'topic', 'wtf') [ERROR] [ros2-5]: process has died [pid 10298, exit code 2, cmd 'ros2 control load_start_controller joint_state_controller']. [INFO] [ros2-6]: process started with pid [10363] [ros2-6] usage: ros2 [-h] Call `ros2 -h` for more detailed usage. ... [ros2-6] ros2: error: argument Call `ros2 -h` for more detailed usage.: invalid choice: 'control' (choose from 'action', 'bag', 'component', 'daemon', 'doctor', 'extension_points', 'extensions', 'interface', 'launch', 'lifecycle', 'multicast', 'node', 'param', 'pkg', 'run', 'security', 'service', 'test', 'topic', 'wtf') **[ERROR] [ros2-6]: process has died [pid 10363, exit code 2, cmd 'ros2 control load_start_controller joint_trajectory_controller'].** [INFO] [gzclient -2]: process has finished cleanly [pid 10167] ```

@panagelak
Copy link
Author

@newcanopies

I'm not sure why it doesn't recognize the ros2 control load_start_controller joint_state_controller/joint_trajectory_controller cli command, i think it requires to have build ros_control from source to do so (or moveit2 which include ros control).
Furthermore in this launch file on the rrbot it uses the same command on line 90 https://github.com/ros-simulation/gazebo_ros_demos/blob/ahcorde/port/ros2/rrbot_gazebo/launch/rrbot_world.launch.py

I followed this instructions to install moveit2 https://moveit.ros.org/install-moveit2/source/

P.S since i dont want to have all the moveit2 packages in my devel workspace (requiring to blacklist them etc)
i installed the moveit2 in a seperate workspace so my bashrc looks something like this (notice the --extend)

source /opt/ros/foxy/setup.bash
source ~/ws_moveit2/install/setup.bash --extend
source ~/colcon_ws/install/setup.bash

let me know if this fixes that

@newcanopies
Copy link

newcanopies commented Jun 11, 2021

is your ros2_control source build inside colcon_ws?
or are you relying on foxy debian ros2_control?

since commenting out the controller_manager update_rate in gazebo yaml removes the instability,
could be that the URDF macros require a matching <update_rate>100</update_rate> tag
as well as correct yaml definitions of the joint state and trajectory controllers

ref. <ros2_control> tags in the URDF must be compatible with the controller's configuration

have you tried generating the ur10_gazebo_ros_control2 yamls and gazebo xacros via (the unported) ROS1 moveit setup assistant?

here's a UR5 controller yaml tweaked to hold non-zero position #44 (comment)

@panagelak
Copy link
Author

hi @newcanopies

i experimented a little with the gazebo_controllers.yaml (on the ur10_description pkg) but it didn't seem to fix it by removing the <update_rate>

can you possibly make a pr with your fix or share your fork?

i didn't know they have release ros2_control on debian is it on testing? i have install moveit2 from source which installs ros2_control also. In colcon_ws i have only the repo i shared + gazebo_ros2_control plugin (main)

thanks a lot for your help so far, appreciate it!

@newcanopies
Copy link

newcanopies commented Jun 12, 2021

hi @panagelak the PR is already on your repo :) with this result based on apt debian ros2_control
it is not a fix, just a diagnostic.
image

i have install moveit2 from source which installs ros2_control also

afaik, moveit2 source install relies on older version of ros2_control which doesn't interface well with Gazebo.

To test debian ros2_control try these install/remove instructions. It looks like the Rviz2 error about TF2 frame conversion is due to wrong TF2 package version overlay. It remains TBD which repo has the Gazebo/Rviz2 suitable version of TF2.

--

I just switched to debugging based on ros2_control devel packages from the demos and documentation therein.
Check the 6Dbot branch where a 2 Hz controller_manager update rate was coded in.
I tried various values (1000, 100, 50, 10, 2) but instability only stops if no update rate is set for the controller_manager. Meanwhile. each controller (state,trajectory, position) has update rates (25, 50 Hz) that may or may not need tweaking....
And may or may not need to be correspondingly referenced in the URDF < update_rate > tag of that controller.
I'm looking for documentation that clarifies this.

It's also possible some of the ros2_control packages should be included as < build > or < exec > depends under the ur10 description+control package.xml

@destogl @Briancbn @ahcorde please throw us a hint here?
This joint instability issue closely resembles the behavior videos from the Foxy API PR #44 (comment)

@Briancbn
Copy link
Contributor

Briancbn commented Jun 12, 2021

@newcanopies @panagelak This is my follow-up comments. #44 (comment).

Please also refer to #54 (comment) for the workaround 1. I am still using this workaround with the latest gazebo_ros2_control for my own project.

I haven't been follow up on this issue lately, maybe @destogl and @ahcorde could provide the best way and estimated timeline in this getting resolved.

@newcanopies
Copy link

Please also refer to #54 (comment) for the workaround 1. I am still using this workaround with the latest gazebo_ros2_control for my own project.

I hasn't been follow up on this issue lately, maybe @destogl and @ahcorde could provide the best way and estimated timeline in this getting resolved.

Thanks very much @Briancbn - which ros2_control package repo are you using and how do you exclude conflict with the older ros2_control inside moveit2 ?

@Briancbn
Copy link
Contributor

Briancbn commented Jun 12, 2021

@newcanopies
Latest version for almost everything, we tested it just two days ago.

Don't forget to add these additional lines as the follow_joint_trajectory parameters under controller.yaml following the moveit2 panda example.

pos_joint_traj_controller:
  ros__parameters:
    joints:
      -
      -
      ...
    command_interfaces:
      - position
    state_interfaces:
      - position
      - velocity

also don't forget to load the controllers in your Moveit2 launch file. Follow the example here.
https://github.com/ros-planning/moveit2/blob/c029942dbb95387ecccf10a41d48e310450d3528/moveit_demo_nodes/run_moveit_cpp/launch/run_moveit_cpp.launch.py#L135-L154

Latest Moveit2

repositories:
  # moveit2
  moveit2:
    type: git
    url: https://github.com/ros-planning/moveit2
    version: 2.1.4
  moveit_msgs:
    type: git
    url: https://github.com/ros-planning/moveit_msgs
    version: 2.0.1
  moveit_resources:
    type: git
    url: https://github.com/ros-planning/moveit_resources
    version: 2.0.2
  geometric_shapes:
    type: git
    url: https://github.com/ros-planning/geometric_shapes
    version: 2.0.2
  srdfdom:
    type: git
    url: https://github.com/ros-planning/srdfdom
    version: 2.0.2

  # ros2_control
  ros2_control:
    type: git
    url: https://github.com/ros-controls/ros2_control
    version: 0.7.0
  ros2_controllers:
    type: git
    url: https://github.com/ros-controls/ros2_controllers
    version: d989e7caa2d3e862b3e4e8e1eb7934f1f216eeae

  # warehouse
  warehouse_ros:
    type: git
    url: https://github.com/ros-planning/warehouse_ros
    version: 2.0.1

  warehouse_ros_mongo:
    type: git
    url: https://github.com/ros-planning/warehouse_ros_mongo
    version: 2.0.1

gazebo_ros2_control

repositories:
  gazebo_ros2_control:
    type: git
    url: https://github.com/ros-simulation/gazebo_ros2_control
    version: a33ea2eeb37094177103084e065626d63ce31a7d

@shonigmann
Copy link

shonigmann commented Aug 13, 2021

fwiw, I can build everything using the default branches for each dependency (moveit2, ros2_control, gazebo_ros2_control, etc) rather than specific commits and things now behave as expected. In #54, I mention a few pitfalls / tweaks to watch out for. But I don't think it is still necessary to build using specific versions (you of course still can if you like a bit of stability in your life😄). But with that in mind, perhaps this issue can be closed?

@dvalenciar
Copy link

Did you ever fix this as I have a very similar behavior.

Me too, any idea how to solve it?

@AlezzzRd
Copy link

AlezzzRd commented May 9, 2022

I had a very similar problem with gazebo11 and I finally solved it by adding friction and damping parameters in each joint. like
<dynamics damping="60.0" friction="4.0"/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants