Installing and configuring the ROS Environment 1

Source: Internet
Author: User
Tags echo command

Ros Learning Path (original blog, reprint please indicate source-Zhou Xuewei )

I. Ros Core Tutorials

1. Install and configure the ROS environment: 

Note: Before you learn this lesson, please follow the previous post to install Ros.  If you are using a software manager such as apt to install ROS, these packages will not have write access after installation, and current system users such as yourself cannot modify these packages. When your development involves the operation of the ROS package source layer or when creating a new Ros package, you should be working in a directory with read and write permissions, just as you would in your current system user's home directory.

2. Managing the Environment

  During the installation of Ros, you will be prompted to say that you need one of the source multiple setup.*sh files, or even prompt to add this ' source ' command to your startup script. These operations are necessary because ROS is dependent on the concept of a combination of spaces, and this concept is implemented by configuring the scripting environment. This makes it easier to develop for different versions or different package sets. If you're having trouble finding and using Ros packages, make sure you've configured the scripting environment correctly. A good way to check is to make sure you have set up environment variables like ros_root and Ros_package_path, which can be viewed with the following commands:

[Email protected]:/#  Export | grep ROS

It is already configured properly.

If the discovery is not configured, then you will need ' source ' some ' setup.*sh ' files. (Manually make some Ros-related configuration files effective)

However, I did not configure it at all before, what action would cause it to configure the environment itself: Ros will help you automatically generate these ' setup.*sh ' files, which are generated and saved in different places in the following ways:

    • The Setup.*sh file is generated when the ROS package is installed through the package manager similar to apt.
    • Generated by tools like Rosws in Rosbuild workspaces.

    • generated automatically when compiling or installing catkin packages.

Note: in all tutorials you will often see different instructions for Rosbuild and Catkin, because there are currently two different ways to organize and compile Ros applications. In general, Rosbuild is simpler and easier to use, and Catkin uses more standard CMake rules, so it's more complex, but also more flexible, especially for those who want to integrate external existing code or want to publish their own code. About these if you want to get more comprehensive see Catkin or rosbuild.

If you are installing Ros from the apt tool on Ubuntu, you will see the Setup.*sh file in the '/opt/ros/<distro>/' directory, You can then execute the following source command:

[Email protected]:/# Source/opt/ros/<distro>/setup.bash (please use the specific ROS distribution name instead of <distro>. )

EXECUTE as follows:

Each time you open the terminal you need to run the above command before you run the Ros-related commands, in order to avoid this tedious process, you can advance in the . BASHRC file (for beginners Please note: This file is in the home directory of the current system user. Add this command so that the system has configured the environment for you to perform these commands every time you log in. This also makes it easy for you to install on the same computer and switch to different versions of ROS (such as Fuerte and groovy) at any time.

In addition, you can find these setup.*sh files in the appropriate Ros installation directory on other system platforms.

You can do this by using the echo command and vim editor in two ways:

" Source/opt/ros/indigo/setup.bash " >> ~/~/.BASHRC (make it effective after writing)

3. Create a Ros workspace

These operating methods are only available for Ros groovy and later versions, and for Ros Fuerte and earlier versions, select Rosbuild.

3.1. Let's start creating a Catkin workspace  

[Email protected]:/# mkdir-p ~/catkin_ws/src (Create working directory first)
[Email protected]:/# cd ~/CATKIN_WS/SRC (enter the created working directory)

3.2. Even if the workspace is empty (there is no package in the ' src ' directory, there is only one CMakeLists.txt link file), you can still compile it:

[Email protected]: cd ~/catkin_ws/[email protected]: Catkin_make

The 3.3.catkin_make command is a very handy tool in the Catkin workspace. If you look at the current directory you should be able to see both the ' Build ' and ' devel ' folders. You can see several setup.*sh files in the ' Devel ' folder. source Any of these files can have the current workspace set at the top level of the ROS working environment, for more information, refer to the Catkin documentation. Next, first source the newly generated setup.*sh file:

[email protected]: source Devel/setup.bash

3.4. To ensure that the workspace is configured correctly, make sure that the ros_package_path environment variable contains your workspace directory, which is viewed using the following command:

[email protected]: echo $ROS _package_path

The ROS work environment has been built,

  

Installing and configuring the ROS Environment 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.