일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 공부
- Subscriber
- Slam
- 기초
- turtlebot3
- 가재보
- catkin빌드
- Publisher
- XML
- 노트
- CNN
- 입문
- Gazebo
- Python
- 패키지만들기
- C++
- Robotics program 교육
- TinySLAM
- udacity
- 데브코스
- Localization
- turtlesim
- 튜토리얼
- 자율주행
- navgation
- Ros
- sudo
- launch
- 어렵네
- 판단
- Today
- Total
Tnote
ROS, turtlebot3(가재보, 시뮬레이터)를 활용한 slam, navigation 실습 본문
ros, melodic버전 가정.
가재보(시뮬레이터)를 사용.
1. 디렉토리 생성
mkdir -p test_ws/src
cd ~/test_ws/src
2. 의존 패키지 설치
sudo apt-get install ros-melodic-joy ros-melodic-teleop-twist-joy \
ros-melodic-teleop-twist-keyboard ros-melodic-laser-proc \
ros-melodic-rgbd-launch ros-melodic-depthimage-to-laserscan \
ros-melodic-rosserial-arduino ros-melodic-rosserial-python \
ros-melodic-rosserial-server ros-melodic-rosserial-client \
ros-melodic-rosserial-msgs ros-melodic-amcl ros-melodic-map-server \
ros-melodic-move-base ros-melodic-urdf ros-melodic-xacro \
ros-melodic-compressed-image-transport ros-melodic-rqt-image-view \
ros-melodic-gmapping ros-melodic-navigation ros-melodic-interactive-markers
3. turtlebot3 패키지 다운
*branch 하나만 get clone : git clone -b 브랜치명 --single-branch 깃주소
git clone -b melodic-devel --single-branch https://github.com/ROBOTIS-GIT/turtlebot3
git clone -b melodic-devel --single-branch https://github.com/ROBOTIS-GIT/turtlebot3_msgs
git clone -b melodic-devel --single-branch https://github.com/ROBOTIS-GIT/turtlebot3_simulations
4. catkin 빌드
cd ~/test_ws
catkin_make
source devel/setup.bash <- 현재는 새 터미널 킬때마다 해줘야한다.
*자동으로 빌드하는 법 (참고)https://jfl2dh.tistory.com/8
5. 환경변수 적용
*환경변수 값 추가 : export 환경변수명='값'
export TURTLEBOT3_MODEL='burger' <- 현재는 새 터미널 킬때마다 해줘야한다.
+ 해당 환경변수가 적용됬는지 확인
echo $환경변수명; ex. echo $TURTLEBOT3_MODEL // 출력 : burger
실습 전
- 실습 넘어갈 때, 기존 roslauch 실행 꺼야함.
- roslaunch 하나마다 새터미널 키고 -> source devel/setup.bash -> export TURTLEBOT3_MODEL='burger' 해야함.(현재는)
실습 1 - turtlebot3 가 제대로 작동하는지 확인
roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch -> 빈 맵roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch -> 방향키로 가재보 조종
실습 2 - 자동조종 되는지 확인
roslaunch turtlebot3_gazebo turtlebot3_world.launch -> 거북이 모양 맵
roslaunch turtlebot3_gazebo turtlebot3_simulation.launch -> 장애물 피하는 자동 조종
실습 3 - slam
roslaunch turtlebot3_gazebo turtlebot3_world.launch -> 거북이 모양 맵
roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=gmapping -> 슬램
roslaunch turtlebot3_gazebo turtlebot3_simulation.launch -> 자동 조종
맵 저장
rosrun map_server map_saver -f ~/map이름
실습 4 - navgation
roslaunch turtlebot3_gazebo turtlebot3_world.launch -> 거북이 모양 맵
roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=$HOME/위에서 저장한 맵이름.yaml
RViz창이 뜨는데, 위에 메뉴바 중에서 2D Nav Goal 을 누르고 화면에 맵 원하는 지점 클릭하면 가재보 이동함.
*sudo apt-get install ros-melodic-slam-gmapping // gmapping이 자꾸 오류나면 이거해야함.
"package 'map_server' not found"
=>sudo apt-get install ros-melodic-map-server
감사합니다.
'ROS' 카테고리의 다른 글
ROS, start setting (0) | 2022.06.19 |
---|---|
ROS, hector_slam (0) | 2022.02.21 |
ROS, launch 파일(.xml) (0) | 2022.02.20 |
ROS, turtlesim 활용해 python 기초 코딩 (0) | 2022.02.06 |
ROS, 패키지 만들기, catkin 빌드하기 (0) | 2022.02.05 |