Skip to content

NAOQI Installation and Usage

Maria T. Lazaro edited this page May 3, 2018 · 14 revisions

Installation

Prepare a specific OpenCV version

OpenCV library within NAOqi C++ SDK is not ready to use visualization functions such as cv::namedWindow or cv::imshow.
Hence, you have to replace the OpenCV libraries in NAOqi C++ SDK by another version of the libraries in which these functions are implemented.
The OpenCV version of NAOqi C++ SDK 2.5.5 is 2.4.9, so the first step after installing NAOqi SDK is to install OpenCV over the one that NAOqi comes with.

  1. Download OpenCV 2.4.9 and extract it.

  2. Compile OpenCV 2.4.9 from source. The flag D_GLIBCXX_USE_CXX11_ABI=0 must be used for compatibility with qibuild and NAOqi.

    cd <path-to-your-opencv-2.4.9>
    mkdir build && cd build
    CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" cmake -D CMAKE_INSTALL_PREFIX=<path-to-your-naoqi-c++-sdk> ..
    make install
    

    Note: If you have CUDA installed, you might encounter a problem when building OpenCV. Best to disable it using by adding -DWITH_CUDA=OFF to the cmake call above.

    Note: you may need to use sudo make install if you installed naoqi-c++-sdk in a root folder.

Compile the package

Set up a qibuild environment (refer to the qibuild docs for installation and follow the tutorials linked in this page for worktree configuration).

From the spqrel_navigation folder

qibuild configure -c <linux|pepper - toolchain name> --release
qibuild make -c <linux|pepper - toolchain name>

Note: if spqrel_navigaton package is outside the worktree, add the qibuild option -w <path_to_worktree>

Final step of the set-up is to set an environment variable PEPPER_IP both on your Pepper .profile if you are running the software in the robot or in your .bashrc to run the software remotely. E.g.

export PEPPER_IP=127.0.0.1

Brief usage tutorial

Note 1: maps in ROS format (yaml file + bitmap) are used by this navigation package. Please prepare a map of the environment before executing these tests (e.g., with standard ROS tools, such as gmapping).

Note 2: for more settings, please use --help option of the programs.

1. Usage on Linux machine connected to the robot

  1. Start the localizer:

    <path_to>/pepper_localizer --map <path-to-your-map.yaml> --use_gui 1 --pip <YOUR_ROBOT_IP>
    

    The visualizer shows: the map (grayscale including unknown areas), the laser points (green: points corresponding to elements in the map, blue: points not associated to the ones in the map), the particles (red). Robot is supposed to start in (0,0,0) and you'll see particles around this pose at the beginning.

    To set a different initial pose, press key 's' to enable this set-up, then left-click on a point in the map to set initial x,y position, then right-click on a second point to set orientation as the angle between second and first point clicked.

    When robot moves, you'll see particles following the estimation of the filter.

  2. Start the planner:

    <path_to>/pepper_planner --map <path-to-your-map.yaml> --use_gui 1 --pip <YOUR_ROBOT_IP>
    

    The visualizer shows: the map (grayscale including unknown areas), the current pose of the robot (small square). By pressing key 'd' you can see the distance map, by pressing 'c' you can see the cost map, by pressing 'm' you'll be back to the original map.

    WARNING: by default when setting a goal, the robot will move!!!

    To set-up a goal, CTRL+left-click on the target position. You will see the chosen goal (small circle), the planned path (if it exists) and the robot starts moving. Key 'p' enable/disable robot motion (by default it is enabled).

    WARNING: by default the ExternalCollisionProtectionEnabled is true, so the robot may not move because of this further basic collision avoidance module. To disable this low-level behaviour, you have to 1) allow this option explicitly by using the advanced configuration menu of your robot, 2) use the key 'o' AT YOUR OWN RISK!!!

2. Usage on the robot

  1. Upload files

    Cross-compile the code for Pepper and upload binaries (sdk/bin/pepper_localizer and sdk/bin/pepper_planner) and shared objects (sdk/lib/lib*.so) there. Note that shared objects should be placed in a directory included in LD_LIBRARY_PATH. For example, add LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<your_lib_folder> in .profile file on Pepper.

    Upload the map (<mapname>.yaml and <mapname>.png) you want to use.

  2. Prepare the robot

    1. Disable autonomous life behavior with ALAutonomousLife module
    2. Set a Stand posture with ALRobotPosture module
  3. Start the localizer on the robot

    <path_to>/pepper_localizer --map <path-to-your-map.yaml>  --initial_pose_x <X[m]> --initial_pose_y <Y[m]> --initial_pose_theta <Theta[rad]>
    

    Initial pose can be established also through the external GUI as explained in next Section 5.

  4. Start the planner on the robot

    <path_to>/pepper_planner --map <path-to-your-map.yaml> 
    
  5. External GUIs

    Two GUIs are provided to control NAOqi navigation system from a external Linux machine connected with the robot:

    • Planner GUI
    <path_to>/pepper_planner_gui --map <path-to-your-map.yaml> --pip <YOUR_ROBOT_IP>
    

    You can now set the goal with the planner GUI as described in section 1.2.

    • NEW Full navigation GUI:
    <path_to>/pepper_navigation_gui --map <path-to-your-map.yaml> --pip <YOUR_ROBOT_IP>
    

    This GUI integrates localizer and planner GUI to control the navigation system. Summary of keys:

    • s: Enable/Disable set pose. When enabled, set pose as in Section 1.1.
    • CTRL + left click: Set goal.
    • p: Enable/Disable robot movement (Pause).
    • o: Enable/Disable external collision avoidance protection.
    • r: Reset. Cancels goal.
  6. Set a navigation goal without GUI

    To set a goal without the planner GUI, you have to raise the event NAOqiPlanner/Goal with a vector of 2 float numbers representing X,Y,Theta of target position.

    Sample C++ code:

    FloatVector goal;
    goal.push_back(X);
    goal.push_back(Y);
    goal.push_back(Theta);
    qi::AnyValue value = qi::AnyValue::from(goal);
    memory_service.call<void>("raiseEvent", "NAOqiPlanner/Goal", value);
    

    Note: X,Y,Theta refer to global coordinates and orientation according to the .yaml file of the map.

    Alternatively, if your task does not require that the robot arrives with a specific orientation you can raise the event NAOqiPlanner/GoalXY with X,Y coordinates only