Gazebo | Ignition | Community
Ask Your Question

Publishing to a Gazebo Topic by Terminal

asked 2017-08-11 22:08:46 -0600

ItzMeJP gravatar image

Can I pub a test message to a specific Gazebo topic using a terminal line command?

I am looking for something like the command rostopic pub for ROS, but for Gazebo.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-08-14 19:26:47 -0600

iche033 gravatar image

there is a command line tool but it's not exactly the same as rostopic pub. You can send commands like modifying model/camera/joint properties, etc but you can't publish commands to arbitrary gazebo topics.

type gz help for more info

edit flag offensive delete link more


I already did it and no options help me. Is there any code example (in C++) of a simple publish (to a exist random topic) for gazebo?

ItzMeJP gravatar imageItzMeJP ( 2017-08-15 16:53:12 -0600 )edit
iche033 gravatar imageiche033 ( 2017-08-16 11:48:44 -0600 )edit

This link is broken =/

ItzMeJP gravatar imageItzMeJP ( 2017-08-16 12:24:10 -0600 )edit

Now it works, thank you. It is what I am looking for.

ItzMeJP gravatar imageItzMeJP ( 2017-08-16 13:19:22 -0600 )edit

ups... link broken again (after almost 4 yr). Is the example still available?

corot gravatar imagecorot ( 2021-04-17 01:36:05 -0600 )edit

Calling gazebo::setupClient(); is absolutely necessary, even if gazebo is already running.

JakobThumm gravatar imageJakobThumm ( 2021-06-22 03:09:05 -0600 )edit

answered 2017-10-13 09:32:52 -0600

craig gravatar image

gz command can help here. I use it to send joint commands to the pioneer2dx, for example:

gz joint -m pioneer2dx -j left_wheel_hinge --vel-t 1.0 --vel-p 1.0

This will send a joint command to the joint left_wheel_hinge of the model named pioneer2dx. The message is sent as a one-shot so may not do what you want, but it can be useful for testing.

edit flag offensive delete link more

Question Tools



Asked: 2017-08-11 22:08:46 -0600

Seen: 2,973 times

Last updated: Oct 13 '17