Launch Wandering Application on AAEON* Robot Kit
This tutorial tells you how to:
Assemble and calibrate your robot.
Map an area using the wandering application and Aaeon’s UP Xtreme i11 Robotic Kit.
Test your AAEON* robot kit using ros2_amr_interface and teleop_twist_keyboard.
Hardware Prerequisite
You need one of the following AAEON* robot kits:
This tutorial uses the UP Xtreme i11 Robotic Kit.
Additional AAEON* resources:
Development Kit: https://github.com/up-board/up-community/wiki/UP-Robotic-Development-Kit-QSG
Hardware Assembly: https://github.com/up-board/up-community/wiki/UP-Robotic-Development-Kit-HW-Assembly-Guide
Power Management: https://github.com/up-board/up-community/wiki/UP-Robotic-Development-Kit-Power-Management-Guide
Calibrate your Robot’s Inertial Measurement Unit (IMU) Sensor
The IMU sensor is used to determine the robot’s orientation. Moving the robot interferes with calibration, so do not move the robot while performing these steps.
Prepare the environment:
mkdir ~/imu_cal sudo chmod 0777 ~/imu_cal cd <path to where the EI for AMR was installed>Edge_Insights_for_Autonomous_Mobile_Robots_*/AMR_containers/
Start the ros2_amr_interface:
./run_interactive_docker.sh amr-aaeon-amr-interface:2022.2 eiforamr -c imu_cal export ROS_DOMAIN_ID=27 ros2 run ros2_amr_interface amr_interface_node --ros-args -p try_reconnect:=true -p publishTF:=true --remap /amr/cmd_vel:=/cmd_vel -p port_name:=/dev/ttyUSB0
The output should be similar to:
[INFO] [1655311130.138413471] [IoContext::IoContext]: Thread(s) Created: 2 [INFO] [1655311130.139098979] [AMR_node]: Serial opened on /dev/ttyUSB0 at 115200 [INFO] [1655311131.144572706] [AMR_node]: Hardware is now online
If it is not, verify that the motor Controller is not on /dev/ttyUSB0. Adapt the command accordingly.
In another terminal, attach to the opened Docker* image, and get the data needed for calibration.
docker exec -it imu_cal bash source ros_entrypoint.sh export ROS_DOMAIN_ID=27 ros2 topic echo /amr/imu/raw | grep velocity: -A 3 | grep '[xyz]:' | grep -v velocity > velocity.txt # Wait for at least 5 seconds and then press ctrl-c cp velocity.txt /home/<user>/imu_cal # replace <user> with your host's user. exit
Open the first terminal, type Ctrl-c to stop amr_interface_node, and exit the Docker* image.
ctrl-c exit
Go to the imu_cal folder, and create the get_offset.sh script:
cd ~/imu_cal gedit get_offset.sh # you can use vim/nano or any text editor is preferred. # copy-paste the following snippet of code in this script: ########## !/bin/bash filename=$1 i=0 res=0 if [ "$2" != "x" ] && [ "$2" != "y" ] && [ "$2" != "z" ] || [ "$#" -ne 2 ] then echo "Usage: $0 imu_samples_file axis" echo "Example: $0 samples.txt z" exit 1 fi len=`cat $filename | wc -l` if [ $len -lt 450 ] then echo "Error: Previous command was interrupted too soon. Please let it run for at least five seconds." exit 2 fi while read line do isdata=`echo $line | grep "$2" | wc -l` if [ $isdata -gt 0 ] then i=$(($i+1)) if [ $i -gt 100 ] then i=100 break; else line=`echo $line | awk '{print $2}'` res=$( bc <<< "$res - $line") fi fi done < $filename res=$(echo "$res/$i"|bc -l) echo "Offset for $2 axis is $res" ##########
Get the calibration values for the X, Y and Z axes:
chmod a+x ./get_offset.sh ./get_offset.sh velocity.txt x ./get_offset.sh velocity.txt y ./get_offset.sh velocity.txt z
Example of output:
./get_offset.sh velocity.txt x Offset for x axis is -.00280559304170310501 ./get_offset.sh velocity.txt y Offset for y axis is -.00537949499936075887 ./get_offset.sh velocity.txt z Offset for z axis is .00155259681894676760
Put these values in aaeon_node_params.yaml:
cd <path to where the EI for AMR was installed>Edge_Insights_for_Autonomous_Mobile_Robots_*/AMR_containers/ gedit 01_docker_sdk_env/docker_compose/05_tutorials/param/aaeon_node_params.yaml # you can use vim/nano or any text editor is preferred. # Use the values you got for the x, y and z axes to offsets for gyro. Using the values from above our example would look like so: imu: frame_id: imu_link offsets: # accelerometer: # x: 0.0 # y: 0.0 # z: 0.0 gyro: x: -0.00280559304170310501 y: -0.00537949499936075887 z: 0.00155259681894676760
NOTE:Indentation is important in yaml files, so make sure to align offsets with frame_id. If the indentation is incorrect, the container reports an error when started.
Map an Area using the Wandering Application and the UP Xtreme i11 Robotic Kit
The goal of the wandering application is to map an area and avoid hitting objects.
Place the robot in an area with multiple objects in it.
Go to the installation folder of Edge_Insights_for_Autonomous_Mobile_Robots:
cd <path to where the EI for AMR was installed>Edge_Insights_for_Autonomous_Mobile_Robots_*/AMR_containers/ source 01_docker_sdk_env/docker_compose/05_tutorials/config/docker_compose.source export CONTAINER_BASE_PATH=`pwd` export ROS_DOMAIN_ID=27
Start mapping the area:
docker-compose -f 01_docker_sdk_env/docker_compose/05_tutorials/aaeon_wandering__aaeon_realsense_collab_slam_fm_nav2_ukf.tutorial.yml up
Expected result: The robot starts wandering around the room and mapping the entire area.
On a different terminal, prepare the environment to visualize the mapping and the robot using rviz2.
NOTE:If available, use a different development machine because rviz2 consumes a lot of resources that may interfere with the robot.cd <path to where the EI for AMR was installed>Edge_Insights_for_Autonomous_Mobile_Robots_*/AMR_containers/ source 01_docker_sdk_env/docker_compose/05_tutorials/config/docker_compose.source export CONTAINER_BASE_PATH=`pwd` export ROS_DOMAIN_ID=27 CHOOSE_USER=eiforamr docker-compose -f 01_docker_sdk_env/docker_compose/05_tutorials/rviz_robot_wandering.yml up
To see the map in 3D, can check the MarkerArray:
NOTE:Displaying in 3D consumes a lot of the system resources. Intel recommends opening rviz2 on a development system. The development system needs to be in the same network and have the same ROS_DOMAIN_ID set.To stop the robot from mapping the area, do one of the following:
Type Ctrl-c in the terminal where the aaeon_wandering__aaeon_realsense_collab_slam_fm_nav2_ukf.tutorial.yml was run.
(Preferred method because this option cleans the workspace) On the system you used docker-compose up on in step 2, use docker-compose down:
docker-compose -f 01_docker_sdk_env/docker_compose/05_tutorials/aaeon_wandering__aaeon_realsense_collab_slam_fm_nav2_ukf.tutorial.yml down --remove-orphans
If the robot moves in an unpredictable way and hits objects easily, there may be some hardware configuration issues. See the Troubleshooting section for suggestions.
Control the UP Xtreme i11 Robotic Kit Using a Gamepad
This example uses a Logitech* F710 wireless gamepad.
Insert the USB dongle in the robot.
Go to the installation folder of Edge_Insights_for_Autonomous_Mobile_Robots, and prepare the environment:
cd <path to where the EI for AMR was installed>Edge_Insights_for_Autonomous_Mobile_Robots_*/AMR_containers/ source 01_docker_sdk_env/docker_compose/05_tutorials/config/docker_compose.source export CONTAINER_BASE_PATH=`pwd` export ROS_DOMAIN_ID=27 sudo chmod a+rw /dev/input/js0 sudo chmod a+rw /dev/input/event*
Start mapping the area:
docker-compose -f 01_docker_sdk_env/docker_compose/05_tutorials/aaeon_wandering__aaeon_realsense_collab_slam_fm_nav2_ukf.tutorial.yml up
After the robot starts to move, you can control it with the gamepad:
To control the robot, keep the top right button labeled 1 in the picture below pressed at all times.
To move the robot on the X and Y axes, enable the mode button, and use the buttons labeled 2 in the picture below.
To rotate the robot in place, use the joystick labeled 3 in the picture below.
To move the robot on the X and Y axrs, disable the mode button, and use the joystick labeled 4 in the picture below.
Control the UP Xtreme i11 Robotic Kit Using teleop_twist_keyboard
Test the AAEON* robot development kit to validate that the hardware setup was done correctly.
Go to the installation folder of Edge_Insights_for_Autonomous_Mobile_Robots, and prepare the environment:
cd <path to where the EI for AMR was installed>Edge_Insights_for_Autonomous_Mobile_Robots_*/AMR_containers/ source 01_docker_sdk_env/docker_compose/05_tutorials/config/docker_compose.source export CONTAINER_BASE_PATH=`pwd`
Open the aaeon-amr-interface image:
CHOOSE_USER=eiforamr docker-compose -f 01_docker_sdk_env/docker_compose/01_amr/amr-sdk.all.yml run aaeon-amr-interface bash
Open ros2_amr_interface:
source /home/eiforamr/workspace/ros_entrypoint.sh export ROS_DOMAIN_ID=167 ros2 run ros2_amr_interface amr_interface_node --ros-args -p try_reconnect:=true -p timeout_connection:=1000.0 -p publishTF:=true --remap /amr/cmd_vel:=/cmd_vel -p port_name:=/dev/ttyUSB0
NOTE:The above command uses port_name:=/dev/ttyUSB0. You may have a different value in your setup. To check the value in your setup, enter the command:dmesg
In the output, search for text similar to this string: usb 3-3: ch341-uart converter now attached to ttyUSB0 and update the command to match your setup.
In another terminal, open full-sdk, and start teleop_twist_keyboard:
cd <path to where the EI for AMR was installed>Edge_Insights_for_Autonomous_Mobile_Robots_*/AMR_containers/ source 01_docker_sdk_env/docker_compose/05_tutorials/config/docker_compose.source export CONTAINER_BASE_PATH=`pwd` CHOOSE_USER=eiforamr docker-compose -f 01_docker_sdk_env/docker_compose/01_amr/amr-sdk.all.yml run full-sdk bash source /home/eiforamr/workspace/ros_entrypoint.sh export ROS_DOMAIN_ID=167 ros2 run teleop_twist_keyboard teleop_twist_keyboard
Expected result: You can now control your robot to see if the hardware configuration is correct.
The AAEON* robotic development kit instructions explain that the robot should respond to your commands in these ways:
Move forward when you press i
Stop when you press k
Move backward when you press ,
Stop when you press k
Turn right when you press j
Stop when you press k
Strafe (move sideways) when you press L or J
Test your robot to confirm that it responds to your commands. If not, see the Troubleshooting section.
Troubleshooting
If the robot does not start moving, the firmware might be stuck. To make it work again:
cd <path to where the EI for AMR was installed>Edge_Insights_for_Autonomous_Mobile_Robots_*/AMR_containers/ ./run_interactive_docker.sh amr-aaeon-amr-interface:2022.2 eiforamr -c aaeon_robot ros2 run ros2_amr_interface amr_interface_node --ros-args -p try_reconnect:=true -p publishTF:=true --remap /amr/cmd_vel:=/cmd_vel -p port_name:=/dev/ttyUSB0 ctrl-c ros2 run ros2_amr_interface amr_interface_node --ros-args -p try_reconnect:=true -p publishTF:=true --remap /amr/cmd_vel:=/cmd_vel -p port_name:=/dev/ttyUSB0 # Look for the text: [INFO] [1655311131.144572706] [AMR_node]: Hardware is now online # If you don't get this repeat the commands from the docker image and check if the motor controller is not attached to /dev/ttyUSB0. # If it is not attached to /dev/ttyUSB0, find out which one it is and adapt the commands accordingly. # When you get the [INFO] [1655311131.144572706] [AMR_node]: Hardware is now online, exit the docker image: exit
If the robot is not behaving as instructed when using the teleop_twist_keyboard, try the following steps.
Check the direction of the wheels. The way they are facing is very important, as shown in the picture below.
In our local setup we had to do the following Wheel setup, on each wheel you get a R (Right) or L (Left):
R(wheel) <<<>>> L(wheel)
L(wheel) <<<>>> R(wheel)
Check the connection between the wheels (left in the picture below) and the motor controller.
It is very important to have the hardware setup correctly configured. If it is not correct, it will be evident when testing with the teleop_twist_keyboard.
If the wheels do not turn at all, there may be something wrong with the wheel motor control. The board’s datasheet states that it takes a 12 V input. Intel found that a 12.5 V input did not work, but 5V, 8V, and 10V inputs do work.
For general robot issues, go to: Troubleshooting for Robot Tutorials.