ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Use differential drive controller to publish velocity

asked 2022-05-23 05:48:00 -0500

Bastian2909 gravatar image

updated 2022-05-23 09:08:07 -0500

ljaniec gravatar image

Hello, first of all, for a bit of context : I'm using Ubuntu 20.04 with ROS Foxy and Gazebo 11 (I think) I'm still learning ROS so I might be inacurate but I'll try my best!

I'm building a simulation for a real robot. This real robot already implement an extended Kalman filter with the robot localization package. This EKF takes as an input an imu and odometry from motor controllers. This odometry consists of the linear X velocity and the angular Z velocity.

The EKF produces the odom ->base_link /tf and i want the simulation to be as similar as possible to the actual robot.

My question is:

Is there a way to make the differential_drive_controller plugin publish data on the same format and not x,y and z position as it is currently doing :

here is my code for the diff_drive_controller in my robot_description :

<gazebo>
<plugin name='diff_drive' filename='libgazebo_ros_diff_drive.so'>
<ros>
<remapping>odom:=motor_controller/odom</remapping>
</ros>

<!-- wheels -->
<left_joint>left_wheel_joint</left_joint>
<right_joint>right_wheel_joint</right_joint>

<!-- kinematics -->
<wheel_separation>0.609</wheel_separation>
<wheel_diameter>0.625</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>false</publish_odom_tf>
<publish_wheel_tf>true</publish_wheel_tf>

<odometry_frame>odom</odometry_frame>
<robot_base_frame>base_link</robot_base_frame>
</plugin>
</gazebo>

Should i write another node that take the output of diff_drive and transform it correctly ? is there another plugin that could work ? Any help would be greatly appreciated !

edit retag flag offensive close merge delete

Comments

What is the 'same format'. What message does your robot publish? The gazebo_ros plugin publishes nav_msgs/msg/Odometrywhich is the default message to publish odometry in. Which makes me question what you're using on the actual robot.

If that robot is publishing in another message type, I feel like that's a problem of the robot. Of course I don't know if you could update that part to publish using nav_msgs/msg/Odometry. However, I don't think your robot is following the standard for odometry messages.

Joe28965 gravatar image Joe28965  ( 2022-05-24 03:03:12 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2022-05-25 03:55:37 -0500

Bastian2909 gravatar image

Actually, i didn't needed to write a pipeline or anything, but just change my ekf node config file :

odom0: /odom
    odom0_config: [false, false, false,
                  false, false, false,
                  true,  true,  true,
                  false, false, true,
                  false, false, false]

now my ekf takes only input from angular Z velocity and linear X velocity

edit flag offensive delete link more
0

answered 2022-05-23 06:49:51 -0500

ljaniec gravatar image

updated 2022-05-23 06:52:34 -0500

Don't fix what isn't broken :) I would not recommend modifying a properly working and tested node/plugin.

I think you should use a standard approach with a ROS2 pipeline with the correct transform, such as in this tutorial:

edit flag offensive delete link more

Comments

So if i understand correctly, I should use a pipeline to get the data published as x,y and z, integrate it to get the X linear and Z angular velocity and finally publish it to another topic ?

It seems possible but i'm not confident i have the skills do do it now xD

I'll take a look tho, thank you for your advice !

I'm also wondering if what i am looking for can't be extracted from my tf tree (I have base_link, left_wheel, right_wheel), can't i just take the linear velocity of each joints and fuse them to get the linear and angular ?

Bastian2909 gravatar image Bastian2909  ( 2022-05-23 07:38:36 -0500 )edit

I think both approach are worth a try, why not? If you have velocities of both wheels it should be a standard calculation for the differential drive kinematics, e.g. https://www.cs.columbia.edu/~allen/F1...

ljaniec gravatar image ljaniec  ( 2022-05-24 03:48:03 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-05-23 05:48:00 -0500

Seen: 296 times

Last updated: May 25 '22