ROS study notes a (catkin working space of ROS)

ROS study notes a (catkin working space of ROS)

After the installation is complete ROS, need to see the environment variable is set correctly, and to verify whether the normal operation of ROS by creating a simple example.

1 View environment variables

During installation of ROS, we execute the following command :( This command is to add ROS environment variables to the current user)

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

Add the environment variable to confirm the success: printenv | grep ROS, following results that illustrate the success of the environment variable settings:

ROS_ROOT=/opt/ros/indigo/share/ros
ROS_PACKAGE_PATH=/opt/ros/indigo/share:/opt/ros/indigo/stacks
ROS_MASTER_URI=http://localhost:11311
ROSLISP_PACKAGE_DIRECTORIES=
ROS_DISTRO=indigo
ROS_ETC_DIR=/opt/ros/indigo/etc/ros

2 Create a ROS Workspace

I use that ROS indigo, the same applies to the ROS groovy and later versions.
[1] creates and initializes a catkin workspace

$ mkdir -p ~/catkin_ws2/src
$ cd ~/catkin_ws2/src
$ catkin_init_workspace

catkin_init_workspace command the current directory is initialized to a ROS workspace.

ls -l

Can be

Look at the contents of the workspace after initialization. Found: there is only one directory at catkin_ws src directory just created, under the src directory is only a symbolic link points to a file cmake file. Although now catkin_ws directory is empty, but we still can

[2] The compiler workspace.

$ cd ~/catkin_ws2
$ catkin_make

End result:

复制代码
Base path: /home/wj/catkin_ws2
Source space: /home/wj/catkin_ws2/src
Build space: /home/wj/catkin_ws2/build
Devel space: /home/wj/catkin_ws2/devel
Install space: /home/wj/catkin_ws2/install
####
#### Running command: "cmake /home/wj/catkin_ws2/src -DCATKIN_DEVEL_PREFIX=/home/wj/catkin_ws2/devel -DCMAKE_INSTALL_PREFIX=/home/wj/catkin_ws2/install -G Unix Makefiles" in "/home/wj/catkin_ws2/build"
####
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CATKIN_DEVEL_PREFIX: /home/wj/catkin_ws2/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/indigo
-- This workspace overlays: /opt/ros/indigo
-- Found PythonInterp: /usr/bin/python (found version "2.7.6") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/wj/catkin_ws2/build/test_results
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.6.18
-- BUILD_SHARED_LIBS is on
-- Configuring done
-- Generating done
-- Build files have been written to: /home/wj/catkin_ws2/build
####
#### Running command: "make -j4 -l4" in "/home/wj/catkin_ws2/build"
####
复制代码

[Catkin_make command catkin workspace is a very powerful tool. ]

Until then view catkin_ws directory, found more than two folders build, devel:

Can be seen in the devel directory, there are a lot of setup. * Sh files, reading any of these files will set the environment variable current workspace placed on the top of all environment variables. If we open these files will be found eventually need to read the setup.sh file, this file

[3] defines environmental variables catkin_ws required space.

wj@wj-Inspiron-5437:~/catkin_ws2$ source devel/setup.sh   //读取
setup.sh
文件

[4] sure you have loaded catkin workspace environment variable: echo $ ROS_PACKAGE_PATH
result: / home / wj / catkin_ws2 / src: / opt / ros / indigo / share: / opt / ros / indigo / stacks
then ROS environment variables have been created.

3 summary

Catkin workspace initialization of ROS: catkin_init_workspace
catkin workspace compilation of ROS: catkin_make
reading environment variables for the current catkin workspace: source devel / setup.sh
verify ROS environment variable workspace loaded successfully: echo $ ROS_PACKAGE_PATH

Guess you like

Origin blog.csdn.net/xyt723916/article/details/89364490