-
Notifications
You must be signed in to change notification settings - Fork 1
Installing and Configuring Your ROS Environment
In this part of the tutorial, you will learn how to install ROS and configure the ROS environment for development.
Note: Make sure you have set up your operating system, or are currently using running Ubuntu.
There are typically multiple distributions of ROS supported at any one time. You can check out the currently supported distributions on the ROS Distributions page.
Once you have selected your distribution, you will need to install it.
First, make sure that your Ubuntu configuration is set to allow access to the "restricted", "universe", and "multiverse" repositories. This should be the case by default, but if not, you can follow the Ubuntu Repositories Guide for instructions on how to do so.
Next, configure your sources.list file to accept software from packages.ros.org. You can do this manually, or by running
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
Now, setup your keys using
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
Finally, update your apt package index by running
sudo apt-get update
Code in ROS is organized into so-called packages. Packages can contain libraries, executables, scripts, or other artifacts.
The ROS community has developed many useful packages already. You can find available packages using
apt-cache search ros-<distribution>
You can then install a package using
sudo apt-get install ros-<distribution>-<package>
Note: To start, we recommend you install the default set of packages for your distribution using
sudo apt-get install ros-<distribution>-desktop-fullThis may take significant time to install.
For the remainder of these tutorials, we will assume you have all the packages from this set. If you do not do this, you may have to manually install some packages later.
Next, you will need to set up the shell to access these ROS packages. To do this, run
source /opt/ros/<distribution>/setup.bash
Note: This is referred to as "sourcing the environment".
Each time you open a shell, you will have to source the environment within that shell to use ROS.
To avoid this, you can add the command to your
.bashrcfile, so that it is automatically run whenever you open a new shell. You can add it manually, or by runningecho "source /opt/ros/<distribution>/setup.bash" >> ~/.bashrc source ~/.bashrc
Note: You can verify that the environment variables have been set up correctly by running
printenv | grep ROSYou should see something like
ROS_ROOT=/opt/ros/kinetic/share/ros ROS_PACKAGE_PATH=/opt/ros/kinetic/share ROS_MASTER_URI=http://localhost:11311 ROS_PYTHON_VERSION=2 ROS_VERSION=1 ROSLISP_PACKAGE_DIRECTORIES= ROS_DISTRO=kinetic ROS_ETC_DIR=/opt/ros/kinetic/etc/rosIf not, you should verify that you have sourced the environment.
ROS uses the catkin build system. This means that a ROS workspace is (under the hood) a catkin workspace.
A catkin workspace is a folder where you install, modify, and build catkin packages.
To create a caktin workspace run
mkdir -p ~/<workspace_name>/src
cd ~/<workspace_name>/
catkin_make
You should notice 3 directories within your workspace: src, devel, and build.
Just like how you sourced the environment for ROS, you will also need to source the environment for your workspace. You can do this using
source ~/<workspace_name>/devel/setup.bash
Note: You can add the command to your
.bashrcfile, so that it is automatically run whenever you open a new shell, however, you might need to modify it each time you change workspaces.
Each time you make changes to your workspace, such as when you add new packages, or make changes to existing packages, you should re-build your workspace, and re-source its environment using
catkin_make
source ~/<workspace_name>/devel/setup.bash
Using rosbash
Typically, your ROS code will be spread across multiple packages.
Navigating with command-line tools such as ls and cd can be very tedious which is why ROS provides tools to help you.
Most of these tools are contained within the rosbash package suite, which comes pre-installed with the default package set.
Now that you have installed and configured your ROS environment, you can create and build a ROS package.
General ROS and Technical Help
- Creating a rospy package
- Model the Robot
- Odometry - General Information
- Odometry - Configuring with ROS
Creating and Using Our Packages