The process of creating a workspace in ROS is not complicated, only a few lines of instructions are required.
1. Create a space first, enter the command:
mkdir -p ~/catkin_ws/src
2. Then enter the working space catkin_ws/src, enter the command to initialize:
catkin_init_workspace
3. Then exit to /catkin_ws to compile the entire workspace and enter the command:
catkin_make
4. Then source the script to make the environment variable effective, and enter the command:
source devel/setup.bash
5. Then use the command to check whether the environment variables are correct, enter:
echo $ROS_PACKAGE_PATH
if:
/home/rikirobot/catkin_ws/src:/opt/ros/kinetic/share
It means that the creation and compilation are successful.
It is also relatively simple to create a function package
. 1. First enter the code space catkin_ws/src and use the command:
catkin_create_pkg learning_sun std_msgs rospy roscpp
2. Then exit to the workspace/catkin_ws and compile it and enter the command:
catkin_make
3. Finally set the environment variables, and the creation is complete
source devel/setup.bash