Use differential drive controller to publish velocity
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 !
What is the 'same format'. What message does your robot publish? The
gazebo_ros
plugin publishesnav_msgs/msg/Odometry
which 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.