Publishing a topic "gz topic -t ... -p ..." is unreliable

I’m new to Gazebo. I wanted to try out Gazebo for my robot hobby. So I followed your tutorials and made a binary install of Gazebo Garden in ubuntu-22.04.2-desktop-amd64 (in a VirtualBox).

gz sim pendulum_links.sdf
Gazebo works fine when I press the start arrow. I see a animated/swinging double pendulum as expected. :slight_smile:

gz sim diff_drive.sdf
Gazebo shows a blue and a green vehicle. I follow the tutorials, press the the start arrow, switch to a new terminal and enter:

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

But nothing happens even when I wait a very very long time. As if the topic was not published. I expected the vehicle to drive in a circle. I found out that I have to repeat this command multiple times (up to 10 times):

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

Then, out of nothing the vehicle starts to react and drove the circle. Likewise, when I want to guide the moving vehicle into an opposite circle, I have to try several times as well e.g.:

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

Before the vehicle reacts. :frowning: On the other hand, sometimes it works after only one try.

I expected to have a vehicle reaction per command. So repeating of a “gz.msgs.Twist” message should not be needed?!