์ˆ˜์„ ํ™”

[ROS2/Dashing][JetsonNano] Ubuntu 18.04์—์„œ ROS2 Dashing ์„ค์น˜ ๋ณธ๋ฌธ

๐Ÿง Ubuntu/ROS2

[ROS2/Dashing][JetsonNano] Ubuntu 18.04์—์„œ ROS2 Dashing ์„ค์น˜

re.aom 2023. 8. 14. 20:25

 

 

Python3๋กœ ๋ฒ„์ „ ๋ณ€๊ฒฝ

 

JetsonNano๋Š” Python2 ๋ฒ„์ „์ด ๋””ํดํŠธ์—ฌ์„œ
Python3 ์œผ๋กœ ๋ฒ„์ „์„ ๋จผ์ € ๋ณ€๊ฒฝํ•˜๊ณ  Dashing ์„ค์น˜๋ฅผ ์ง„ํ–‰ํ•˜์˜€๋‹ค

 

1. ํŒŒ์ด์ฌ ๋ฒ„์ „ ํ™•์ธ

$ python -V

๋งŒ์•ฝ ์—ฌ๊ธฐ์„œ 3๋ฒ„์ „์ด ๋œฌ๋‹ค๋ฉด ์Šคํ‚ตํ•ด๋„ ๋ฌด๋ฐฉํ•˜๋‹ค

 

2. ํŒŒ์ด์ฌ ์œ„์น˜ ํ™•์ธ

$ which python
$ ls -al /usr/bin/python

ํŽธํ•œ๊ฑธ๋กœ ํ™•์ธ์„ ํ•ด์ฃผ๋ฉด ๋œ๋‹ค

 

3. ์„ค์น˜๋œ ํŒŒ์ด์ฌ ํ™•์ธ

$ ls /usr/bin/ | grep python

 

4. alternatives์— ๋“ฑ๋ก๋œ ํŒŒ์ด์ฌ์ด ์žˆ๋Š”์ง€ ํ™•์ธ

$ sudo update-alternatives --config python

 

๋งŒ์•ฝ update-alternatives: error: no alternatives for python ๊ฐ€ ์ถœ๋ ฅ๋˜์—ˆ๋‹ค๋ฉด
๋“ฑ๋ก๋œ ๋ฒ„์ „์ด ์—†๋‹ค๋Š” ๊ฒƒ์ด๋ฏ€๋กœ alternatives์— ํŒŒ์ด์ฌ์„ ๋“ฑ๋กํ•œ๋‹ค

 

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2

/usr/bin/python2.7 1์€ python2.7์„ 1๋ฒˆ์œผ๋กœ, /usr/bin/python3.6์€ python3.6์„ 2๋ฒˆ์œผ๋กœ ๋“ฑ๋กํ•œ๋‹ค๋Š” ์˜๋ฏธ๋‹ค

๋‚˜๋Š” 2.7๊ณผ 3.6์ด ๊ธฐ๋ณธ์œผ๋กœ ์„ค์น˜๋˜์–ด์žˆ์–ด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋“ฑ๋กํ–ˆ๋‹ค
๋งŒ์•ฝ ๋‹ค๋ฅธ ๋ฒ„์ „์ด ์žˆ๋‹ค๋ฉด ๋ฒ„์ „์„ ๋ฐ”๊ฟ” ๋“ฑ๋กํ•˜๋ฉด ๋œ๋‹ค

5. ํŒŒ์ด์ฌ ๋ฒ„์ „ ๋ณ€๊ฒฝ

$ sudo update-alternatives --config python

๋‚˜๋Š” 3.x ๋ฒ„์ „์„ ์‚ฌ์šฉํ•ด์•ผํ•˜๊ธฐ ๋•Œ๋ฌธ์— 3.6 ๋ฒ„์ „์„ ๋“ฑ๋กํ•œ 2๋ฒˆ์„ ์„ ํƒํ–ˆ๋‹ค

 

$ python -V

๋‹ค์Œ ๋ช…๋ น์–ด ์‚ฌ์šฉ ํ›„ ํŒŒ์ด์ฌ ๋ฒ„์ „์ด ๋ณ€๊ฒฝ๋˜์—ˆ๋‹ค๋ฉด ์„ฑ๊ณต

 

 

 

 

 

Ubuntu18.04์— ROS2 Dashing Install

 

JetsonNano๋Š” Ubuntu18.04๋งŒ ์ง€์›ํ•˜๊ธฐ ๋•Œ๋ฌธ์—
Ubuntu18.04 ๋ฒ„์ „์— ๋งž๋Š” ROS2 Dashing์„ ์„ค์น˜

 

 

 

ROS1์€ Kinetic์ด, ROS2๋Š” Dashing์ด ์—ฌ๋Ÿฌ๊ฐ€์ง€ ์‹คํ—˜ํ•˜๊ธฐ์— ์ข‹์€ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค

 

 

 

1. ์ง€์—ญ ์„ค์ •

$ sudo apt update && sudo apt install locales
$ sudo locale-gen en_US en_US.UTF-8
$ sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
$ export LANG=en_US.UTF-8

 

 

 

2. Key๊ฐ’ ์ถ”๊ฐ€

$ sudo apt update && sudo apt install curl gnupg2 lsb-release
$ sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key  -o /usr/share/keyrings/ros-archive-keyring.gpg
$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

 

 

 

3. ๊ฐœ๋ฐœ์— ํ•„์š”ํ•œ ํŒจํ‚ค์ง€ ์„ค์น˜

$ sudo apt update && sudo apt install -y \
  build-essential \
  cmake \
  git \
  libbullet-dev \
  python3-colcon-common-extensions \
  python3-flake8 \
  python3-pip \
  python3-pytest-cov \
  python3-rosdep \
  python3-setuptools \
  python3-vcstool \
  wget
$ python3 -m pip install -U \
  argcomplete \
  flake8-blind-except \
  flake8-builtins \
  flake8-class-newline \
  flake8-comprehensions \
  flake8-deprecated \
  flake8-docstrings \
  flake8-import-order \
  flake8-quotes \
  pytest-repeat \
  pytest-rerunfailures \
  pytest
$ sudo apt install --no-install-recommends -y \
  libasio-dev \
  libtinyxml2-dev \
  libcunit1-dev

 

 

 

4. Dashing ์„ค์น˜ 

์—ฌ๊ธฐ์„œ๋ถ€ํ„ฐ ์ž‘์—…์€ Turtlebot3 emanual Dashing ์˜ ๋‚ด์šฉ๊ณผ ๊ฐ™๋‹ค

 

  • .bashrc์— ์Šคํฌ๋ฆฝํŠธ ๋‚ด์šฉ ์ถ”๊ฐ€
$ sudo apt-get update
$ sudo apt-get upgrade
$ wget https://raw.githubusercontent.com/ROBOTIS-GIT/robotis_tools/master/install_ros2_dashing.sh
$ chmod 755 ./install_ros2_dashing.sh
$ bash ./install_ros2_dashing.sh

 

 

  • Gazebo9 ์„ค์น˜
$ curl -sSL http://get.gazebosim.org | sh
$ sudo apt remove gazebo11 libgazebo11-dev
$ sudo apt install gazebo9 libgazebo9-dev
$ sudo apt install ros-dashing-gazebo-ros-pkgs

 

  • Cartographer
$ sudo apt install ros-dashing-cartographer
$ sudo apt install ros-dashing-cartographer-ros

 

  • Navigation2 ์„ค์น˜
$ sudo apt install ros-dashing-navigation2
$ sudo apt install ros-dashing-nav2-bringup

 

  • TurtleBot3 ํŒจํ‚ค์ง€ ์„ค์น˜
$ source /opt/ros/dashing/setup.bash
$ sudo apt install ros-dashing-dynamixel-sdk
$ sudo apt install ros-dashing-turtlebot3-msgs
$ sudo apt install ros-dashing-turtlebot3

 

 

๋งŒ์•ฝ ๋””ํ…Œ์ผํ•œ ํŒจํ‚ค์ง€ ์„ค์น˜๋ฅผ ํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด, ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ง„ํ–‰ํ•˜๋ฉด ๋œ๋‹ค

$ sudo apt remove ros-dashing-turtlebot3-msgs
$ sudo apt remove ros-dashing-turtlebot3
$ mkdir -p ~/turtlebot3_ws/src
$ cd ~/turtlebot3_ws/src/
$ git clone -b dashing-devel https://github.com/ROBOTIS-GIT/DynamixelSDK.git
$ git clone -b dashing-devel https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
$ git clone -b dashing-devel https://github.com/ROBOTIS-GIT/turtlebot3.git
$ cd ~/turtlebot3_ws
$ colcon build --symlink-install
$ source ~/.bashrc

e-manual์—์„œ๋Š” src ๋””๋ ‰ํ„ฐ๋ฆฌ์— git clone์„ ํ•œ ๋’ค src ๋””๋ ‰ํ„ฐ๋ฆฌ์—์„œ colcon build๋ฅผ ํ•˜๋Š” ๊ฒƒ ์ฒ˜๋Ÿผ ์ ํ˜€์žˆ์ง€๋งŒ,
์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ๋ฌด์กฐ๊ฑด ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜๋‹ˆ ๊ผญ src์˜ ์ƒ์œ„ ๋””๋ ‰ํ„ฐ๋ฆฌ์—์„œ colcon build๋ฅผ ์ž‘์—…ํ•ด์•ผํ•œ๋‹ค

์ด๊ฑฐ๋•Œ๋ฌธ์— ์ ฏ์Šจ๋‚˜๋…ธ 3๋ฒˆ ํฌ๋งทํ–ˆ๋‹ค

 

  • ํ™˜๊ฒฝ ๊ตฌ์„ฑ
$ echo 'source ~/turtlebot3_ws/install/setup.bash' >> ~/.bashrc
$ echo 'export ROS_DOMAIN_ID=30 #TURTLEBOT3' >> ~/.bashrc
$ source ~/.bashrc

 

๋งŒ์•ฝ TurtleBot3 ์„ค์น˜๋ฅผ git clone์ด ์•„๋‹Œ apt install์„ ์‚ฌ์šฉํ•˜์—ฌ ์„ค์น˜ํ–ˆ์„ ๊ฒฝ์šฐ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์—๋Ÿฌ๊ฐ€ ๋œฐ ์ˆ˜ ์žˆ๋‹ค๋Š” ๋“ฏ?

bash: /home/{$YOUR_ACCOUNT}/turtlebot3_ws/install/setup.bash: No such file or directory

 

์•ฝ ๋ฐ˜๋…„๋™์•ˆ JetsonNano๋ฅผ ์‚ฌ์šฉํ•˜๋ฉฐ ๊ฑฐ์˜ 20๋ฒˆ ๊ฐ€๊นŒ์ด ์ดˆ๊ธฐํ™”๋ฅผ ์ง„ํ–‰ํ–ˆ๋˜ ๊ฒƒ ๊ฐ™์€๋ฐ
๋” ์ด์ƒ ํ•˜๊ธฐ ํž˜๋“ค์–ด์„œ ๋‚˜๋Š” ๋””ํ…Œ์ผํ•œ ํŒจํ‚ค์ง€ ์„ค์น˜๋กœ ์ง„ํ–‰ํ•˜์˜€๋‹ค.

 

 

 

 

 

Comments