Tutorial for working with Nao in gazebo 9 and ROS melodic for self-recognision in mirror. For additional info you can emai me to [email protected]
After installing required software (Gazebo9 ROS melodic, SDK simulator and Naoqi python SDK (softbankrobotics - Matej can give you username and password) along with Boost1.55.0, clone this repository to your computer.
- Install catkin tools - this site
- Install explauto library - library for controlling nao with learned inverse models (will not build without it due to dependencies) - this site
- go to catkin_ws
- Build workspace - catkin build
- Source - needs to be done whenever you open new terminal for launching gazebo and ROS or you can add it to ~/.bashrc once: source /opt/ros/melodic/setup.sh source ~/code-nao-simulation/gazebo9/catkin_ws/devel/setup.bash
- Go to misc/
- Launch gazebo world with Nao in it: bash launch-naoqi-highres.sh
changes to nao_skin.xacro - For both versions of nao (highres and lowres) go to nao_skin.xacro and all the way down to specification of controllers and plugins and in change filename to path to library libcontact.so in your computer. Without this change the artificial skin will not work.
After these steps Gazebo Gui with spawned Nao should pop up, simulation should be paused and Nao will have only Torso, arms and head with camera for mirroring right infront of him (white box).
- Removed fingers due to simulation issues with them, fingers are replaced with one huge finger with no joints.
- Legs removed - they were redundant for our purposes
- Added camera for creating a 'mirror'.
- Changed color of casing
- Fixed torso in space so Nao doesn't fall to the ground and remains stable
-
High resulotin - launching through aforementioned command "bash launch-naoqi-highres.sh" Description in .xacro files in catkin_ws/src/nao_robot/nao_description/urdf/naoSkin2_generated_urdf/
-
Low resolution -launching through command "bash launch-naoqi-lowres.sh" Description in .xacro files in catkin_ws/src/nao_robot/nao_description/urdf/naoSkin_generated_urdf/
Changes to Nao can be done throughout these files, mainly in nao_robot.xacro, for example legs can be added by uncommenting include for nao_legs.xacro along with uncommenting legs transmission in naoTransmission.xacro, also look into launch files if controllers for legs are included.
Controllers for legs are included in nao_control_position.launch and are not included in nao_control_position_skin.launch.
This is done through python scripts, one of the simplest example is catkin_ws/src/my_executables/scripts/camera_listener.py which subscribes to camera topic and flips its image along the y axis so it seems like a mirror image. Once the simulation is runnning, unpause the simulation, open new terminal and run command: "rosrun my_executables camera_listener.py" . It should capture images and save them.
Sensor data and joints commands are communicated through ROS topics that a node can subscribe to (for data) or publish to (for controlling the robot). List of ros topics can be displayed by using command in terminal "rostopic list". Any Topic that is listed can be published and subscribed to.
More complex example of manipulation of robot is head_babbling.py in the same folder - this example includes loading trained explauto inverse models and works with Naoenvironment.