작성자: 박준규

최초작성 2023.01.16(월) 수정 2023.01.17(화)

Official Documentation: https://wiki.ros.org/ROS/Tutorials/CreatingPackage

Creating a package

  1. Create a catkin workspace if you haven’t already
    1. If you have followed steps in [M1맥에 설치해보기 (ROS1) or 윈도우와 듀얼부팅하기 (ROS1)] you have already done so in Step 10.
    2. We are going to assume that our catkin workspace is named ros_workspace
  2. Use the catkin_create_pkg script provided by ROS to create a package:
#Go to the ros_workspace/src directory
cd ~/ros_workspace/src

#use the catkin_create_pkg script to create a new package
#it will be called 'beginner_tutorials'
#and will depend on std_msgs, roscpp, and rospy

catkin_create_pkg test_package std_msgs roscpp rospy 

#For example,
#catkin_create_pkg <package_name> [dependency1] [dependency2] [dependency3]
#the dependencies are optional.

Now that you have created a package, inside the package root directory (/ros_workspace/src/test_package), there should be:

Adding new scripts into the package

If you are making a node in Python, you should create a scripts directory inside the package root directory. (test_package/scripts)

Inside the scripts directory, you can create your own Python scripts for the package.

An example can be found in TurtleSim에 DWA Planner 적용시켜보기 (ROS1)

Customizing the package.xml file

Open the package.xml file. If you have mounted the directory using multipass mount, you can open it from your Mac Finder app as well.

Opened the file in my Mac environment.

Opened the file in my Mac environment.