ROSbot 2 PRO: Docker compose up microros not working

ROS DISTRO: foxy, DEVICE: Rosbot2.0 Pro, Ubuntu 20.2

docker compose up microros
[+] Running 1/0
 ⠿ Container microros  Created                                                                                 0.0s
Attaching to microros
microros  | [1738588008.312842] error    | TermiosAgentLinux.cpp | init                     | open device error      | device: /dev/ttyS4, errno: 13. Please re-run with superuser privileges.
microros  | Error while starting serial agent!
microros exited with code 0

Solutions Tried:

  1. sudo usermod -aG dialout $USER

Compose file

services:
  astra:
    image: husarion/astra:humble
    container_name: astra
    <<: *common-config
    devices:
      - /dev/bus/usb/
    command: ros2 launch astra_camera astra_mini.launch.py

  rplidar:
    image: husarion/rplidar:humble
    container_name: rplidar
    <<: *common-config
    devices:
            - /dev/ttyUSB0
    privileged: true
    command: >
        ros2 launch sllidar_ros2 view_sllidar_a3_launch.py

  microros:
    image: husarion/micro-xrce-agent:v2.4.1
    container_name: microros
    <<: *common-config
    devices:
      - ${SERIAL_PORT:?err}
    privileged: true
    environment: #only two envs are valid for micro-xrce-agent
      - FASTRTPS_DEFAULT_PROFILES_FILE            # ***
      - XRCE_DOMAIN_ID_OVERRIDE=${ROS_DOMAIN_ID:-}  # ***
    command: MicroXRCEAgent serial -D $SERIAL_PORT serial -b 576000 # -v6

  rosbot:
    image: husarion/rosbot:humble-0.6.1-20230712
    container_name: rosbot
    <<: *common-config
    command: ros2 launch rosbot_bringup bringup.launch.py

Hello @QuackerCoder,

I am sending you a few points that are worth considering.

  1. The privileged flag seems unnecessary because devices are forwarded.
  2. Check if the SERIAL_PORT alias exists ll $SERIAL_PORT .
  3. Check with the ros2 node list command whether the microrosa node (rosbot_ros2_firmware) no longer exists.
  4. Check if another process is occupying this port. (useful commands: docker compose ps, snap services).
  5. You can try to use a newer version of the image with integrated microros with rosbot service: ROSbot 2 PRO: Not able to access the topics from on the laptop - #6 by RafalGorecki

Let me know the results of the above actions. If it turns out that it still does not work, please tell me whether you are using the Husarion OS image and when the problem started to occur.
Regards

compose file:

x-common-config:
  &common-config
  restart: unless-stopped
  network_mode: host
  ipc: host
  user: ${DOCKER_UID:-1000}:${DOCKER_GID:-1000} # *
  volumes:
    - /etc/group:/etc/group:ro                  # *
    - /etc/passwd:/etc/passwd:ro                # *
    - /etc/shadow:/etc/shadow:ro                # *
    - /home/husarion/.ros:/home/husarion/.ros   # *
    - ${FASTRTPS_DEFAULT_PROFILES_FILE:-dummy_volume_fastdds}:${FASTRTPS_DEFAULT_PROFILES_FILE:-/dummy_volume_fastdds}:ro  # **
    - ${CYCLONEDDS_PATH:-dummy_volume_cyclonedds}:${CYCLONEDDS_PATH:-/dummy_volume_cyclonedds}:ro
       # **
  environment:
    - RMW_IMPLEMENTATION              # ***
    - FASTRTPS_DEFAULT_PROFILES_FILE  # ***
    - CYCLONEDDS_URI                  # ***
    - ROS_DOMAIN_ID                   # ***

services:
  astra:
    image: husarion/astra:foxy
    container_name: astra
    <<: *common-config
    devices:
      - /dev/bus/usb/
    command: ros2 launch astra_camera astra_mini.launch.py

  rplidar:
    image: husarion/rplidar:foxy
    container_name: rplidar
    <<: *common-config
    devices:
      - /dev/ttyUSB0
    command: >
        ros2 launch sllidar_ros2 sllidar_launch.py
        serial_baudrate:=${RPLIDAR_BAUDRATE:-256000}

  microros:
    image: husarion/micro-xrce-agent:v2.4.1
    container_name: microros
    <<: *common-config
    devices:
      - ${SERIAL_PORT:?err}
    environment: #only two envs are valid for micro-xrce-agent
      - FASTRTPS_DEFAULT_PROFILES_FILE            # ***
      - XRCE_DOMAIN_ID_OVERRIDE=${ROS_DOMAIN_ID:-}  # ***
    command: MicroXRCEAgent serial -D $SERIAL_PORT serial -b 576000 # -v6

  rosbot:
    image: husarion/rosbot:foxy
    container_name: rosbot
    <<: *common-config
    command: ros2 launch rosbot_bringup bringup.launch.py

volumes:
  dummy_volume_fastdds:
  dummy_volume_cyclonedds:

Can you tell me what could be the issue? I have tried the above solutions but none worked. Teleop not working with foxy, but with noetic it is working

As far as I remember, the Foxy version was never stable for the ROSbot 2 PRO. Even though the latest system image is Ubuntu 20.04 with ROS Foxy installed natively, we use the Humble series instead. Since Humble is compatible with Foxy, there shouldn’t be any issues. I recommend to use setup from this thread: ROSbot 2 PRO: Not able to access the topics from on the laptop - #6 by RafalGorecki