ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Showing visual element in Gazebo that has no physics from ROS node?

asked 2016-11-02 06:12:52 -0600

Masoud gravatar image

Hello everybody

I'm wondering is there a way to add simple geometry shapes (e.g. sphere and line) from a running ROS node?

I have a humanoid robot that walks successfully and I want to visualize, COG, ZMP and support convex hull in gazebo GUI. Currently I have a node that computes the location of COG and ZMP in each time step, and all I want is to draw two sphere in gazebo that coincide with ZMP and COG location.

Thanks for your attention

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-11-02 07:21:12 -0600

Airuno2L gravatar image

The common way of doing what you're talking about is to add shapes and stuff for development in RViz, not Gazebo.

Gazebo is the physics simulator, you can think of it as the real world with a real robot in it. In Gazebo, you should only see what you would see if you were looking at your real robot (you wouldn't see it's center of gravity).

RViz is a visualization tool that is made for this kind of thing. In RViz, you can see any data that your robot "sees" or knows about. Gazebo outputs information about the robot's sensors (i.e. joint angles) like a real robot would, which allows you visualize how robot thinks it is posed in RViz (by viewing the RobotModel in RViz). Then you can add things like center of gravity, velocity vectors, etc as lines, spheres, etc (these are called markers). Here are some tutorials on how to do that last part.

edit flag offensive delete link more

answered 2016-11-03 10:59:03 -0600

lucasw gravatar image

Take a look at the gazebo/spawn_sdf_model rosservice, which takes a SpawnModel. You would create a short sdf string that creates a sphere with your desired properties (similar to the xml string in , but the surrounding gazebo api stuff isn't needed). Leave out any <collision>. <kinematic>true</kinematic> isn't supported yet, I'm not sure if <gravity>false</gravity>is needed.

Every time you calculate a new sphere location you would call the set_model_state service to set the position of the sphere.

I'm going through something similar right now and will update this in a few hours.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-11-02 06:12:52 -0600

Seen: 1,095 times

Last updated: Nov 03 '16