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

Is there any way to get objects position (x, y) from a map?

asked 2020-06-21 12:27:25 -0500

ridwan gravatar image

I've a custom map, i want to get the object positions, like a rectangle i want to get the 4 points of the rectangle. is there a way? i'm using turtlebot3. my robot is in 0,0 position at the starting point.

edit retag flag offensive close merge delete

Comments

What do you mean? Using computational vision or PCL?

Teo Cardoso gravatar image Teo Cardoso  ( 2020-06-23 13:37:23 -0500 )edit

I meant from 3d or 2d map. from rviz or gazebo. I want to get all the objects and the space they are occupying(x,y) in the map. for example i might have a map of 10x10, and there is a square in the map positioning [(1,1),(1,3),(3,1),(3,3)] this square is a object.

ridwan gravatar image ridwan  ( 2020-06-24 01:26:14 -0500 )edit

Hi. If there are objects been showing in the RVIZ than those objects are been published from somewhere. I think you could verify the topic through the RVIZ, and after knowing which type they are, e.g, markers, you will be able to access their position in your code in the proper way.

mirella melo gravatar image mirella melo  ( 2020-09-24 21:29:28 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-09-24 08:35:42 -0500

JackB gravatar image

If I were you, instead of trying to do this directly in RVIZ of Gazebo I would look at how to process the costmap in a custom node, and from there extract the information you want.

Maps in ROS are represented as Occupancy Grids. This stores a discretized (i.e. cells) representation of the environment. From this representation, with the correct logic in a roscpp or rospy node, you can extract the information you want. Here is an example in the ROS nav stack Global Planner Costmap which manipulates this discretized representation in c++. Costmap2D is not exactly a occupancy grid but the concept/representation is similar.

Once you have the grid available to you in c++, I imagine you can produce the logic required to generate the result you want.

edit flag offensive delete link more

Comments

@ridwan can you share with us how you solved this problem?

JackB gravatar image JackB  ( 2020-10-01 08:12:50 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-06-21 12:27:25 -0500

Seen: 662 times

Last updated: Sep 24 '20