First, create a catkin work space
Step One: Build a Catkin workspaceafter installing the ROS version, set the environment variable: $ source/opt/ros/kinetic/setup.bash. You can then create a Catkin workspace.
mkdir -P~/catkin_ws/~/catkin_ws/~/catkin_ws/$ catkin_make
that is, the steps to create a Catkin workspace on the terminal command line are:
- Create the folder where the Catkin workspace is located, as on the/CATKIN_WS;
- In the workspace folder that you created, create a subfolder/src;
- Under sub-folder SRC, initialize a new Catkin workspace;
- Returns the root directory of the Catkin workspace, which is under CATKIN_WS;
- Use the Catkin_make command to complete the construction of the Catkin workspace.
The first time you run the Catkin_make command, a CMakeLists.txt file is created under the SRC folder, and two sub-folders build and Devel are created under the root directory, such as.
Step Two: Configure environment variablesNext, you need to configure the Global environment variable and the installation path for the Catkin workspace to run on the terminal command line:
$ source ~/catkin_ws/devel/setup.bash
each time you reopen a new terminal shell, you need to run the above command. To do this you must add the command script to the ~/.BASHRC file so that each time you open SHELL,.BASHRC it will run automatically, using the following command:
Echo " Source ~/catkin_ws/devel/setup.bash " >> ~/~/.BASHRC
at this point, complete the creation of the Catkin workspace, with the following brief steps:
- Create a Catkin workspace directory, such as/CATKIN_WS/SRC;
- In the SRC directory, use Catkin_init_workspace to initialize a Catkin workspace;
- Under the Catkin workspace root directory, use Catkin_make to build;
- Configure environment variables to start the current Catkin workspace.
Second, create a Ros function pack
Step One: Create a Ros Feature PackThe Ros Feature Pack must be located in the Catkin workspace, so you must create a good one Catkin workspace before you can create the Ros Feature Pack. Under the SRC directory of the Catkin workspace directory, use the CATKIN_CREATE_PKG command to create a Ros Feature Pack. The syntax for catkin_create_pkg is as follows:
$ catkin_create_pkg <package_name> [DEPEND1] [Depend2] [Depend3]
where [Depend1], [Depend2], [Depend3] is the specific software Feature pack that is required to create the Software Feature Pack, which is generally referred to as a dependency package.
Step Two: Build the Ros function packthen build the empty Software Feature Pack to use the Catkin_make command in the root directory of the Catkin workspace. To complete the creation of the Ros Feature Pack, proceed as follows:
- Use the catkin_create_pkg command to create a feature pack in the SRC directory of the Catkin workspace;
- Use the Catkin_make command to complete the build in the root directory of the Catkin workspace.
ROS-3: Catkin workspace and ROS Feature Pack