Unable to use diff drive


I am missing something, that keeps the diff drive from working. The keyboard simulator opens, and the robot does not respond. Is there something that has to be added in setu.py or .xml files?

Hi @ROxX ,

You need to implement ROS-GZ Bridge to enable communication between Gazebo Sim and ROS2.

Refer to this answer: Unable to make robot move in Gazebo Sim section 3.6 - #2 by girishkumar.kannan

Regards,
Girish

PS: Please don’t create duplicates of the same issue. Posting the same issue multiple times will not gain you a faster response!

I am still unable to make the keyboard entry work. I followed the the direction to enter this in webshell 3 - ros2 run ros_gz_bridge parameter_bridge /cmd_vel@geometry_msgs/msg/Twist@ignition.msgs.Twist I also confirmed the the /cmd_vel was there

Appreciate the support, just stuck on this

Hi @ROxX ,

For the diff drive plugin to work properly, you need to bridge all the topics used by the plugin.
So you will have to use a bidirection bridge for cmd_vel (which you have already done) and unidirectional bridge for odom and tf topics from Gazebo Sim to ROS2.

Once you have bridged all the three topics, then your robot should respond well to the teleop program or twist messages.

Regards,
Girish


I have /cmd_vel, /odom & /tf capabilities in the ros2 topic list and I still cannot make the robot move using the keyboard. Can you suggest some other issue that I am missing. Thanks

Hi @ROxX ,
I see many reasons why this may not work. You need to be checking them properly in order to understand what is happening, not just try things.

  1. First of all, you did not show any picture of your simulation running and which robot it is. This gives a lot of context. Please add this to this conversation
  2. Second, you need to check which nodes are “providing” the /cmd_vel topic and in which sense. It may happen that you are publishing speeds and that is the reason why the topic shows, but maybe there is no subscriber to that topic that reads your input values and sends to the wheels. This is the first thing you need to check with a ros2 topic info /cmd_vel —verbose. This will tell you which nodes are using that topic and in which sense (subscriber or publisher)
  3. Next is, if the simulation is the one subscribing to that topic and you have the topic properly connected to the simulation as @girishkumar.kannan mentioned above, you need to manually publish a velocity command on that topic and see if it moves.
    ros2 topic pub /cmd_vel geometry_msgs/msg/Twist '{linear: {x: 1.0}}'

If it doesn’t move, then the problem is with the simulation. Something is wrong there and need to debug.
If it moves, then continue adding layers

  1. Next layer is adding the keyboard teleop. Launch it and press the key. If it doesn’t move, do an echo of the /cmd_vel command. Very likely, there will be not arriving commands to that topic which means that the keyboard teleop is publiching in another topic or has some other problem.

By using this system you can isolate where the problem is and then concetrate on finding the error rather than rumbling around.

Try it and let me know the results


This seems to be ok, please confirm.

<?xml version="1.0"?> 0.0 0.0 1.0 1.0 0.0 0.0 1.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.25 0.25 0.25 1.0 0.25 0.25 0.25 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.1 0.1 0.1 1.0 0.1 0.1 0.1 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.1 0.1 0.1 1.0 0.1 0.1 0.1 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 true 0.5 0.5 0.5 0.5 0.05 0.01
<!-- Link - chassis -->
<link name="link_chassis">
    <inertial>
        <mass value="10" />
        <origin xyz="0 0 0.3" rpy="0 0 0" />
        <inertia ixx="1.5417" ixy="0" ixz="0" iyy="3.467" iyz="0" izz="4.742" />
    </inertial>

    <collision>
        <geometry>
            <box size= "2 1.3 0.4" />
        </geometry>
    </collision>

    <visual>
        <geometry>
           <box size= "2 1.3 0.4" />
        </geometry>
        <material name="Red">
            <color rgba="1 0 0 1" />
        </material>
    </visual>
</link>
<collision>
    <origin rpy="1.5707 0 0" xyz="0 -0.11 0" />
    <geometry>
        <cylinder length="0.12" radius="0.4"/>
    </geometry>
</collision>
<visual>
    <origin rpy="1.5707 0 0" xyz="0 -.11 0" />
    <geometry>
         <cylinder length="0.12" radius="0.4"/>
    </geometry>
    
</visual>
<collision>
    <origin rpy="1.5707 0 0" xyz="0 0.23 0" />
    <geometry>
        <cylinder length="0.12" radius="0.4"/>
    </geometry>
</collision>
<visual>
    <origin rpy="1.5707 0 0" xyz="0 0.18 0" />
    <geometry>
        <cylinder length="0.12" radius="0.4"/>
    </geometry>
</visual>
joint_chassis_left_wheel joint_chassis_right_wheel 1.66 0.4 20 cmd_vel odom tf odom link_chassis

Thanks for your support, I tried your recommendations and the robot does not move. If you find the error, I greatly appreciate it

?xml version=“1.0”?>

0.0 0.0 1.0 1.0 0.0 0.0 1.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.25 0.25 0.25 1.0 0.25 0.25 0.25 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.1 0.1 0.1 1.0 0.1 0.1 0.1 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.1 0.1 0.1 1.0 0.1 0.1 0.1 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 true 0.5 0.5 0.5 0.5 0.05 0.01
<!-- Link - chassis -->
<link name="link_chassis">
    <inertial>
        <mass value="10" />
        <origin xyz="0 0 0.3" rpy="0 0 0" />
        <inertia ixx="1.5417" ixy="0" ixz="0" iyy="3.467" iyz="0" izz="4.742" />
    </inertial>

    <collision>
        <geometry>
            <box size= "2 1.3 0.4" />
        </geometry>
    </collision>

    <visual>
        <geometry>
           <box size= "2 1.3 0.4" />
        </geometry>
        <material name="Red">
            <color rgba="1 0 0 1" />
        </material>
    </visual>
</link>
<collision>
    <origin rpy="1.5707 0 0" xyz="0 -0.11 0" />
    <geometry>
        <cylinder length="0.12" radius="0.4"/>
    </geometry>
</collision>
<visual>
    <origin rpy="1.5707 0 0" xyz="0 -.11 0" />
    <geometry>
         <cylinder length="0.12" radius="0.4"/>
    </geometry>
    
</visual>
<collision>
    <origin rpy="1.5707 0 0" xyz="0 0.23 0" />
    <geometry>
        <cylinder length="0.12" radius="0.4"/>
    </geometry>
</collision>
<visual>
    <origin rpy="1.5707 0 0" xyz="0 0.18 0" />
    <geometry>
        <cylinder length="0.12" radius="0.4"/>
    </geometry>
</visual>
joint_chassis_left_wheel joint_chassis_right_wheel 1.66 0.4 20 cmd_vel odom tf odom link_chassis 0.0 0.0 1.0 1.0 0.0 0.0 1.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.25 0.25 0.25 1.0 0.25 0.25 0.25 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.1 0.1 0.1 1.0 0.1 0.1 0.1 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.1 0.1 0.1 1.0 0.1 0.1 0.1 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 true 0.5 0.5 0.5 0.5 0.05 0.01
<!-- Link - chassis -->
<link name="link_chassis">
    <inertial>
        <mass value="10" />
        <origin xyz="0 0 0.3" rpy="0 0 0" />
        <inertia ixx="1.5417" ixy="0" ixz="0" iyy="3.467" iyz="0" izz="4.742" />
    </inertial>

    <collision>
        <geometry>
            <box size= "2 1.3 0.4" />
        </geometry>
    </collision>

    <visual>
        <geometry>
           <box size= "2 1.3 0.4" />
        </geometry>
        <material name="Red">
            <color rgba="1 0 0 1" />
        </material>
    </visual>
</link>
<collision>
    <origin rpy="1.5707 0 0" xyz="0 -0.11 0" />
    <geometry>
        <cylinder length="0.12" radius="0.4"/>
    </geometry>
</collision>
<visual>
    <origin rpy="1.5707 0 0" xyz="0 -.11 0" />
    <geometry>
         <cylinder length="0.12" radius="0.4"/>
    </geometry>
    
</visual>
<collision>
    <origin rpy="1.5707 0 0" xyz="0 0.23 0" />
    <geometry>
        <cylinder length="0.12" radius="0.4"/>
    </geometry>
</collision>
<visual>
    <origin rpy="1.5707 0 0" xyz="0 0.18 0" />
    <geometry>
        <cylinder length="0.12" radius="0.4"/>
    </geometry>
</visual>
joint_chassis_left_wheel joint_chassis_right_wheel 1.66 0.4 20 cmd_vel odom tf odom link_chassis

Hi @ROxX ,

Please reformat your URDF file contents as markdown code-block so we can help you better.

Both you and I know that something like this should not be present in the URDF file, especially in an XML document.

Also, for the above two references. Both you and I know that the above two parts don’t make any sense.

If you are not going to help us help you better, things are only going to become hard for both of us.
First learn how to use markdown formatting and post your URDF file contents properly here.

Please refrain from copy-pasting code files as-is for the sake of posting stuff.
Also, don’t paste parts of your file. Either paste it fully or don’t. We won’t be able to help you if you paste half contents.
Understand that you are in learning phase. Nobody is going to steal your work!

Refer to this page for proper markdown formatting: Extended Syntax | Markdown Guide

Regards,
Girish

Sorry for the mess, but I must have had the friction wrong, as the robot now moves with the keyboard.

Sorry for the mess, not sure how it was created. Somehow the cut and copy failed me. I I appreciated the guidance you and others provide.

Tom .

Hi @ROxX ,

No issues, don’t worry about it!

If you post your robot description file as a whole, formatted as code-block, then one of us can help you with your issue!

Regards,
Girish

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.