Gazebo | Ignition | Community
Ask Your Question
0

Adding dynamic markings on ground plane

asked 2021-06-17 02:09:40 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I am working on a janitorial robot. I would like to simulate patches on the ground plane (plain black square patches), make the robot detect these via cameras and simulate the cleaning task. However only the area cleaned by the robot should disappear in the patch. For example if the patch is a 1x1 square and the robot manages to clean only the upper left corner of it, I need only that portion to disapper. What is the best way to simulate this in gazebo? These are my attempts so far:

Visual markers in gazebo8+ - gazebo examples

Triangulated the whole square and used TRIANGLE_LIST visual markers. However the marker manager for gazebo isn't initialised on the server side (from these lines) making these markers invisible to sensors like cameras. These are only visible in the GUI.

Visual plugin loaded to ground plane

I wrote a visual plugin and loaded it to the ground plane. Managed to use the DynamicLines class to render triangles (again, triangulated the whole square and used RENDERING_TRIANGLE_LIST as render operation type for the lines), following this answer. Changed visibility type to GZ_VISIBILITY_ALL instead of GZ_VISIBILITY_GUI to make it visible to cameras. But the behaviour in this case is quite strange. Gazebo renders the visual either in the GUI or in the camera but not both, and this varies randomly during different runs.

What is the best way to simulate this feature in gazebo??

Setup: Gazebo 11.6 + ROS Noetic on Ubuntu 20.04

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-06-19 01:55:52 -0600

ashwin5059198 gravatar image

Answering this question myself because this was an implementation error on my side.

Visual plugin was the way to go. Internally my plugin initialised a ROS server that provided services for adding and deleting the patches. Since visual plugins gets loaded on both the gzserver side and gzclient side, there was a race condition involved and only one of the plugins got to initialise the ROS server. This was the reason why the patch got rendered either on GUI (ROS server on gzclient's plugin instance) or camera image (ROS server on gzserver's plugin instance).

Using ROS subscribers instead of service servers solved the issue and it works like a charm now!!

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-06-17 02:09:40 -0600

Seen: 433 times

Last updated: Jun 19 '21