Setup ROS on VOXL
ModalAI Top Tip: ROS is not required to use or develop with VOXL! If you don’t like ROS or don’t want to use ROS, then you are done with the VOXL quickstarts! You can look through the more in-depth Developing with VOXL and Flying with VOXL guides.
If you like ROS, let’s proceed:
Set up Envrionment Variables
VOXL ships with ROS Indigo and the
voxl-utils package pre-installed.
voxl-utils installs the script
/home/root/ which sources the normal
/opt/ros/indigo/setup.bash script to configure the ROS environment variables. It also sets the IP address environment variables. Since everyone’s VOXL will be on a different IP address, you will need to edit this script to match the network configuration for your desired ROS master/slave configuration which will be different depending on your use case.
We recommend having the ROS Master be on VOXL. The Master IP is already set up to
192.168.8.1 to match the Soft Access Point use case. If you have your VOXL on a WiFi network you will need to change this address to match your configuration.
# On VOXL, begin by switching to the bash shell (by default, ADB puts you in the sh shell) /# bash yocto:/# vi ~/my_ros_env.sh ... # IP Environment variables must be set after setup scripts # Set ROS_IP & ROS_MASTER_URI appropriately for your configuration # 192.168.8.1 is default for the robot in soft access point mode export ROS_MASTER_URI=http://localhost:11311/ export ROS_IP=192.168.8.1 unset ROS_HOSTNAME
You can refresh your environment variables after updating this script by running:
yocto:/# exec bash
And then check that they have been updated by using the
voxl-env tool or just grep’ing the bash environment variables.
yocto:/# voxl-env show ROS_MASTER_URI=http://localhost:11311/ ROS_IP=192.168.1.150 CAM_CONFIG_ID=1 HIRES_CAM_ID=-1 TRACKING_CAM_ID=0 STEREO_CAM_ID=1 TOF_CAM_ID=-1 yocto:/# env | grep "ROS" ROS_ROOT=/opt/ros/indigo/share/ros ROS_PACKAGE_PATH=/home/root/catkin_ws/install/share:/home/root/catkin_ws/install/stacks:/opt/ros/indigo/share:/opt/ros/indigo/stacks ROS_MASTER_URI=http://localhost:11311/ ROSLISP_PACKAGE_DIRECTORIES= ROS_DISTRO=indigo ROS_IP=192.168.8.1 ROS_ETC_DIR=/opt/ros/indigo/etc/ros
Both of these methods require you to run inside a bash shell, NOT sh. If you logged in over ADB you are put in an sh shell by default and need to start bash manually.
Testing ROS Configuration
To test that your ROS configuration is working, start roscore on VOXL. Double check you are in a bash prompt and not sh before doing so.
ModalAI Top Tip: Currently an issue can be seen when attempting to use ROS using the native Ubuntu terminal. As a work around XTerm can be used.
# ON VOXL yocto:/# echo $SHELL /bin/bash yocto:/# roscore process[rosout-1]: started with pid  started core service [/rosout]
Now on your host PC use rostopic to see if it can communicate with VOXL.
# ON HOST PC me@mylaptop:~$ rostopic list /rosout /rosout_agg
Now explore the ROS Nodes provided in the VOXL Nodes package.
See the building ROS nodes for VOXL for information on making your own ROS nodes.