mapping pkgs publishes a string in the last bit in the /map topic (map.data[])

asked 2022-03-09 08:14:27 -0600

youssef desouky gravatar image

updated 2022-03-09 08:20:59 -0600

Hello All,

This is actually my first question. I am having a trouble with all the mapping pkgs in ROS2 when I echo the topic /map, I always get a string in the last bit of the map.data[], here is what I expect image description

` header: stamp: sec: 5158 nanosec: 179000000 frame_id: map info: map_load_time: sec: 0 nanosec: 0 resolution: 0.05000000074505806 width: 384 height: 384 origin: position: x: -10.0 y: -10.0 z: 0.0 orientation: x: 0.0 y: 0.0 z: 0.0 w: 1.0 data: - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1

- '...'

`

I want to subscribe on the /map topic from the the rosbridge_server pkg to build a map on a web page but I always encouter this error

[rosbridge_websocket-1] [ERROR] [1646827887.002034763] [rosbridge_websocket]: Exception calling subscribe callback: a bytes-like object is required, not 'str'**

Here is what I get: image description

I think it's because of the published string in the map.data[]. Have anybody encountered this error before?

Note: same setup works properly on ros1

edit retag flag offensive close merge delete

Comments

Can you add your callback code there too? Maybe there is some bug to fix, it will be easier to analyze

ljaniec gravatar image ljaniec  ( 2022-03-09 08:35:51 -0600 )edit

I run the rosbridge first, then I open the continuous.html which can be found at the following https://github.com/RobotWebTools/ros2djs/tree/develop/examples

youssef desouky gravatar image youssef desouky  ( 2022-03-09 08:40:39 -0600 )edit

This seems to be related to this kind of problems: https://stackoverflow.com/questions/3... (especially parts which mention differences between Python2 and Python3 - the latter is used in ROS2 now). Are you using correct version of each package (for ROS2)?

ljaniec gravatar image ljaniec  ( 2022-03-09 09:05:07 -0600 )edit

Yes, I'm using the latest version in each pkg.

youssef desouky gravatar image youssef desouky  ( 2022-03-09 10:18:06 -0600 )edit