Discussion - Concept Design Gazebo (Making a Mobile Robot Pt 3)

Blog Post

This is the discussion topic for the video and blog post linked above. Please keep all replies relevant to the content, otherwise create a new topic.

When I try to visualize the robot moving from gazebo in rviz, I add a transform and try and set the global fixed frame to odom but it does not show up. My only options are base_footprint, base_link, caster_wheel, and chassis. In addition to odom missing, I am also missing both wheels in the drop down.

BUT if I have rviz open prior to launching gazebo odom shows up.

Any thoughts on why the order of launching rviz then gazebo seems to matter?

1 Like

@Steven @JoshNewans Have you found any solution for it

@sampath_ganesh No, I am still using the work around of running Rviz first.

Yeah me either unfortunately. Just hoping an update magically fixes it at some pointā€¦

im also unable to find odom in the Rviz2.
i tried copying all required files from updated git profile but still not able to get the odom in the Rviz

I have another issue. Everything works fine except the last one bit. When i try to launch gazebo with the obstacles, they just donā€™t show up in the simulation. Do i need to download/create a my.world file first or is it just a bug?

hi, iā€™m trying to add another pair of wheel instead of caster wheel, and the rviz model work just fine. however in gazebo the second pair doesnā€™t show up. Anyone knows why so?
the second part of the question is, if i want the new pair just to ā€œfollowā€ the vehicle, what should i change in gazebo_control file?

Yeah you will need to create your own world file (which I think I cover in the video? I havenā€™t got time to check now). Or you could download one like this.

Hmm, if the other pair does not turn (e.g. ackermann steering) then you will encounter some issues due to friction but it should still kind of work. Are you thinking these other wheels will be driven or free-spinning?

Make sure you have unique names for all your joints and links and they are located in the correct spot (I suppose you say it is fine in RViz). They donā€™t show up in the model tree on the left side of Gazebo?

no the wheels donā€™t turn. and though theyā€™ll be driven afterwards for simplification i want to simulate them as free-spinning. itā€™s actually thought as kid of a truck to the main robot.

Thatā€™s correct, they donā€™t show up in the model tree only in gazebo. Here are the two cases of the parts 2&3:

  1. I can launch rsp launch file with joint_state_publisher_gui and everything works correctly in rviz
  2. If i launch sim file, then the second pair of wheel doesnā€™t show up in gazebo, though in terminal all the links are started. If i start the rviz in that case the whole ā€œtruckā€-part is white unless i start the joint_state_publisher_gui. After that it is visualized correctly in rviz (but still not in gazebo)

i canā€™t find any infos about the plugin you are using here. any help?

Make sure that everything is spelled correctly. Itā€™s bit of a pain in the arse to go through everything but I had a ā€˜no transform from wheel link to odomā€™ error and found out that I had put in <publish_wheel_transform> instead of <publish_wheel_tf>. I have made a few silly mistakes like that so definitely worth going over all the code and make sure that everything is correct as theyā€™re easy mistakes to make.

hello i downloaded the repository and iā€™m facing similar issues, iā€™m unable to move the robot at all through teleop_twist, iā€™m using ros2 foxy on ubuntu 20.04 LTS any ideas?

for additional info it is publishing the commands but its not doing anything
(I found out that it spits out ā€œController manager not availableā€ in the terminal)

did u find a solution ??

Hi all,
Use this xacro in the file gazebo_control.xacro
The problem is due to the incorrect tag usage in the original code. The incorrect tags have been commented and substituted with correct ones.

All the Best !

References:
https://classic.gazebosim.org/tutorials?tut=ros_gzplugins See the section Differential Drive
https://github.com/ros-simulation/gazebo_ros_pkgs/blob/noetic-devel/gazebo_plugins/src/gazebo_ros_diff_drive.cpp

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="jim_bot1">

    <gazebo>
        <plugin name='differential_drive_controller' filename='libgazebo_ros_diff_drive.so'>
       
            <!-- Plugin update rate in Hz -->
            <updateRate>10</updateRate>

            <!-- Wheel Information -->
            <leftJoint>left_wheel_joint</leftJoint>
            <rightJoint>right_wheel_joint</rightJoint>
            <wheelSeparation>0.35</wheelSeparation>
            <wheelDiameter>0.1</wheelDiameter>
    

            <!-- Limits -->
            <wheelTorque>200</wheelTorque>
            <wheelAcceleration>10.0</wheelAcceleration>
    

            <!-- Output -->
            <!-- <odometry_frame>odom</odometry_frame> -->
            <odometryFrame>odom</odometryFrame>

            <!-- <robot_base_frame>base_link</robot_base_frame> -->
            <robotBaseFrame>base_link</robotBaseFrame>
            
            <!-- <publish_odom_tf>true</publish_odom_tf> -->
            <publishOdomTF>true</publishOdomTF>
           
            <!-- <publish_wheel_tf>true</publish_wheel_tf> -->
            <publishWheelTF>true</publishWheelTF>
    
    
        </plugin>
    </gazebo>
</robot>

We should not forget to use Joint_State_Publisher Node!!!

Hi all, I have a problem . When i run teleop_twist_keyboard and press u i o key but nothing happened in gazebo . I canā€™t move the robot .

my diff_drive canā€™t sub to /cmd_vel . Please help

Yes, you are correct.
Kindly find the updated xacro file

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="jim_bot">
    <gazebo>
        <plugin name='differential_drive_controller' filename='libgazebo_ros_diff_drive.so'>
       
            <!-- Misc configs-->
            <alwaysOn>true</alwaysOn>
            <legacyMode>false</legacyMode>
            <updateRate>10</updateRate>
            <rosDebugLevel>na</rosDebugLevel>

            <!-- Wheel Information -->
            <wheelSeparation>0.155</wheelSeparation>
            <wheelDiameter>0.066</wheelDiameter>

            <!-- Joints -->
            <leftJoint>left_wheel_joint</leftJoint>
            <rightJoint>right_wheel_joint</rightJoint>
            
            <!-- Limits -->
            <wheelTorque>10</wheelTorque>
            <wheelAcceleration>2.0</wheelAcceleration>
            <torque>5</torque>

            <!-- topics  -->
            <commandTopic>cmd_vel</commandTopic>
            <odometryTopic>odom</odometryTopic>
            <odometrySource>world</odometrySource>    <!-- odometrySource options "world" "encoder" --> 
            
            <!-- Frames -->
            <odometryFrame>odom</odometryFrame>
            <robotBaseFrame>base_link</robotBaseFrame>
            
            <!-- outputs -->
            <publishTf>1</publishTf>
            <publishOdomTF>true</publishOdomTF>
            <publishWheelTF>true</publishWheelTF>
            <publishWheelJointState>true</publishWheelJointState>

        </plugin>
    </gazebo>
</robot>