Troubleshooting for Robot Tutorials#

Error when build ROS based container#

ROS2 Foxy is going to be EOL by June 2023. If you encounter error as below,

Skip end-of-life distro "foxy"
..
ERROR : the following packages/stacks could not have their rosdep keys resolved

In such cases, the rosdep update command must be replaced as below.

rosdep update  --include-eol-distros

Unable to Play ROS 1 Bags#

To play a ROS 1 bag in our ROS 2 environment, do the following.

  1. Prepare the environment, and start full-sdk:

    cd <edge_insights_for_amr_path>Edge_Insights_for_Autonomous_Mobile_Robots_*/AMR_containers/
    source ./01_docker_sdk_env/docker_compose/common/docker_compose.source
    export CONTAINER_BASE_PATH=`pwd`
    export ROS_DOMAIN_ID=35
    docker compose -f 01_docker_sdk_env/docker_compose/01_amr/amr-sdk.all.yml run --name full-flavour-sdk full-sdk bash
    
  2. In a different terminal, attach to this Docker* image:

    docker exec -it full-flavour-sdk bash
    unset ROS_DISTRO
    source /opt/ros/noetic/setup.bash
    source /opt/ros/foxy/setup.bash
    
  3. Download and set the ROS_DOMAIN_ID to know where you want to publish the data:

    export ROS_DOMAIN_ID=35
    wget <ROS 1 BAG>
    ros2 bag play -s rosbag_v2 <ROS 1 BAG>
    

Permission Denied Error#

For a permission denied error when running a script:

$ ./run_interactive_docker.sh eiforamr-full-flavour-sdk:<TAG> eiforamr
bash: ./run_interactive_docker.sh Permission denied

Give executable permission to the script:

chmod 755 run_interactive_docker.sh

DISPLAY Environment Variable Error#

For errors related to the DISPLAY environment variable when trying to open the Docker* container or a GUI application, enter the command:

echo $DISPLAY

If this variable is empty, it causes issues when opening applications that need a GUI.

The most common solution is to give it the 0:0 value:

export DISPLAY= "0:0"

If the connection with the system is via VNC, DISPLAY should be already set.

If it is not, find out the value of DISPLAY set by vncserver and then set the correct value:

For example:

ps ax |grep vncserver
   /usr/bin/Xtigervnc :42 -desktop ....
   /usr/bin/perl /usr/bin/vncserver -localhost no -geometry 1920x1000 -depth 24 :42

export DISPLAY= ":42"

Use ROS_DOMAIN_ID to Avoid Interference in ROS Messages#

A typical method to demonstrate a use case requires you to start a container (or group of containers) and exchange ROS messages between various ROS nodes. However, interference from other ROS nodes can disrupt the whole process. For example, you might receive ROS messages from unknown nodes that are not intended for the demo use case. These other nodes could be on the same host machine or on other host machines within the local network. In this scenario, it can be difficult to debug and resolve the interference.

EI for AMR uses the ROS_DOMAIN_ID value set in the shell environment during the installation. This approach works fine for execution of one use case at a time.

For other use cases, declare ROS_DOMAIN_ID as a fixed numeric value per use case, under the following conditions:

  • The ROS_DOMAIN_ID should be same for all containers launched for a particular use case.

  • The ROS_DOMAIN_ID should be an integer between 0 and 101.

  • For containers launched with run_interactive_docker.sh, you declare it in the running container with:

    export ROS_DOMAIN_ID=<value>
    
  • For containers launched with docker compose, you declare it before executing docker compose:

    export ROS_DOMAIN_ID=<value>
    

For more information, go to: ROS_DOMAIN_ID

To add a fixed value for the ROS_DOMAIN_ID, you can choose any of the below options.

  1. Add it in the common.yml file for all containers:

    # In file 01_docker_sdk_env/docker_compose/common/common.yml
    # ROS_DOMAIN_ID can be added that applies to all use cases
    services:
    common:
       environment:
          ROS_DOMAIN_ID: <choose ID>
    

    EI for AMR uses this method to get the ROS_DOMAIN_ID value from the environment.

  2. Add it in the .env file for all containers:

    # In file 01_docker_sdk_env/docker_compose/01_amr/.env
    # add below line and provide ROS_DOMAIN_ID
    ROS_DOMAIN_ID=<choose ID>
    
  3. Add it in the specific yml file for a specific use case for specific targets:

    # In the below example, ROS_DOMAIN_ID is added in ros-base target
    # For any use case where this target is used, the ROS_DOMAIN_ID is set to the given value.
    
    services:
    
       ros-base:
          image: ${REPO_URL}amr-ubuntu2004-ros2-foxy-ros-base:${DOCKER_TAG:-latest}
          container_name: ${CONTAINER_NAME_PREFIX:-amr-sdk-}ros-base
          environment:
             ROS_DOMAIN_ID: <choose ID>
          env_file:
             - ./.env
          extends:
    
  4. Add it in the specific yml file in the command: section and apply only after launching the containers:

    # In file 01_docker_sdk_env/docker_compose/05_tutorials/fleet_mngmnt_with_low_battery.up.tutorial.yml
    # In the below example, ROS_DOMAIN_ID is set to 58
    # You may change it to any new value as per use case requirement.
    services:
    
    battery_bridge:
          image: ${REPO_URL}amr-ubuntu2004-ros2-foxy-battery_bridge:${DOCKER_TAG:-latest}
          container_name: ${CONTAINER_NAME_PREFIX:-amr-sdk-}battery_bridge
          extends:
          file: ../01_amr/amr-sdk.all.yml
          service: ros-base
          volumes:
          - /dev/battery_bridge:/dev/battery_bridge:rw
          build:
          target: battery_bridge
          network_mode: host
          restart: "no"
          command:
          - |
             source ros_entrypoint.sh
             source battery-bridge/src/prebuilt_battery_bridge/local_setup.bash
             export ROS_DOMAIN_ID=58
             sleep 5
             ros2 run battery_pkg battery_bridge
    
  5. Add it while running a container using the run_interactive_docker.sh script:

    # by adding env parameter, ROS_DOMAIN_ID can be exported inside container:
    ./run_interactive_docker.sh <image name> <user> --extra_params "-e ROS_DOMAIN_ID=<choose ID>"
    

    Note

    You can use any number between 0 and 101 (inclusive), to set ROS_DOMAIN_ID, as long as it is not used by a different ROS system.

Be aware that you can also use these options to modify other environment variables.

System HOME Directory Issues#

If your test system uses $HOME mounted in remote volumes, for example, in a network file system (NFS), you may encounter the error below when you try to run a Docker* image using the ./run_interactive_docker.sh script:

docker: Error response from daemon: error while creating mount source path '/nfs/site/home/<user>': mkdir /nfs/site/home/<user>: file exists.

To avoid this, before you run a Docker* image, create a new directory in /tmp (or any locally mounted volume), and set $HOME to the new path:

mkdir /tmp/tmp_home
export HOME=/tmp/tmp_home
./run_interactive_docker.sh eiforamr-full-flavour-sdk:<release_tag> eiforamr

aaeon_node_param.yml file is missing#

On the Aaeon robot, aaeon-amr-interface container fails to start with the following error when the robot IMU was not calibrated yet. Follow the calibration procedure from Wandering App Based on a Collab SLAM Using AAEON Robot Kits to fix this error.

[ERROR] [1687346238.741697402] [rcl]: Failed to parse global arguments
terminate called after throwing an instance of 'rclcpp::exceptions::RCLInvalidROSArgsError'
   what():  failed to initialize rcl: Couldn't parse params file: '--params-file /home/tester/eiforamr-2023.1_RC3/AMR_containers/01_docker_sdk_env/artifacts/01_amr/amr_generic/param/aaeon_node_params.yaml'. Error: Error opening YAML file, at /tmp/binarydeb/ros-foxy-rcl-yaml-param-parser-1.1.14/src/parser.c:198, at /tmp/binarydeb/ros-foxy-rcl-1.1.14/src/rcl/arguments.c:388