mismatch effort_controllers/commands and /joint_states when using gazebo
I'm using ROS2 Foxy Gazebo 11
In my project, i use effort controller to control my robot. when i run my test, effort_controllers/commands and /joint_states are not the same value i send torque to joint 2 through effort_controllers/commands but in /joint_states joint 4 rcv i try to change my urdf file but nothing change. my /effort_controller/commands
name:
- joint_1
- joint_2
- joint_4
- joint_5
- joint_3
- joint_6
- joint_7
position:
- -1.178107414362552
- 1.4812393690180716
- 3.13999404107763
- 0.8967537553126199
- 3.140815354598864
- -0.1518385107602871
- -1.7504313387899852
velocity:
- 0.007313363959996982
- 0.030346796390004288
- -0.022291851686100962
- -0.01782478252102926
- 0.0031208610492774944
- -0.03211991856186212
- -0.1562150827750543
effort:
- 0.0
- 0.0
- 0.0
- 100.0
- 300.0
- 0.0
- 0.0
my /joint_states:
layout:
dim: []
data_offset: 0
data:
- 0.0
- 0.0
- 300.0
- 0.0
- 100.0
- 0.0
- 0.0
I suspect your
ros2_control
configuration may be inconsistent if things are out of order. Hard to say without seeing the URDF and YAML. my guess is that the order of joints specified to thejoint_state_broadcaster
andeffort_controller
are different. As a sanity check, you could monitor the effort being applied to your joints in the Gazebo Client GUI (example use of the plotting utility here) to confirm whether different joints are getting the expected commands or not. If that doesn't help, i'd suggest editing your question to include a copy of the<ros2_control>
block of your URDF and the.yaml
controller config file you are using.here is my yaml
and here is my block <ros2_control>