[ROS] ROS Package 이름 변경 방법
앞의 포스트에서 ROS Package를 만들어 보았다. 이때 ROS의 <catkin_create_pkg> 명령을 이용하여 Package를 생성하였고 이 과정에서 CMakeLists.txt와 package.xml 파일이 자도으로 생성 되었다. 그런데 만약 이미 생성한 Package의 이름을 바꾸고 싶으면 어떻게 해야 할까?
위의 질문 해결을 통해 CMakeLists.txt 와 package.xml 파일의 필수 내용을 간단히 살펴 보자.
[[ROS] Package 생성 (Node 생성)
ROS에서 어떠한 기능을 만들기 위해 Node를 생성하고 이 Node를 실행시켜야 한다. 그런데 Node는 ROS Package안에 만들어야 한다. 따라서 원하는 기능을 만들어 보기 위해서는 가장먼저 Package를 생성을
goez.tistory.com](https://goez.tistory.com/15)
Package 이름 변경
Package의 이름은 어디에서 정의 될까? 정답은 CMakeLists.txt 와 package.xml 파일에 정의 되어 있다. 아래 코드를 보자.
<?xml version="1.0"?>
<package format="2">
<!-- <name>TEST</name> 이 부분이 Package 이름 -->
<name>ROS_STUDY</name>
<version>0.0.0</version>
<description>The TEST package</description>
<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
<maintainer email="test1804@todo.todo">test1804</maintainer>
=========================== 생략 =============================
<package.xml>
cmake_minimum_required(VERSION 3.0.2)
#project(TEST) ## 이부분이 Package 이름
project(ROS_STUDY)
## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS roscpp)
<CMakeLists.txt>
위에서와 같이 Package 이름 변경을 위해서는 package.xml의 <name>Package 이름</name> 과 CMakeLsits.txt의 project(Package 이름) 부분을 변경 해주면 된다.
단 주의할 점은 두개의 파일의 Package 이름이 다르게 설정된 경우 Build 시 에러가 발생 한다. (너무나 당연한 이야기다.)
알고보면 너무 단순한데 찾아봐도 잘 나오지 않길래 적어본다.