본문 바로가기
Ros 공부

turtlebot3 burger slam & navigation (urdf에 카메라 추가하기) (2)

by 바위폭주 2023. 3. 11.
반응형

https://woongeee.tistory.com/9

SLAM

gmapping

$ roslaunch turtlebot3_gazebo turtlebot3_world.launch
# gazebo로 world를 먼저 열고
$ roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=gmapping
# gmapping slam
$ roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
# 키보드로 turtlebot을 움직여 slam을 진행한다.

karto

$ sudo apt install ros-noetic-slam-karto
$ roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=karto

carto

$ mkdir -p carto_ws/src
$ catkin_init_workspace
# catkin_ws에서 catkin_make를 할 수 없기 때문에 새로운 workspace를 만들어주었다.

$ sudo apt update
$ sudo apt install -y python3-wstool python3-rosdep ninja-build stow
$ cd ~/carto_ws/src
$ wstool init src
$ wstool merge -t src https://raw.githubusercontent.com/cartographer-project/cartographer_ros/master/cartographer_ros.rosinstall
$ wstool update -t src
$ sudo rosdep init
$ rosdep update
$ rosdep install --from-paths src --ignore-src --rosdistro=noetic -y
# 위 명령어에서 not available for OS version이라는 오류가 나왔다.
$ src/cartographer/scripts/install_abseil.sh
$ sudo apt remove ros-noetic-abseil-cpp
$ catkin_make_isolated --install --use-ninja

cartographer 파일의 package.xml 파일에서

46번째 줄 <depend>libabsl -dev</depend>를 삭제시켜주었다.

$ source ~/carto_ws/install_isolated/setup.bash
$ roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=cartographer

catkin_ws/src/turtlebot3/turtlebot3_slam/config에서 turtlebot3_lds_2d_gazebo.lua파일을 수정했다.

에러에서 'odom'이 중복된다는 에러가 나왔다.

그래서 published_frame = "base_footprint"로 수정해주고 slam을 진행하니 잘 되었다.

Navigation

turtlebot3 burger 모델로 Naviagtion을 진행하던 중 rviz에서 turtlebot 카메라의 이미지를 받아오지 못하는 것을 확인했다.

tftree를 보면 camera가 없는 것을 확인할 수 있다.

 

turtlebot3_burger.urdf.xacro

urdf파일에 camera를 추가하였고 ZED.stl파일을 다운받아서 추가하였다.

ZED카메라가 추가된 것을 확인할 수 있다.

 

turtlebot3_burger.gazebo.xacro

tftree에 카메라가 추가된 것을 확인할 수 있고 아래 사진에서 카메라 화면이 나오는 것을 확인할 수 있다.

$ roslaunch turtlebot3_gazebo turtlebot3_house.launch
$ roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=$HOME/carto.yaml

carto로 slam한 맵으로 navigation을 진행하였다.

 

반응형

'Ros 공부' 카테고리의 다른 글

Manipulator_H →Manipulator_P  (0) 2023.03.12
OpenManipulator-X  (0) 2023.03.12
slam-cartographer  (0) 2023.03.11
LDS-02 사용하기  (0) 2023.03.11
turtlebot3 burger slam & navigation (urdf에 카메라 추가하기) (1)  (0) 2023.03.11