ros-controls / ros2_controllers

Generic robotic controllers to accompany ros2_control
https://control.ros.org
Apache License 2.0
356 stars 319 forks source link

joint_state_broadcaster publish wrong joint velocity #1230

Closed OTT123 closed 2 months ago

OTT123 commented 2 months ago

Describe the bug I used joint_state_broadcaster to send the status of the robot in gazebo to topic /joint_states.

When I check the information in /joint_states, I found that the position was accurate, but the velocity was completely singular.

You can observe this phenomenon in the graph below. When the position is held still, the speed also remains at a constant value, and the trend of speed and position is exactly similar.

I wonder how joint_state_broadcaster gets the joint speed? How did this strange phenomenon come about?

Screenshots 20240729-165559

controller param file

controller_manager:
  ros__parameters:
    update_rate: 1000
    use_sim_time: true

    arm_controller:
      type: joint_trajectory_controller/JointTrajectoryController

    joint_state_broadcaster:
      type: joint_state_broadcaster/JointStateBroadcaster

arm_controller:
  ros__parameters:
    joints:
      - some joints
    command_interfaces:
      - position
      # - velocity

    state_interfaces:
      - position
      - velocity
      # - effort

urdf

<gazebo>
    <plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
      <robot_param>robot_description</robot_param>
      <robot_param_node>robot_state_publisher</robot_param_node>
      <parameters>./config/gazebo_robot_control.yaml</parameters>
    </plugin>
</gazebo>
<ros2_control name="RobotSystem" type="system">
    <hardware>
      <plugin>gazebo_ros2_control/GazeboSystem</plugin>
    </hardware>
    <joint> some joints </joint>
            ......
</ros2_control>
<joint>
  some joints
</joint>
......
<link>
  some linkd
</link>
......

Environment (please complete the following information):

christophfroehlich commented 2 months ago

https://robotics.stackexchange.com/questions/112425/ros2-control-joint-state-broadcaster-publish-wrong-joint-velocity