[Solved] Rosbot 2R mapping tutorial

I am attempting to run the rosbot-mapping tutorial on my ROSbot2R with galactic image.

Step 1.
Checked and confirmed .env on PC.

Step 2.
“./sync_with_rosbot.sh” in the rosbot-mapping directory on PC displayed a list of files synced

Step 3.
“docker compose -f compose.rosbot.yaml up” in the rosbot-mapping directory on my ROSbot2R.
It appeared that all nodes were created and topics published about the robot but I believe the sllidar node timed out.

Step 4.
“xhost +local:docker && docker compose -f compose.pc.yaml up”
A lot of messages scrolled by about maps and finally an rviz window popped up.

Step 5.
A beautiful replica of my ROSbot showed up in a window…alone.
The information panel told me that “no map received”. The lidar on my ROSbot was not spinning around and that looked different than my ROS1 tutorials. (They seemed to have all been deleted here)

Step 6.
Went back to ROS1 firmware and tutorials to confirm map being received and sllidar spinning around.

I hesitate to go back to ROS1 but all the remaining ROS tutorials here are ROS1.

If memory serves, the husarion mapping docker has an error in the specification of the node transitions used by the nav2 stack’s node manager. It means the nav2 stack will not come up correctly, resulting in your “no map received” error. I switched to using the nav2 stack on my host and sensors only on the rosbot, and have not debugged the issue with the husarion docker.

Uhhhh, thanks? Is there a way, that I can understand, to fix my environment? Wait for a fix? Does that affect the Robot Model not showing up any longer? Maybe it was an accident that I saw it before. The ROS INFO output looks clean on the ROSbot (all data received from hardware and publishing except as noted in my Step 3) but rviz complains about no frame exists in it’s ROS INFO output. Perhaps it could be related to my WiFi problems? No map data is explained by the sllidar tmeout error. Perhaps I should show you what I’m running.

On my ROSBOT
services:

rosbot:
image: husarion/rosbot:humble-22-11-25
network_mode: host
ipc: host
environment:
- DDS_CONFIG
- RMW_IMPLEMENTATION
command: ros2 launch rosbot_bringup rosbot_bringup.launch.py

microros:
image: husarion/micro-ros-agent:humble-22-11-25
network_mode: host
ipc: host
devices:
- ${SERIAL_PORT:?err}
environment:
- DDS_CONFIG
- RMW_IMPLEMENTATION
command: ros2 run micro_ros_agent micro_ros_agent serial -D $SERIAL_PORT serial -b 576000 # -v6

rplidar:
image: husarion/rplidar:humble-22-11-25
network_mode: host
ipc: host
devices:
- ${LIDAR_SERIAL:?err}:/dev/ttyUSB0
environment:
- DDS_CONFIG
- RMW_IMPLEMENTATION
command: ros2 launch sllidar_ros2 sllidar_launch.py serial_baudrate:=${LIDAR_BAUDRATE:-115200}

mapping:
image: husarion/slam-toolbox:humble-22-11-25
network_mode: host
ipc: host
volumes:
- ./config/slam_toolbox_params.yaml:/slam_params.yaml
environment:
- DDS_CONFIG
- RMW_IMPLEMENTATION
command: >
ros2 launch slam_toolbox online_sync_launch.py
slam_params_file:=/slam_params.yaml
use_sim_time:=${USE_SIM_TIME:-False}

AND ON MY PC
services:

map-saver:
image: husarion/nav2-map-server:humble-22-11-25
network_mode: host
ipc: host
volumes:
- ./maps:/maps
environment:
- DDS_CONFIG
- RMW_IMPLEMENTATION
command: bash -c “while true; do ros2 run nav2_map_server map_saver_cli --free 0.15 --fmt png -f /maps/map; sleep 5; done”

rviz:
image: husarion/rviz2:humble-22-11-25
network_mode: host
ipc: host
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ./config/rosbot.rviz:/root/.rviz2/default.rviz
environment:
- DDS_CONFIG
- RMW_IMPLEMENTATION
- DISPLAY=${DISPLAY:?err}
- LIBGL_ALWAYS_SOFTWARE=1

joy2twist:
image: husarion/joy2twist:humble-22-11-30
network_mode: host
ipc: host
devices:
- /dev/input
volumes:
- ./config/joy2twist.yaml:/joy2twist.yaml
environment:
- DDS_CONFIG
- RMW_IMPLEMENTATION
command: >
ros2 launch joy2twist gamepad_controller.launch.py
joy2twist_params_file:=/joy2twist.yaml

Excerpts from the log display:




rosbot-mapping-mapping-1 | [INFO] [sync_slam_toolbox_node-1]: process started with pid [44]
rosbot-mapping-rplidar-1 | [INFO] [sllidar_node-1]: process started with pid [58]
rosbot-mapping-rplidar-1 | [sllidar_node-1] [INFO] [1670186164.097038928] [sllidar_node]: SLLidar running on ROS2 package SLLidar.ROS2 SDK Version:1.0.1, SLLIDAR SDK Version:2.0.0
rosbot-mapping-mapping-1 | [sync_slam_toolbox_node-1] [INFO] [1670186164.192604454] [slam_toolbox]: Node using stack size 40000000
rosbot-mapping-mapping-1 | [sync_slam_toolbox_node-1] [INFO] [1670186164.818008380] [slam_toolbox]: Using solver plugin solver_plugins::CeresSolver



1670186167.571281293] [spawner_joint_state_broadcaster]: Configured and activated joint_state_broadcaster
rosbot-mapping-rosbot-1 | [INFO] [spawner-4]: process has finished cleanly [pid 66]
rosbot-mapping-rosbot-1 | [INFO] [spawner-5]: process started with pid [116]
rosbot-mapping-rplidar-1 | [sllidar_node-1] [ERROR] [1670186168.148653890] [sllidar_node]: Error, operation time out. SL_RESULT_OPERATION_TIMEOUT!
rosbot-mapping-rplidar-1 | [ERROR] [sllidar_node-1]: process has died [pid 58, exit code 255, cmd ‘/ros2_ws/install/sllidar_ros2/lib/sllidar_ros2/sllidar_node --ros-args -r __node:=sllidar_node --params-file /tmp/launch_params_b4zhn6qe’].
rosbot-mapping-rosbot-1 | [ros2_control_node-2] [INFO] [1670186168.584860611] [controller_manager]: Loading controller ‘rosbot_base_controller’
rosbot-mapping-rosbot-1 | [spawner-5] [INFO]

No map received inside rviz on PC but RobotModel is visible.

The reason my sllidar did not start was fixed by removing the option setting in the command line for the rplidar service. This is in compose.rosbot.yaml on my ROSbot2R in the rosbot-mapping directory. Full map and robot transform are now displayed in rviz. This is solved.