Ask Your Question
0

How should I know the real pose of the GridMap

asked 2021-06-10 04:34:47 -0500

joye gravatar image

updated 2021-06-10 07:40:42 -0500

I received the map data from the topic named map, and I used the data to draw an OccupyGrid, the topic usually return a square array data, the width * height looks like 192 * 192, 512 * 512.

But the topic return a non-square array data occasionally, like 5035, 10080. In this case, the data of the topic looks like:

root@user-laptop:/home/ros-test# rostopic echo map
header:
    seq: 7270
    frame_id: "map"
info:
    resolution: 0.0500000007451
    width: 100
    height: 80
    origin:
        position:
          x: -5.0
          y: -4.0
          z: 0.0
        orientation:
          x: 0.0
          y: 0.0
          z: 0.0
          w: 1.0
data: [....]

And I subscribed the robot_pose topic to render a pose shape on the OccupyGrid in my app that is incorrect. But the pose is correct in another app(deigo-app). Sorry I can't let the bug appear again, but it's real.

I found a project on github named RobotCA: https://github.com/ros-autom/RobotCA. I think the deigo-app is based on this project. However the RobotCA only rendered a LaserScan map without a OccupyGridMap. I read the source code of android-apps, It is render the pose by using the topic "initialpose", the link is behind:

https://github.com/rosjava/android_ap...

I can't find the "initialpose" topic on my machine.

root@user-laptop:/home/ros-test# rostopic list | grep pose
/amcl_pose
/robot_pose

But the deigo-app is still work. I don't know which topic is used. I don't have the source code.

The deigo-app apk file is here :https://ufile.io/m53g4ei6, no virus.

How can I render the pose correctly in GridMap?

edit retag flag offensive close merge delete

Comments

I drawed a map by using the topic map

Can you be more precise ? Do you manually publish to the topic map ?

Delb gravatar image Delb  ( 2021-06-10 05:03:18 -0500 )edit

I have updated the question. I just draw a GridMap, the gridmap data is subscribed from topic which named map

joye gravatar image joye  ( 2021-06-10 06:21:46 -0500 )edit

You have to be a lot more precise please. When talking about GridMap are you refering to an OccupancyGrid ? How did you draw it ? You don't "draw" a map using a topic.

the gridmap data is subscribed from topic which named map

If you have drawn the map why would you subscribe to the topic map instead of publishing your OccupancyGrid to the topic map ?

Delb gravatar image Delb  ( 2021-06-10 07:17:42 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-06-16 06:43:45 -0500

joye gravatar image

I found the reason, the reason is I ignored the resolution of the map data.

I thought the origin.position both represented the coordinates of the lower left and upper right corners. So If I get x:-5, y:-4 of the map origin's position data, I just thought the right and top coordinate is (5,4). This is wrong.

The position of the origin just represented the coordinates of the lower left. The real width of the map in ros is info.resolution * info.width . In the above question, it's 0.0500000007451 * 100. So the width of the map is about 5. It means the right coordinate is 0 instead of 5 ( width of the ros map + origin.position = right coordinate)

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-06-10 04:34:47 -0500

Seen: 29 times

Last updated: 2 days ago