Differential Drive not turning the vehicle
I am using the differential drive controller from the ros2-control package and its gazebo plugin to simulate a 4WD drive differential drive robot. I am basing the measurements of the chassis, tire and their location/joints from the dimensions of a riding mower after converting from imperial to metric of course.
For the chassis I am using a standard box visual geometry for now, and just cylinder geometry for wheels...nothing fancy, you can see the entire URDF here . I studied carefully how to make gazebo valid URDF and was finally able to spawn a working model in gazebo from URDF which is important because the gazebo plugin launches the ros2 controller manager.
Here is the URDF for ros2-control gazebo plugin, and the ros2-control diff-drive controller config. Finally my launch file...
What this all yields is a nice small city world in gazebo (a few streets, road signs, traffic lights and other cars, and my robot model spawned and ready to be controlled via a PS4 controller using the ros2-teleop-joy package, or really just any /cmd_vel Twist message.
The problem is that it is moving forwards and backwards, but not turning, no matter what the angular velocity of the /cmd_vel command is.
I run the following command for example, which should make it move in circles, but instead it just moves forward
ros2 topic pub --rate 30 /tareeqav_base_controller/cmd_vel_unstamped geometry_msgs/msg/Twist "linear:
x: 0.7
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 1.0"
I also tried the standard Gazebo diff drive plugin with the following config
<plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
<!-- wheels -->
<left_joint>a_fr_left_joint</left_joint>
<right_joint>b_fr_right_joint</right_joint>
<!-- kinematics -->
<wheel_separation>1.25</wheel_separation>
<wheel_diameter>0.3</wheel_diameter>
<!-- limits -->
<max_wheel_torque>20</max_wheel_torque>
<max_wheel_acceleration>1.0</max_wheel_acceleration>
<!-- output -->
<publish_odom>true</publish_odom>
<publish_odom_tf>true</publish_odom_tf>
<publish_wheel_tf>true</publish_wheel_tf>
<odometry_frame>odom</odometry_frame>
<robot_base_frame>base_footprint</robot_base_frame>
<command_topic>cmd_vel</command_topic>
</plugin>
I've played with the controller config min/max velocities, tried changing the wheel radius and distance between wheel. Nothing works beyond driving forwards and backwards.
I've built physical robots where I have 4 wheels and a control signal shared between the two motors on each side and the car drives and turns with no problems.
Any thoughts on what might be happening, or where I should look next?
These issues are usually caused by friction parameters. It appears that you are using dead-reckoning for rotation. There is a longer discussion about this for husky robots: https://github.com/husky/husky/issues...
Check PR 191 on how I tried to get this working by adjusting friction parameters in
wheel.xacro
file.@destogl many thanks for this reply! You are correct, the issue was the mu friction parameters. I tested with different mu1/mu2 combinations and found that m1="1.0" and m2="0.25" seem to work very well with the current state of the URDF. Thanks again for your reply! Do you mind to extend your comment to an answer so that it may help someone who has a similar issue?
@sameh4 I wrote my commend as answer. Please mark it as correct if you are happy with it.