ROSbot 2 PRO: Issue with rosbot docker container namespaces

Hello,

I have 2 ROSbot 2 PROs that are on the newest version of the humble rosbot docker container (humble-0.14.0-20250319 as of writing this) which must be on the same network but work independently. I have set it up so that each ROSbot has its own distinct namespace in the rosbot and rplidar containers as follows:

x-common-config:
  &common-config
  network_mode: host
  ipc: host
  restart: unless-stopped
  environment:
    - USER
    - ROBOT_NAMESPACE

services:
  rosbot:
    image: husarion/rosbot:humble-0.14.0-20250319
    container_name: rosbot
    <<: *common-config
    devices:
      - ${SERIAL_PORT:-/dev/ttyUSB0}
      - /dev/bus/usb/ # FTDI
    command: >
      ros2 launch rosbot_bringup bringup.launch.py
        mecanum:=${MECANUM:-False}
        serial_port:=${SERIAL_PORT:-/dev/ttyUSB0}
        namespace:=robot1

 astra:
    image: husarion/astra:humble
    container_name: astra
    <<: *common-config
    devices:
      - /dev/bus/usb/
    command: >
      ros2 launch /husarion_utils/astra.launch.py
        device_namespace:=camera

rplidar:
    image: husarion/rplidar:humble
    container_name: rplidar
    <<: *common-config
    devices:
      - /dev/ttyRPLIDAR:/dev/ttyUSB0
    command: >
      ros2 launch /husarion_utils/rplidar.launch.py
        serial_baudrate:=${RPLIDAR_BAUDRATE:-256000}
        robot_namespace:=robot1

Thus, I get the following topic list (The other robot has a namespace of robot2):

The main issue lies with the rosbot container. When sending a movement command to a specific robot (For example, through using “ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r __ns:=/robot1”), both robots will respond to the same command despite using different namespaces (Unintended behavior). However, when broadcasting to a namespace that does not exist, neither robot will respond (Intended behavior).

Is there a fix for this? I want both rosbots to be using the same domain ID but respond by using different namespaces. I additionally want to use the docker containers instead of the new snaps.

EDIT: I have also tried using the environment variable “ROBOT_NAMESPACE = robot1” and removing the namespace argument from the rosbot launch command. Same issue persists.

Hello @das.lab,
Thank you for reporting. We were not aware of such behavior. When I checked the information propagation path, the main problem is the external microros package. Unfortunately, it does not support namespacs and we do not really know what to do about it.

The only thing I can suggest is to use master and filter only the necessary topics so that private topics (in this case /_motors_cmd are not transferred),

Useful links:
https://docs.ros.org/en/rolling/Tutorials/Advanced/Discovery-Server/Discovery-Server.html

Regards

Hello @das.lab,
I just would like to mention you about this repo. Here we have nav2 demo which also use ros2router and is able to steering multiple robots. GitHub - husarion/rosbot-autonomy: Autonomous navigation & mapping for ROSbot 2R / 2 PRO. You can get inspired to create your custom solution based on this aproach.