기본 듀토리얼
http://wiki.ros.org/catkin/Tutorials
catkin/Tutorials - ROS Wiki
Catkin Tutorials Creating a workspace for catkinThis tutorial covers how to setup a catkin workspace in which one or more catkin packages can be built. Creating a ROS PackageHow to create a new ROS package using catkin. Building and using catkin packages i
wiki.ros.org
패키지 구조 관련
http://wiki.ros.org/catkin/workspaces
catkin/workspaces - ROS Wiki
catkin packages can be built as a standalone project, in the same way that normal cmake projects can be built, but catkin also provides the concept of workspaces, where you can build multiple, interdependent packages together all at once. Catkin Workspaces
wiki.ros.org
구조 이미지 관련
https://medium.com/swlh/7-simple-steps-to-create-and-build-our-first-ros-package-7e3080d36faa
Part 2: 7 Simple Steps to Create and Build Your First ROS Package
7 Simple Steps to create and build your first ROS Package
medium.com
가장 긴단한 패키지 구조
The simplest possible package might have a structure which looks like this:
-
my_package/ CMakeLists.txt package.xml
추천하는 구조(레이아웃 이라고 표현함)
The recommended method of working with catkin packages is using a catkin workspace, but you can also build catkin packages standalone. A trivial workspace might look like this:
-
workspace_folder/ -- WORKSPACE src/ -- SOURCE SPACE CMakeLists.txt -- 'Toplevel' CMake file, provided by catkin package_1/ CMakeLists.txt -- CMakeLists.txt file for package_1 package.xml -- Package manifest for package_1 ... package_n/ CMakeLists.txt -- CMakeLists.txt file for package_n package.xml -- Package manifest for package_n
Source Space
프로그램 작성 코드가 있는 디렉토리
The source space contains the source code of catkin packages. This is where you can extract/checkout/clone source code for the packages you want to build. Each folder within the source space contains one or more catkin packages. This space should remain unchanged by configuring, building, or installing. The root of the source space contains a symbolic link to catkin's boiler-plate 'toplevel' CMakeLists.txt file. This file is invoked by CMake during the configuration of the catkin projects in the workspace. It can be created by calling catkin_init_workspace in the source space directory.
Build Space
빌드에 필요하거나 log 디렉토라
The build space is where CMake is invoked to build the catkin packages in the source space. CMake and catkin keep their cache information and other intermediate files here. The build space does not have to be contained within the workspace nor does it have to be outside of the source space, but this is recommended.
Development (Devel) Space
작업공간 각종 빌드 결과값들이 저장되는 공간
The development space (or devel space) is where built targets are placed prior to being installed. The way targets are organized in the devel space is the same as their layout when they are installed. This provides a useful testing and development environment which does not require invoking the installation step. The location of the devel space is controlled by a catkin specific CMake variable called CATKIN_DEVEL_PREFIX, and it defaults to <build space>/develspace. This is the default behavior because it might be confusing to CMake users if they invoked cmake .. in a build folder and that modified things outside of the current directory. It is recommended, however, to set the devel space directory to be a peer of the build space directory.
Install Space
배포공간 각종 빌드 결과값들이 저장되는 공간 ( 위의 내용과다르게 install 은 catkin_make install 이런식으로 명시해줘야 생성되는 디렉토리이다.
DEVEL과 가장 다른점은 이 install space 는 꼭 workspace 에 있을 필요가 없다 독립적으로 실행 가능함.
따라서 워크스페이스에서 작업후 다른곳에 배포하려고 catkin_make install 로 install space를 만들고 이동시킨다.
Once targets are built, they can be installed into the install space by invoking the install target, usually with make install. The install space does not have to be contained within the workspace. Since the install space is set by the CMAKE_INSTALL_PREFIX, it defaults to /usr/local, which you should not use (because uninstall is near-impossible, and using multiple ROS distributions does not work either).
완전 기본 구조_1 ( 패키지 없이 워크스페이스만 )
build 에 있는 tree 구조 내용은 따로 뺌
$ mkdir -p ~/ ws_1/src
$ cd ~/ ws_1/src
$ catkin_init_workspace
$ cd ~/ ws_1/
$ catkin_make
$ source devel/setup.bash
$ echo $ROS_PACKAGE_PATH
/home/youruser/catkin_ws/src:/opt/ros/kinetic/share
기본 구조_2 ( 워크스페이스 + 패키지 )
build 에 있는 tree 구조 내용은 따로 뺌
$ cd ~/ws_2/src
$ catkin_create_pkg beginner_tutorials std_msgs rospy roscpp
$ cd ~/ws_2
$ catkin_make
$ source ~/ws_2 /devel/setup.bash
구조_3 [ 워크스페이스 + 패키지{ 소스코드(C++,python) } + 커스텀메세지패키지 ]
catkin_make 후 tree -d (build 부분은 뻄)
.
├── build
├── devel
│ ├── include
│ │ └── test_msg
│ ├── lib
│ │ ├── pkgconfig
│ │ └── python3
│ │ └── dist-packages
│ │ └── test_msg
│ │ ├── msg
│ │ └── srv
│ └── share
│ ├── beginner_tutorials
│ │ └── cmake
│ ├── common-lisp
│ │ └── ros
│ │ └── test_msg
│ │ ├── msg
│ │ └── srv
│ ├── gennodejs
│ │ └── ros
│ │ └── test_msg
│ │ ├── msg
│ │ └── srv
│ ├── roseus
│ │ └── ros
│ │ └── test_msg
│ │ ├── msg
│ │ └── srv
│ └── test_msg
│ └── cmake
├── install
│ ├── lib
│ │ └── pkgconfig
│ └── share
│ └── beginner_tutorials
│ └── cmake
└── src
├── beginner_tutorials
│ ├── include
│ │ └── beginner_tutorials
│ └── src
└── test_msg
├── msg
└── srv
154 directories
$ echo $ROS_PACKAGE_PATH
로 본인 package 가 path에 추가 됬는지 확인하고
$ rosmsg list | grep test_msg_
$ rossrv list | grep test_srv_
이렇게 확인하면 추가됬음을 확인 할 수 있다.
liam@catkin:~/catkin_ws/src/simulation/ws_2$ l
build/ devel/ install/ src/
liam@catkin:~/catkin_ws/src/simulation/ws_2$ l src/
beginner_tutorials/ CMakeLists.txt@ test_msg/
liam@catkin:~/catkin_ws/src/simulation/ws_2$ l src/test_msg/msg/
test_msg_1.msg test_msg_2.msg test_msg_3.msg
liam@catkin:~/catkin_ws/src/simulation/ws_2$ l src/test_msg/srv/
test_srv_1.srv test_srv_2.srv
liam@catkin:~/catkin_ws/src/simulation/ws_2$
liam@catkin:~/catkin_ws/src/simulation/ws_2$
liam@catkin:~/catkin_ws/src/simulation/ws_2$ . devel/setup.bash
liam@catkin:~/catkin_ws/src/simulation/ws_2$ echo $ROS_PACKAGE_PATH
/home/liam/catkin_ws/src/simulation/ws_2/src:/opt/ros/noetic/share
liam@catkin:~/catkin_ws/src/simulation/ws_2$ rospack list | grep beginner_tutorials
beginner_tutorials /home/liam/catkin_ws/src/simulation/ws_2/src/beginner_tutorials
liam@catkin:~/catkin_ws/src/simulation/ws_2$ rosmsg list | grep test_msg_
test_msg/test_msg_1
test_msg/test_msg_2
test_msg/test_msg_3
liam@catkin:~/catkin_ws/src/simulation/ws_2$ rossrv list | grep test_srv_
test_msg/test_srv_1
test_msg/test_srv_2
liam@catkin:~/catkin_ws/src/simulation/ws_2$
구조_4 [ 워크스페이스 + 패키지{ 소스코드(C++,python) + launch + msg,srv } + 커스텀메세지패키지 ]
build 에 있는 tree 구조 내용은 따로 뺌
.
├── build
├── devel
│ ├── include
│ │ ├── beginner_tutorials
│ │ └── test_msg
│ ├── lib
│ │ ├── pkgconfig
│ │ └── python3
│ │ └── dist-packages
│ │ ├── beginner_tutorials
│ │ │ ├── msg
│ │ │ └── srv
│ │ └── test_msg
│ │ ├── msg
│ │ └── srv
│ └── share
│ ├── beginner_tutorials
│ │ └── cmake
│ ├── common-lisp
│ │ └── ros
│ │ ├── beginner_tutorials
│ │ │ ├── msg
│ │ │ └── srv
│ │ └── test_msg
│ │ ├── msg
│ │ └── srv
│ ├── gennodejs
│ │ └── ros
│ │ ├── beginner_tutorials
│ │ │ ├── msg
│ │ │ └── srv
│ │ └── test_msg
│ │ ├── msg
│ │ └── srv
│ ├── roseus
│ │ └── ros
│ │ ├── beginner_tutorials
│ │ │ ├── msg
│ │ │ └── srv
│ │ └── test_msg
│ │ ├── msg
│ │ └── srv
│ └── test_msg
│ └── cmake
└── src
├── beginner_tutorials
│ ├── include
│ │ └── beginner_tutorials
│ ├── launch
│ ├── msg
│ ├── script
│ ├── src
│ └── srv
├── src
└── test_msg
├── msg
└── srv
152 directories
roscd 랑 rosmsg, rossrv 로 확인하는 부분
liam@catkin:~/catkin_ws/src/simulation/ws_2$ echo $ROS_PACKAGE_PATH
/opt/ros/noetic/share
liam@catkin:~/catkin_ws/src/simulation/ws_2$ . devel/setup.bash
liam@catkin:~/catkin_ws/src/simulation/ws_2$ echo $ROS_PACKAGE_PATH /home/liam/catkin_ws/src/simulation/ws_2/src:/opt/ros/noetic/share
liam@catkin:~/catkin_ws/src/simulation/ws_2$
liam@catkin:~/catkin_ws/src/simulation/ws_2$ rospack list | grep beginner_tutorial
beginner_tutorials /home/liam/catkin_ws/src/simulation/ws_2/src/beginner_tutorials
liam@catkin:~/catkin_ws/src/simulation/ws_2$ rospack list | grep test_msg
test_msg /home/liam/catkin_ws/src/simulation/ws_2/src/test_msg
liam@catkin:~/catkin_ws/src/simulation/ws_2$
liam@catkin:~/catkin_ws/src/simulation/ws_2$ rosmsg list | grep test_msg_in_beginner_1
beginner_tutorials/test_msg_in_beginner_1
liam@catkin:~/catkin_ws/src/simulation/ws_2$ rosmsg list | grep test_msg_1
test_msg/test_msg_1
liam@catkin:~/catkin_ws/src/simulation/ws_2$ rossrv list | grep test_srv_1
test_msg/test_srv_1
liam@catkin:~/catkin_ws/src/simulation/ws_2$ rossrv list | grep test_msg_in_beginner_2
beginner_tutorials/test_msg_in_beginner_2
이런식으로 의존성 체크 가능
$ rospack depends1 beginner_tutorials
$ rospack depends1 test_msg
'ROS_python_정리 > 패키지관련,CMake,package관련' 카테고리의 다른 글
roslaunch tag 종류 : XML 파일 속 태그 설명 (0) | 2023.12.19 |
---|---|
python ros 패키지 생성 (0) | 2022.04.22 |
action 시 package.xml , CMakeLists.txt (0) | 2022.04.09 |
msg srv 시 package.xml , CMakeLists.txt (0) | 2022.04.09 |
댓글