ros-controls / ros2_controllers

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

ackerman drive controller odometry rotation changes continuously #1244

Open luxapana opened 3 months ago

luxapana commented 3 months ago

I have setup an ackerman controller based on the demo's mentioned in the repo - https://github.com/ros-controls/gz_ros2_control/tree/master.

The controller is used in non chained mode. I have setup the plugin to remap tf_odometry messages as follows: <remapping>/ackermann_steering_controller/tf_odometry:=/tf</remapping>

In addition to the controller, the joint state braodcaster also publisher messages to /tf topic.

When viewed in rviz2, everything works when things are stationary. When the car is moved linearly by publishing twist messages as below with only a linear velocity, the Rviz properly shows the movement and it is in sync with what is shown in gazebo.

ros2 topic pub /ackermann_steering_controller/reference_unstamped geometry_msgs/msg/Twist '{linear: {x: 1.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.0}}'

If I include a steering angle component in the twist message, the movement is not in sync with gazebo. When these is only a steering angle component as below, in Rviz, the car rotates.

ros2 topic pub /ackermann_steering_controller/reference_unstamped geometry_msgs/msg/Twist '{linear: {x: 0.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.1}}'

Please see below for a video. Also, when inspected /tf topic with ros2 topic echo, I can see that odom to base_link transform changes continuously. This agrees with what is shown in RViz.

Since what is set is steering angle and the vehicle movement is zero, can there be a continuous change in odom to base_link?

Screencast from 07-27-2024 06:23:35 PM.webm

christophfroehlich commented 2 months ago

Can you share your controller parameters? Are you using open_loop mode? Could you change that parameter and see if the behavior changes?

Which version are you using? ros2 pkg xml -t version steering_controllers_library

christophfroehlich commented 2 months ago

In addition to the controller, the joint state braodcaster also publisher messages to /tf topic.

you mean the robot state publisher?

luxapana commented 2 months ago

The version is 2.35.0. I tried open loop control, but still its the same. However rotation now is much slower. Please see below video in which I sent only a rotational element as follows:

ros2 topic pub /ackermann_steering_controller/reference_unstamped geometry_msgs/msg/Twist '{linear: {x: -0.00, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.2}}'

Screencast from 08-08-2024 06:45:06 AM.webm

christophfroehlich commented 2 months ago

~Would you like to share your robot, or maybe even contribute them to gz_ros2_control_demos?~ Do you have the same behavior with the ackermann drive example from the demos?

But actually, this should be reproducible with Mock Hardware as well if you have the same behavior with open loop control.

luxapana commented 2 months ago

I will shares the files, no problem.

luxapana commented 2 months ago

files.zip Please see the urdf, launch and controller config files attached. Although I am also running slam, navigation and ekf fusion nodes, this issue is present without them also.

I have not tried the ackerman drive example from demos yet.