This project contains a set of patches and scripts to compile and run ROS 1 and ROS 2 onboard a Pepper robot, without the need of a tethered computer.
Download and extract the NaoQi C++ framework and Softbanks's crosstool chain and point the AL_DIR
and ALDE_CTC_CROSS
environment variables to their respective paths:
export AL_DIR=/home/NaoQi <-- Or wherever you installed NaoQi
export ALDE_CTC_CROSS=$AL_DIR/ctc-linux64-atom-2.5.2.74
We're going to use Docker to set up a container that will compile all the tools for cross-compiling ROS and all of its dependencies. Go to https://https://www.docker.com/community-edition to download it and install it for your Linux distribution.
- Clone the project's repository
$ git clone git clone https://github.com/esteve/ros2_pepper.git
$ cd ros2_pepper
The following script will create a Docker image and compile Python interpreters suitable for both the host and the robot.
./prepare_requirements_ros1.sh
Before we actually build ROS for Pepper, there's a bunch of dependencies we'll need to cross compile which are not available in Softbank's CTC:
- console_bridge
- poco
- tinyxml2
- urdfdom
- urdfdom_headers
./build_ros1_dependencies.sh
Finally! Type the following, go grab a coffee and after a while you'll have an entire base ROS distro built for Pepper.
./build_ros1.sh
By now you should have the following inside .ros-root in the current directory:
- Python 2.7 built for Pepper (.ros-root/Python-2.7.13)
- All the dependencies required by ROS (.ros-root/ros1_dependencies)
- A ROS workspace with ROS Kinetic built for Pepper (.ros-root/ros1_inst)
- A helper script that will set up the ROS workspace in the robot (.ros-root/setup_ros1_pepper.bash)
We're going to copy these to the robot, assuming that your robot is connected to your network, type the following:
$ scp -r .ros-root nao@IP_ADDRESS_OF_YOUR_ROBOT:.ros-root
Now that we have it all in the robot, let's give it a try:
SSH into the robot
$ ssh nao@IP_ADDRESS_OF_YOUR_ROBOT
Source (not run) the setup script
$ source .ros-root/setup_ros1_pepper.bash
Start naoqi_driver, note that NETWORK_INTERFACE may be either wlan0 or eth0, pick the appropriate interface if your robot is connected via wifi or ethernet
$ roslaunch naoqi_driver naoqi_driver.launch nao_ip:=IP_ADDRESS_OF_YOUR_ROBOT \
roscore_ip:=IP_ADDRESS_OF_YOUR_ROBOT network_interface:=NETWORK_INTERFACE
BEWARE: The ROS 2 port is still experimental and incomplete, simple sensors such as the bumpers work, but the camera driver has not been ported yet.
The following instructions require that you have ROS 1 built for Pepper.
The following script will create a Docker image and compile Python interpreters suitable for both the host and the robot.
./prepare_requirements_ros2.sh
Let's now build ROS 2 for Pepper:
./build_ros2.sh
Besides the ROS 1 binaries and its dependencies, we'll now a few more directories inside .ros-root in our current directory:
- Python 3.6 built for Pepper (.ros-root/Python-3.6.1)
- A ROS 2 workspace built for Pepper (.ros-root/ros2_inst)
We're going to copy these to the robot, assuming that your robot is connected to your network, type the following:
$ scp -r .ros-root nao@IP_ADDRESS_OF_YOUR_ROBOT:.ros-root
Now that we have it all in the robot, let's give it a try:
SSH into the robot
$ ssh nao@IP_ADDRESS_OF_YOUR_ROBOT
Source (not run) the setup script
$ source .ros-root/setup_ros2_pepper.bash
ROS 2 does not have a something like roslaunch yet, so you'll have to run naoqi_driver directly:
Start naoqi_driver, note that NETWORK_INTERFACE may be either wlan0 or eth0, pick the appropriate interface if your robot is connected via wifi or ethernet
$ naoqi_driver_node --qi-url=tcp://IP_ADDRESS_OF_YOUR_ROBOT:9559 \
--roscore_ip=IP_ADDRESS_OF_YOUR_ROBOT --network_interface=NETWORK_INTERFACE \
--namespace=naoqi_driver
The folks at the Universidad Rey Juan Carlos and Intelligent Robotics have produced the following video showing a Pepper robot runnning ROS onboard using the code from this repository:
Enjoy!