ROS Tutorial

From Macro Wiki
Jump to: navigation, search

This tutorial has information about installation and setup of ROS, as well as the installation of useful packages required to control some robots. All the information here is from ROS wiki.

ROS Installation

First setup your computer to accept software from

   sudo sh -c 'echo "deb $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

Next set up your keys:

   sudo apt-key adv --keyserver hkp:// --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

Then, to install the ROS Indigo, do:

   sudo apt-get update
   sudo apt-get install ros-indigo-desktop-full

Initialize rosdep

Before you can use ROS, you will need to initialize rosdep:

   sudo rosdep init    
   rosdep update

Environment setup

It's convenient if the ROS environment variables are automatically added to your bash session every time a new shell is launched:

   echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc
   source ~/.bashrc

Getting rosinstall

Install 'rosinstall', to enable you to easily download many source trees for ROS packages with one command.

   sudo apt-get install python-rosinstall

Catkin Tutorial

First, you need to create and build a catkin workspace:

   mkdir -p ~/catkin_ws/src
   cd ~/catkin_ws/

The 'catkin_make' command is a convenience tool for working with catkin workspaces. The first time you run it, it will create a 'CMakeLists.txt' link in your 'src' folder, besides a 'build' and a 'devel' folder. Before to continue, you need to source your new setup.*sh file:

   source devel/setup.bash

You can also add this line to your .bashrc in order to avoid to source every time you want to use the catkin workspace.

Obs: Every time you change something in your catkin workspace, remember to run "catkin_make" again in order to apply those changes.

Install useful packages


A useful package necessary to perform most of the control actions already available in the macro@ufmg repositories' is the 'arbotix'. To install it, do:

   sudo apt-get install ros-indigo-arbotix


Another useful package is the 'dynamixel-motor'. To install it, do:

   sudo apt-get install ros-indigo-dynamixel-motor

Using macro@ufmg repositories' with ROS

Some repositories at macro@ufmg use ROS to perform some control action in a real robot or in a simulator. Here you will find some tips on how to do it.

Suppose you want to run some control of Little John , using the code available in the Little John repository. You first need to download the repository folder. If you prefer to use the SVN, you can take a look at this tutorial.

After downloading, copy the 'little_john_control' and 'little_john_description' folders to your catkin_ws/src folder, in case of Little John, or the equivalent for other repositories. A better way to do that is to create a link of those folders. You can create a link doing:

    ln -s <origin> <destiny>

You will also need the DQ Robotics library. You can download it from here. Create a link for this library as well:

   ln -s <origin> <your_path/catkin_ws/src/dq_robotics>

After this, you can follow the steps here in order to run some control in a real robot or in Rviz. In this case, this tutorial is specific for Little John robot.