## For instruction on writing tutorials ## http://www.ros.org/wiki/WritingTutorials #################################### ##FILL ME IN #################################### ## for a custom note with links: ## note = '''WARNING:''' This tutorial may be outdated and specific to the Nao ROS packages v0.1. Follow the [[http://wiki.ros.org/nao/Installation|installation instructions]] instead for the latest version. ## for the canned note of "This tutorial assumes that you have completed the previous tutorials:" just add the links ## note.0= ## descriptive title for the tutorial ## title = Getting started with ROS for Nao, including NAOqi and rviz ## multi-line description to be displayed in search ## description = This tutorial will guide the beginner through installing ROS and NAOqi, and issuing basic commands to a simulated model in rviz. ## the next tutorial description (optional) ## !next = ## links to next tutorial (optional) ## next.0.link=[[nao/Tutorials/Basic Tooling|Basic Tooling]] ## !next.1.link= ## what level user is this tutorial for ## level= BeginnerCategory ## !keywords = #################################### <> This guide is aimed at researchers or students who have a Nao robot but are unfamiliar with Linux or ROS. <> ## AUTOGENERATED DO NOT DELETE ## TutorialCategory ## FILL IN THE STACK TUTORIAL CATEGORY HERE == Starting the bridge on a real NAO == For starting the NAO bridge, have a look at [[nao_bringup]], which explains all details of launching your NAO and connect it to ROS. === Displaying NAO in RVIZ === In order to visualize NAO in RVIZ, simply open up a new RVIZ. Please take care to source your ''setup.bash'' as before. {{{ $ rosrun rviz rviz }}} We provide a pre-configured RVIZ configuration which has all basic displays such as TF, RobotModel, Camera and Sonars. This configuration can be found inside your catkin workspace under {{{ src/nao_robot/nao_description/config/nao.rviz }}} Based on Aldebaran's policy, we cannot visualize the robot 3D meshes. If we wish to visualize the complete 3D model, you have to install them which includes a licence agreement term to accept. Simply trigger: {{{ $ sudo apt-get install ros-indigo-nao-meshes }}} During that installation, you have to accept the licence and you are good to go! Simply re-start your RVIZ and load the configuration file again. You will see a similar picture to the given screenshot down there. {{attachment:NaoRviz.png}} == Controlling NAO == When you followed the steps above, you should see your robot in RVIZ. This means that all components are successfully loaded, up and running. At next, we are going to use ROS commands to let NAO walk. Inside your nao_full.launch we also launch the nao_walker, which listens to ROS [[http://docs.ros.org/api/geometry_msgs/html/msg/Twist.html|twist]] messages. To verify that your walker node is running, simply list your rosnodes {{{ $ rosnode list }}} This should return a list of running nodes and you should find /nao_walker {{{ $ rosnode list ... /nao_walker ... }}} It is important to note, that (on a real NAO), we have to set the joint stiffness before actuating the robot. This will make all the joints stiff, i.e. you won't be able to move the robot joints by force of your hands. {{{ $ rosservice call /body_stiffness/enable "{}" }}} Contrary, you can disable the stiffness in similar fashion: {{{ $ rosservice call /body_stiffness/disable "{}" }}} Once we enabled the stiffness, we can send the walk command. {{{ $ rostopic pub -1 /cmd_vel geometry_msgs/Twist '{linear: {x: 1.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.0}}' }}} This will start the robot walking in the x-direction. This enables you also to use existing remote controller components such as [[teleop_twist_keyboard| ROS teleop]] to steer your robot via the keyboard. == Launching ROS on a virtual NAOqi == ''' OUTDATED ''' To start ROS, run in a new terminal: {{{ $ roscore }}} To launch NAOqi on your local PC, to simulate the robot, run in a new terminal: {{{ $ ~/naoqi/naoqi-sdk-1.12.3-linux32/naoqi --verbose --broker-ip 127.0.0.1 }}} broker-ip address `127.0.0.1` is loopback address to connect to your own PC. So, only a local ROS install can connect to NAOqi. The NAOqi API would be accessible via broker-ip address and nao_driver acts as wrapper for NAOqi API. Then start the `ros_driver` package, connecting to the simulated Nao on the local PC. Run in a new terminal: {{{ $ LD_LIBRARY_PATH=~/naoqi/naoqi-sdk-1.12.3-linux32/lib:$LD_LIBRARY_PATH NAO_IP=127.0.0.1 roslaunch nao_driver nao_driver_sim.launch }}} Do not add this path to your global `LD_LIBRARY_PATH` in `~/.bashrc` because other things will break. eg. rviz will fail to run with the error: {{{ Config file '/home/USERNAME/.rviz/config' could not be opened for reading. /opt/ros/fuerte/stacks/visualization/rviz/bin/rviz: symbol lookup error: /opt/ros/fuerte/stacks/visualization/rviz/lib/librviz.so: undefined symbol: _ZN9QListData11detach_growEPii }}} The `nao_driver_sim.launch` file sets `use_joint_sensors=false` and then calls `nao_driver.launch`<
> If this is set to true during a simulation, the ROS topic `/joint_states` will not be updated and things will not work. If you want to connect ROS to the real robot, you would use the `nao_driver.launch` launch file instead.<
> There is also `nao_driver_2.launch` which also sets `use_joint_sensors=false` and tries to load the `nao_footsteps` package. If connecting to real robot, ensure that version of NaoQi installed on robot is compatible with nao_driver. {{{ If successful, you should see an output similar to: Walker online... . nao_controller running... }}} <
> === Viewing the simulated Nao robot in rviz === Exit all the previously running terminal applications. Firstly, install `rospack`: {{{ $ sudo apt-get install ros-fuerte-rospack }}} Then install the visualization tools for ROS, including `rviz`: {{{ $ sudo apt-get install ros-fuerte-visualization }}} Re-start `roscore`, `naoqi` and `nao_driver` as in the previous section. To test the installation of `rviz`, run: {{{ $ rosrun rviz rviz }}} If all is well, the GUI should load. You can close `rviz`. Note the first time running rviz you might get an error: {{{ Config file '/home/USERNAME/.rviz/config' could not be opened for reading. }}} Once you have saved the configuration file while exiting `rviz`, it won't complain about that again. Now we need to start `robot_state_publisher` and tell it load the URDF model of the Nao robot: {{{ $ roslaunch nao_description nao_state_publisher.launch }}} Then run `viz` again: {{{ $ rosrun rviz rviz }}} In the top-left "''Displays''" window, change "''Fixed Frame''" to "'''/base_link'''" <
> If only the "'''/map'''" option is available, then the URDF model wasn't loaded from the previous step. <
> The "''Target Frame''" should be "''''''" Global Status should change to "''OK''". <
> If it's red and "''error''" then that probably means that the topic `/joint_states` is not being updated. Click on the "''Add''" button and add a grid. <
> Click on the "''Add''" button and add '''RobotModel''' <
> If everything is okay, you will see a robot model made of cylinders and the legs will be bent, with one foot in front of the other. <
> You will need to zoom-in to see it properly. <
> If there's a problem, the arms/legs will be hanging straight. This time when you publish a control command, you should see the robot start walking in `rviz`: {{{ $ rostopic pub -1 /cmd_vel geometry_msgs/Twist '{linear: {x: 1.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.0}}' }}} And to stop the robot, run: {{{ $ rostopic pub -1 /cmd_vel geometry_msgs/Twist '{linear: {x: 0.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.0}}' }}} The robot model in `rviz` is described using a .xacro file for the structure, and another for the visual appearance. <
> To create a more visually appealing model, you will need to edit `visuals.xacro` located in the directory: {{{ ~/ros_workspace/nao/stacks/nao_common/nao_description/urdf/ }}} {{http://img.acianetmedia.com/i/6rUJi.jpg}} If you have any corrections or comments about this tutorial, please contact the author listed below. <
>