0
$\begingroup$

I have a fresh installation of Ubuntu 22.04 in a VM VirtualBox, fully updated. I compiled Gazebo Harmonic from source code and followed the "Building your own robot" tutorial creating the building_robot.sdf and then move the vehicle with the keyboard...

The problem is that when, from another terminal I type the command:

gz topic -t "/cmd_vel" -m gz.msgs.Twist -p "linear: {x: 0.5}, angular: {z: 0.05}"

the message does not reach Gazebo and the vehicle does not move. But if you keep on sending the same command about 10 - 12 times, all of a sudden the vehicle starts to move...!

This is my diff-drive configuration:

        <plugin
            filename="gz-sim-diff-drive-system"
            name="gz::sim::systems::DiffDrive">
            <left_joint>left_wheel_joint</left_joint>
            <right_joint>right_wheel_joint</right_joint>
            <wheel_separation>1.2</wheel_separation>
            <wheel_radius>0.4</wheel_radius>
            <odom_publish_frequency>1</odom_publish_frequency>
            <topic>cmd_vel</topic>
        </plugin>
    </model>                

Can someone pls explain why this is so? What am I missing or doing wrong?

Thanks in advance for any suggestions,

Marco

$\endgroup$
3
  • 1
    $\begingroup$ Are you sure you have the right topic? Try gz topic --list to see if /cmd_vel is present. Also make sure gazebo is running (playing) and the DiffDrive plugin is loaded. And please share your plugin config. $\endgroup$ Commented Apr 23 at 12:30
  • $\begingroup$ @David Brown: I added my plugin config above... I see the topic in the list... please show me how to check if DiffDrive is running $\endgroup$
    – Marco
    Commented Apr 23 at 13:07
  • $\begingroup$ Can you post your full log output as well? Try gz topic --info /cmd_vel to make sure there is a subscriber for the topic. This is the DiffDrive plugin. The delay you are experiencing might just be a delay in starting the simulation. The robot will not move until you push the "play" button in gazebo or if you have autostart enabled. $\endgroup$ Commented Apr 24 at 7:10

1 Answer 1

0
$\begingroup$

I've recreated your issue on the lastest harmonic and I indeed see the same.

The steps to recreate it (for reference for others:

Started the sim with (I used the finished version which is called moving_robot.sdf)

gz sim moving_robot.sdf

And only angular

gz topic -t "/cmd_vel" -m gz.msgs.Twist -p "linear: {x: 0.5}"

Indeed no response! Eventhough it is clearly subscribed when I check with

$gz topic --info -t /model/vehicle_blue/cmd_vel
No publishers on topic [/model/vehicle_blue/cmd_vel]
Subscribers [Address, Message Type]:
  tcp://172.19.0.1:40489, google.protobuf.Message

Apparent solution

However, when I started the gazebo and the world with -r, it does respond to the twist commands! I don't see any difference in the above subcription test either

gz sim -r moving_robot.sdf

I've tried this on multiple Ubuntu installs and reinstalled harmonic multiple times both from binaries and source and on different types of model so I see the same thing. So perhaps its a bug that we have found. I'll see where the best place is to report it, but probably the gz-sim repo?

Update

It's not responding because it's paused and the -r starts gazebo immediately upon startup. There is even a note in the tutorial and I have missed it as well at first.

$\endgroup$
2
  • $\begingroup$ Thank you very much Kimberly!! Unfortunately, in my current set up, it does NOT work even with the -r option... Pls let me know where you are going to report it and if I can be of any help...! $\endgroup$
    – Marco
    Commented Apr 29 at 10:49
  • $\begingroup$ Unfortunately the reason it does not work is because we installed it in a VirtualBox. Please read this discussion on GitHub $\endgroup$
    – Marco
    Commented Jun 4 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.