로봇 개발(ROS)

[230203] 맥북(Mac M1 Pro)에 ROS noetic 설치하기

Choi Jaekuk 2023. 2. 3. 15:53

https://cjk09083.tistory.com/37

 

[230203] Mac M1 Pro + Ubuntu 20.04

이전 포스트에서 Remote PC 역할을 라즈베리파이에서 수행하였다. 하지만 라즈베리파이에선 GUI등 추가기능 수행에 어려움이 있어 현재 사용중엔 맥북(M1 Pro)에 Ubuntu 와 Ros를 설치하기로 하였다. 우

cjk09083.tistory.com

지난 포스트에 이어 가상환경에 설치된 Ubuntu 20.04에 ROS noetic을 설치하였다.

 

먼저 http://wiki.ros.org/noetic/Installation/Ubuntu 공식 위키를 참조하여 noetic을 설치하고 아래 내용을 진행한다.

sudo apt install python3-osrf-pycommon
sudo apt insall python3-catkin-tools
  • 아래 명령어로 워크스페이스 생성
ckdir -p ~/catkin_ws/src 
cd catkin_ws  
catkin_make
CMake Error at /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "amcl" with any of
  the following names:
	amclConfig.cmake
	amcl-config.cmake
	map_serverConfig.cmake
	map_server-config.cmake
	move_baseConfig.cmake
	move_base-config.cmake
  • sudo apt-get install ros-noetic-[패키지명] 해당 패키지 설치
sudo apt-get install ros-noetic-amcl
sudo apt-get install ros-noetic-map-server
sudo apt-get install ros-noetic-move-base
# 원격 컨트롤러 실행
roslaunch stella_teleop stella_teleop_key.launch 
# /usr/bin/env: ‘python’: No such file or directory  에러 발생시
# pyhon3 를 python에 링크
sudo apt install python-is-python3


# 다시 원격 컨트롤러 실행
cjk@ubuntu:~/catkin_ws$ roslaunch stella_teleop stella_teleop_key.launch 
... logging to /home/cjk/.ros/log/3805983a-a38f-11ed-8420-2b95f40b5a17/roslaunch-ubuntu-7522.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://192.168.0.102:33163/

SUMMARY
========

PARAMETERS
 * /rosdistro: noetic
 * /rosversion: 1.15.15

NODES
  /
    stella_teleop_node (stella_teleop/stella_teleop_key.py)

auto-starting new master
process[master]: started with pid [7530]
ROS_MASTER_URI=http://192.168.0.102:11311

setting /run_id to 3805983a-a38f-11ed-8420-2b95f40b5a17
process[rosout-1]: started with pid [7543]
started core service [/rosout]
process[stella_teleop_node-2]: started with pid [7546]

Control Your Stella!
---------------------------
Moving around:
        w
   a    s    d
        x

w/x : increase/decrease linear velocity 
a/d : increase/decrease angular velocity 

space key, s : force stop

CTRL-C to quit

 

이상으로 맥북으로 이동체를 제어하는데 성공하였다.

 

 

+ SLAM 구현

1. 아래 명령어로 gmapping 설치

sudo apt-get install ros-noetic-slam-gmapping

 

2. https://makingrobot.tistory.com/119 따라 cartographer 설치

 

3. 설치 후 설정 내용을 적용

source ~/catkin_ws/install_isolated/setup.bash

4. slam 동작

roslaunch stella_slam stella_slam.launch

SLAM 동작 성공