0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

TurtleBot3にミニPCを搭載した際のセットアップ

Posted at

はじめに

TurtleBot3にラズパイではなくミニPCを搭載し,RvizなどもこのPCで動かしたいときのセットアップ方法です.

ROS 2 Humbleのインストール

「Try some examples」の実行まで

TurtleBot3のセットアップ

PCのセットアップ

「Humble」を選択

SBCのセットアップ

通常ラズパイが使用されるSBCの役割をミニPCに担わせます.
必要であろうコマンドを実行していきます.

  1. Enter the command below to edit automatic update setting file.

    sudo vi /etc/apt/apt.conf.d/20auto-upgrades
    
  2. Change the update settings as below.

    /etc/apt/apt.conf.d/20auto-upgrades
    APT::Periodic::Update-Package-Lists "0";
    APT::Periodic::Unattended-Upgrade "0";
    
  3. Set the systemd to prevent boot-up delay even if there is no network at startup. Run the command below to set mask the systemd process using the following command.

    systemctl mask systemd-networkd-wait-online.service
    
  4. Disable Suspend and Hibernation

    sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
    
  5. Reboot the Raspberry Pi.

    reboot
    
  6. Install and Build ROS Packages.

    Building the turtlebot3 package may take longer than an hour. Please use the SMPS to ensure the system is always powered.

    sudo apt install python3-argcomplete python3-colcon-common-extensions libboost-system-dev build-essential
    sudo apt install ros-humble-hls-lfcd-lds-driver
    sudo apt install ros-humble-turtlebot3-msgs
    sudo apt install ros-humble-dynamixel-sdk
    sudo apt install libudev-dev
    mkdir -p ~/turtlebot3_ws/src && cd ~/turtlebot3_ws/src
    #git clone -b humble https://github.com/ROBOTIS-GIT/turtlebot3.git
    git clone -b humble https://github.com/ROBOTIS-GIT/ld08_driver.git
    cd ~/turtlebot3_ws/src/turtlebot3
    rm -r turtlebot3_cartographer turtlebot3_navigation2
    cd ~/turtlebot3_ws/
    #echo 'source /opt/ros/humble/setup.bash' >> ~/.bashrc
    source ~/.bashrc
    colcon build --symlink-install --parallel-workers 1
    #echo 'source ~/turtlebot3_ws/install/setup.bash' >> ~/.bashrc
    source ~/.bashrc
    
  7. USB Port Setting for OpenCR

    sudo cp `ros2 pkg prefix turtlebot3_bringup`/share/turtlebot3_bringup/script/99-turtlebot3-cdc.rules /etc/udev/rules.d/
    sudo udevadm control --reload-rules
    sudo udevadm trigger
    

OpenCRのセットアップ

の3〜6

  1. Arduino IDEのインストール

    • 「2. Install Arduino IDE.」は

      wget -P ~/Downloads https://downloads.arduino.cc/arduino-1.8.19-linux64.tar.xz
      tar xvf ~/Downloads/arduino-1.8.19-linux64.tar.xz
      mkdir -p ~/.local
      mv arduino-1.8.19 ~/.local
      cd ~/.local/arduino-1.8.19
      bash arduino-linux-setup.sh $USER
      sudo systemctl reboot
      

      再起動後

      cd ~/.local/arduino-1.8.19
      sudo bash install.sh
      

      https://qiita.com/ma2shita/items/927aa9e55962b4137518

    • 「6. Open the TurtleBot3 firmware.」以降は Setup DYNAMIXELs for TurtleBot3 を参考に進める

      • 「Tools > Board > Boards Manager」で「OpenCR」と検索し,バージョン 1.5.2 をインストール
      • 「Tools > Board」を "OpenCR Board",「Tools > Port」を "/dev/ttyACM0"に設定
  2. OpenCR Test

    1. Upload firmware to the OpenCR.

      cd ~/opencr_update
      ./update.sh $OPENCR_PORT $OPENCR_MODEL.opencr
      
    2. A successful firmware upload for TurtleBot3 Burger will look like below.

    を行った後に「3.3.1. OpenCR Test」

Bringup

「Dynamixel」モーターなどのエラーが出ているときは「OpenCR Test」を再実行

Bringup TurtleBot3

export TURTLEBOT3_MODEL=waffle_pi
ros2 launch turtlebot3_bringup robot.launch.py

Rviz

ros2 launch turtlebot3_bringup rviz2.launch.py  

Teleoperation

Bringupした状態で

  • キーボード

    export TURTLEBOT3_MODEL=waffle_pi
    ros2 run turtlebot3_teleop teleop_keyboard
    
  • リモコン

Topic Monitor

rqt

LiDARのセットアップ

1. パッケージをクローン・ビルド

mkdir -p ~/ros2_ws/src

cd ~/ros2_ws/src
git clone https://github.com/Slamtec/sllidar_ros2.git

cd ~/ros2_ws
source /opt/ros/humble/setup.bash
colcon build --symlink-install

2. 権限を付与

ls -l /dev | grep ttyUSB
sudo chmod 666 /dev/ttyUSB0

LiDARと接続するUSBを抜き差ししながら ls -l /dev | grep ttyUSB を実行するとデバイスを確認できます

3. Rvizで確認

source ~/ros2_ws/install/setup.bash
ros2 launch sllidar_ros2 view_sllidar_s3_launch.py
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?