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

rosbridge_server and ros2djs on ros2 galactic not working? [rosbridge_websocket]: Exception calling subscribe callback: a bytes-like object is required, not 'str'

asked 2022-03-25 07:58:21 -0500

rjrs23 gravatar image


I am trying to run this ros2djs sample to display a map in on a html page. However when the open the html page rosbridge_server says

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

System Setup:

  • ros2-galactic built from source on ubuntu 20.04
  • rosbridge-server and rosbridge-suite installed from the ubuntu archive via apt

Expected Behaviour

Steps to reproduce

  1. Launch the turtlebot simulation via ros2 launch nav2_bringup
  2. Launch the rosbridge_server via ros2 run rosbridge_server rosbridge_websocket
  3. Open the map.html file (the tutorial link above has a html file source that i saved on my local PC)
  4. The minute I open the map.html file the error text above pops up in the terminal and i end up with a blank box on the map.html file

Can someone please point me in the right direction as to what is causing this?


edit retag flag offensive close merge delete


Please, any advance on this??

robpin gravatar image robpin  ( 2022-08-26 07:33:38 -0500 )edit

do you have any solution for this issue?

vela-io gravatar image vela-io  ( 2023-02-10 09:52:53 -0500 )edit

2 Answers

Sort by » oldest newest most voted

answered 2022-04-17 23:39:11 -0500

youssef desouky gravatar image

1- Install ros noetic along the ros galactic 2- install the rosbridge in your ros1 workspace 3- install and run the ros1_ros2_bridge

This is actually a quick fix till they update the ros2_rosbridge_server pkg

edit flag offensive delete link more

answered 2023-05-20 09:33:10 -0500

updated 2023-05-20 22:37:54 -0500

I face the same problem in ROS galactic but I can solve it by editing the ros2d.js in the part of OccupancyGridClient class and ImageMapClient. In the ImageMapClient, change the topic from /map_metadata to /map and change the messageType to nav_msgs/OccupancyGrid (in ROS2, I cannot find /map_metada topic like in ROS1). In the OccupancyGridClient, I only comment line of the parameter : compression:png. After finished these steps, it can work well with the rosbridge_server

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2022-03-25 07:58:21 -0500

Seen: 673 times

Last updated: May 20 '23