Use yolov5 to create a function package under ros
1. Workspace
1. Create a workspace
mkdir -p ~/wheeltec/src
cd ~/wheeltec/src
#初始化工作空间
catkin_init_workspace
2. Compile the workspace
cd ..
#编译工作空间
catkin_make
3. Set environment variables
source devel/setup.bash #添加环境变量
cd ~
nano .bashrc
The above is nano and the following can be used gedit
gedit ~/.bashrc
source ~/devel/setup.bash
source .bashrc
echo $ROS_PACKAGE_PATH
#View the environment variables of ROS
2. Function package
1. The function package is under src: the folder where user function codes are stored
2. The content of the function package
include: .h file src: .cpp file
launch: launch file urdf: .urdf file
config: parameter file, yaml, srv, msg, action
build、src、devel
scripts: executable script files (Python)
CMakeLists.txt: Defines the rules for compilation
package.xml: defines the properties of the package
3. Create a feature package
catkin_create_pkg <package_name> [depend1] [depend2] [depend3]
like:
catkin_create_pkg new_package std_msgs rospy roscpp
4. Compile the single-function package:
catkin_make -DCATKIN_WHITELIST_PACKAGES="package_name"
Custom compilation thread:
catkin_make -j -l