Notice
Recent Posts
Recent Comments
Link
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
Tags
more
Archives
Today
Total
관리 메뉴

MJ Archive

INSTALL Cartographer in ROS1(noetic) 본문

Installation

INSTALL Cartographer in ROS1(noetic)

Min Ji 2025. 2. 2. 10:35
💡 Mac M1 환경에서 Parallels를 통해 진행한 내용
Parallels OS: Ubuntu 20.04
ROS1: Noetic

 

Cartographer INSTALL

Cartographer 공식문서를 참고하여 설치 진행.

# 필요한 라이브러리 설치
$ sudo apt-get update
$ sudo apt-get install -y python3-wstool python3-rosdep ninja-build stow

# workspace 생성
$ mkdir catkin_ws
$ cd catkin_ws
$ wstool init src
$ wstool merge -t src https://raw.githubusercontent.com/cartographer-project/cartographer_ros/master/cartographer_ros.rosinstall
$ wstool update -t src

# rosdep으로 종속성 확인 및 필요한 패키지 설치
$ sudo rosdep init
$ rosdep update
$ rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y

 

✅ Trouble Shooting

진행 중 아래와 같이 libabsl-dev 패키지에서 ERROR가 발생할 경우,

catkin_ws/src/cartographer/pacakge.xml 파일에서 libabsl-dev를 참조하는 코드를 삭제해 주면 된다.

ERROR message
package.xml

 

이후 다시 공식문서의 절차에 따라 진행하면 된다.

# catkin_ws 디렉토리에서 진행
# abseil 수동설치
$ src/cartographer/scripts/install_abseil.sh

# 버전 충돌 방지를 위해 제거하라고 했지만 해당 패키지가 없어서 아래의 코드는 생략함
$ sudo apt-get remove ros-${ROS_DISTRO}-abseil-cpp

# Build!!
$ catkin_make_isolated --install --use-ninja

 

catkin_make_isolated 명령어와 catkin_make 명령어의 차이는 패키지를 개별적으로 build하느냐의 차이라고 한다.

(GPT말로는 ROS2에서 colcon과 비슷한 역할이라고 함)

또, build 옵션 중에서 --use-ninja 옵션은 build시 일반적으로 사용되는 make 명령어보다 속도가 더 빠르고 효과적인 build 방법이라고 한다.

 

실행

Cartographer 공식문서에서 2D, 3D 환경의 Demo를 실행시킬 수 있는 bagfile을 제공한다.

(Pure Localization, Static Landmarks, Deutsches Museum 등 다양한 Demo가 있는데, Pure Localization을 실행함)

# Cartographer를 실행하기 전, sourcing하기
$ source install_isolated/setup.bash

# 2D Bagfiles Download
$ wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/b2-2016-04-05-14-44-52.bag
$ wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/b2-2016-04-27-12-31-41.bag

# Generate the map and run pure localization
$ roslaunch cartographer_ros offline_backpack_2d.launch bag_filenames:=${HOME}/Downloads/b2-2016-04-05-14-44-52.bag

 

위의 명령어를 실행하면, Rviz를 통해 아래와 같은 시각화 결과를 확인할 수 있다.

pure localization

cartographer_offline_node가 끝날 때까지 map을 생성한다.

'Installation' 카테고리의 다른 글

INSTALL Ubuntu20.04 + ROS1(Noetic) Using Parallels on Mac M1  (0) 2025.02.01