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

Dynamically adding a line to gazebo

asked 2021-07-12 19:16:41 -0500

sisko gravatar image

updated 2021-07-12 20:23:23 -0500

I came a cross this video which shows a statically added line for a robot to follow.

However, I'm looking for a solution that will allow me to dynamically add lines to my gazebo model for the same purpose. This is because my gazebo model has a lot of obstacles and I'm looking for a technique that will allow me to "draw" lines where I need them. As mentioned previously, the aim is to define a virtual line/path for the robot to follow.

I would appreciate insights into if this is possbile and how I can go about it ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-07-14 17:08:42 -0500

shonigmann gravatar image

The first method that comes to mind that I know would work, but might not necessarily be the most elegant solution, would be to create a "line_segment" gazebo model, of some characteristic unit length, make it static, and just give it a visual tag (no collision or inertial needed). Then write a node that dynamically spawns this model, as needed, in the desired locations. This is a bit clunky because it will spin up a separate process for each line segment model, but for a simple box model, should work pretty well. You could dynamically generate the model's SDF file as well to accept variable length line segments.

A second option, that may work a bit better if your input is a hand-drawn line (i.e. as an image), you could look at the projector plugin. This has the caveat that it will also project the line onto your robot as your robot drives underneath the projector.

A more elegant solution might be to write a Gazebo plugin and take advantage of some of the rendering API. You could probably use the DynamicLines or perhaps the Road2d class to achieve what you are looking to do. I have no experience with this, so I'm not 100% sure it would work with the simulated camera,

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2021-07-12 19:16:41 -0500

Seen: 785 times

Last updated: Jul 14 '21