So you want to work with your NAO robot via ROS? There are three things you'll need:
- A computer with ROS installed
- ROS packages for NAOqi
- A NAO robot
I let you figure out how to have the hardwares (i.e. the computer and the robot), here I'll help you on the software side, which are the steps to (1) install ROS on your machine, (2) install NAO's ROS packages, and (3) use ROS service with your NAO. My computer is running under Ubuntu 13.10 64 bit and my robot is running under naoqi v2.0.2. Don't worry if your NAO does not have naoqi v2.0.2, it seems that NAO's ROS packages were tested successfully with naoqi v1.14.
Now that you're ready, let's do some copy-paste !
Below are the step I took to install ROS Indigo (the lastest distro of ROS) ans prepare development environment on my Ubuntu 13.10 64 bit. You can find detailed instructions at http://wiki.ros.org/ on how to install a ROS distribution on your machine.
In a terminal, execute the following commands to install ROS indigo:
- sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
- wget http://packages.ros.org/ros.key -O - | sudo apt-key add - sudo apt-get update sudo apt-get install ros-indigo-desktop sudo rosdep init
- rosdep update echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc sudo apt-get install python-rosinstall
In a terminal, execute the following commands to prepare your development environment:
- mkdir -p ~/catkin_ws/src cd ~/catkin_ws/src catkin_init_workspace cd ~/catkin_ws/ catkin_make source devel/setup.bash
2. Install NAO's ROS package
In a terminal, execute the following commands:
- Detailed explanation can be found here: http://wiki.ros.org/nao/Installation/remote
- Please note that in the first command, you have to enter the right path to the pynaoqi folder on your computer in the place of "path/to/naoqi/":
- echo "export PYTHONPATH=$PYTHONPATH:$HOME/path/to/pynaoqi/" >> ~/.bashrc sudo apt-get install ros-indigo-nao-*
3. Using ROS service with your NAO
Now that you have ROS distro and NAO packages installed, let's try to retrieve the image from the camera of NAO.
Following commands are to be executed in separate terminals, in presented order:
- echo "export NAO_IP=<your_NAO's_IP_here>" >> ~/.bashrc roslaunch nao_bringup nao.launch force_python:=true roslaunch nao_driver nao_camera.launch rosrun image_view image_view image:=/nao_camera/image_raw
Important note:
- The first line in the above box will write your NAO_IP variable to the file ~/.bashrc, which makes it available for all the terminals you open afterwards. It works well if you work with the one and only NAO. So, when you switch between NAOs, don't forget to edit ~/.bashrc file to update the IP address of the NAO you will work with.
- If you are new to ROS and considering going further with ROS, don't hesitate to take a look at ROS tutorials.
For now, enjoy the viewing! :-D