Robotics StackExchange | Archived questions

Move map in nav2djs

Hey,

I am showing the current map in a nav2djs widget, however it is translated off canvas. How can I center it in the canvas, or preferably, how can I move the map in the canvas with the mouse? This pull request suggests it is fixed, but I am not seeing the correct map.

image description

Best regards, Hans

Asked by Hansg91 on 2014-05-02 09:42:05 UTC

Comments

Answers

The referenced pull request actually results in the map the way you are looking at it. The way it works is the map gets centered at the 0,0 location. Since your map 0,0 is the corner, that is what the center is. Currently there is no pan (although it could be added), but you can manually offset the map position upon creation:

https://github.com/RobotWebTools/ros2djs/blob/devel/examples/map.html#L33-L36

Asked by rtoris288 on 2014-05-02 10:17:13 UTC

Comments

Ah thank you, that clears some stuff up. I tried that and it indeed worked, but why does that even not exist for a NAV2D.OccupancyGridClientNav object? Seems logical for it to exist there too. Thank you for the quick response by the way.

Asked by Hansg91 on 2014-05-02 10:43:43 UTC