Ask Your Question
0

How to Label an object in /map

asked 2013-09-26 09:25:45 -0600

this post is marked as community wiki

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

Right now I have a pioneer dx that navigates using gmapping, and learns from the environment to avoid obstacles to reach its goal. Also i have a code that detects people, and from which i can obtain its position. What i need to do is connect this two parts of the project and label in the /map that is being used in gmapping the person i detected, so that for example in the /map an orange dot appears where the person was detected. The idea is to dynamically create a semantic map. Does anyone have an idea how to accomplish this?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2013-09-26 12:47:04 -0600

joq gravatar image

updated 2013-10-01 10:33:27 -0600

The usual ROS way to label things for visualization is publishing rviz Markers with the appropriate coordinates in the map frame. There is a Tutorial.

You seem to want something different. Can you explain what you need?

UPDATE: I agree with @jorge that you should publish a separate topic with semantic map information. Many ROS components use standard map messages.

Instead of breaking that interface, publish your data on a parallel topic, like semantic_map. You can invent a custom message, or just use the rviz message if it is close enough to suit your needs.

I would still publish the markers on the rviz visualization_marker_array topic. It can contain text labels, if desired.

I suspect other people are already doing similar things. Maybe there would be interest in designing a common ROS semantic mapping message.

UPDATE2: since people are not fixed in either the robot's frame of reference or the map, you probably need to assign them each their own frame ID to track their motion. You can publish the marker in that frame, and your person detector can publish the transform from each person to the /map frame.

To do that you're going to need to learn the tf package pretty thoroughly. Start with its Tutorials. Ask (separate) questions if they are unclear.

edit flag offensive delete link more

Comments

@joq Even thought I had not thought in markers this might work as a worst case scenario. What I want to accomplish is to change the the /map topic and add information to this topic. Or generate one that listens to /map adds the new information and the publishes in a new topic. Do you have any idea how to manage this, to create a dynamic semantic map?

ctguell gravatar image ctguell  ( 2013-09-26 16:47:41 -0600 )edit

Maybe you can use ROS message to build your own structure for topic.

sam gravatar image sam  ( 2013-09-26 21:07:41 -0600 )edit

@joq@felix k ive just finished the tutorial, and understand how to generate Markers, but as Im using it on a moving robot i wanted to create a marker that as the robot moves moves accordingly to it. So if the robot moves towards the marker the marker would get closer to the robot, i think this might be done with tf but i dont really understand it any help would be appreciated

ctguell gravatar image ctguell  ( 2013-10-01 06:48:27 -0600 )edit

Each marker contains a tf `frame_id`. Make sure you set that appropriately. For markers that remain attached to the map regardless of robot motion, you would typically set frame_id to `/map`. For markers that move with the robot, use something like `base_footprint`. See REP-0105.

joq gravatar image joq  ( 2013-10-01 06:57:34 -0600 )edit

@joq thanks a lot your a life saver. The last question I need to create a marker but at a distance that i have to set at a given time and only then create the marker, do you have any idea how to do it?

ctguell gravatar image ctguell  ( 2013-10-01 07:15:11 -0600 )edit

@ctguell: your last question is unclear. You can create and destroy markers any time you like. Distances are determined by the coordinates and frame_id of the marker.

joq gravatar image joq  ( 2013-10-01 07:35:42 -0600 )edit

@joq sorry if I was unclear, what i want to accomplish is that once i detect a person ( with another program) i create a new marker to show that person in rviz. To do this i want to publish a topic ( my_marker_ct) which sends a number (int) reflecting the distance of the person to the laser, and then obtain that int and create a marker with that information. I wanted to now if this is possible and how to create a subscribes and publisher for a topic that only send a number

ctguell gravatar image ctguell  ( 2013-10-01 07:45:41 -0600 )edit

@joq@jorge thatnks a lot, ill look into it. One last thing do you know if its possible to create a subscribes in a publisher? and if so how to do it?

ctguell gravatar image ctguell  ( 2013-10-01 16:34:19 -0600 )edit
1

answered 2013-09-26 14:08:30 -0600

jorge gravatar image

updated 2013-09-30 21:08:11 -0600

gmapping maps can hardly store properly that kind of information. In our case we use a separated semantic map that contains different kinds of interesting elements and its coordinates relative the gmapping-generated map reference frame.

UPDATE In our case a semantic map is something terribly simple: typically a yaml file containing a global pose (/map frame referenced) and some extra data. Here for example we store tables with their radius for a waiter robot:

-  
  name: table1
  frame_id: map
  radius: 0.483
  pose:
      position:
          x: 3.067
          y: 3.107
          z: 0
      orientation:
          x: 0
          y: 0
          z: 0
          w: 1
-
  name: table2
  frame_id: map
  radius: 0.5
  ...

We also store the semantic data in a mongo database. In this repo we have scripts that maybe can give you some ideas. For example, scripts / table_publisher_from_file.py reads a yaml file like the above listed and publish table poses used by the robot and markers that RViz can visualize. If you also show a geometric map in RViz, both maps gently superimpose, as both share the same reference frame.

https://github.com/robotics-in-concert/rocon_database

edit flag offensive delete link more

Comments

@jorge how did you create that separate semantic map, can you visualize it in rviz? did you use the /map to create it? I think Im trying to do a similar thing you did and any help would be really useful thanks

ctguell gravatar image ctguell  ( 2013-09-26 16:52:38 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

5 followers

Stats

Asked: 2013-09-26 09:25:45 -0600

Seen: 4,206 times

Last updated: Oct 01 '13