Try   HackMD
tags: vsclab turtlebot ubuntu ros raspberry pi

TurtleBot3 Setup

文章目錄


🍒Raspberry Pi: connect to the Internet

若使用手機熱點,請將頻寬設定成 2.4 GHz

1. Open Configuration File

$ sudo vim /etc/netplan/50-cloud-init.yaml

2. Edit Configuration File

2-1. For Wi-Fi
  • See Example

  • Multiple SSID Example

    • To select the wifi, first show the wifi list
    ​​​​$ sudo wpa_cli -i wlan0 list_networks
    
    • it will show you the network_id and network_ssid, then select by network_id.
    ​​​​$ sudo wpa_cli -i wlan0 select_network network_id
    
2-2. For Static IP
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
Netplan Example /etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      addresses: [140.116.215.151/27]
      gateway4: 140.116.215.157
      nameservers:
              addresses: [8.8.8.8]
  wifis:
    wlan0:
      dhcp4: yes
      dhcp6: yes
      access-points:
        "VSCLAB":
          password: "VSCLAB-pwd"
    wlan0:
      dhcp4: yes
      dhcp6: yes
      access-points:
         "rubato_phone":
          password: "rubato_phone-pwd"

3. Apply Changes

$ sudo netplan --debug apply # more details
# or
$ sudo netplan apply
# or (for ssh user)
$ sudo netplan try # apply only 120 sec then restore

4. Confirm IP Address

$ ip a  # IP address
$ ip r  # default gateway IP address

5. Check Internet Connectivity in Linux Terminal

Method 1: PING Command
$ ping -c 3 google.com

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Method 2: CURL Command
$ curl -I https://linuxhint.com/

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

固定裝置的 DHCP 位址

每次裝置重新連線時,分享器會再重新分配 IP,導致 ROS IP 也要跟著重新設定 若希望固定 IP 位址,請參考以下教學

1. 查詢 TurtleBot 的 MAC 位址

2. 更改分享器設定

  1. 使用 Wi-Fi 或是有線網路連到分享器
  2. 打開瀏覽器,網址列輸入192.168.1.1
  3. 登入分享器設定(帳密請洽網管)
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  4. DHCP伺服器保留指定IP位址新增
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  5. 系統工具重新開機

SSH Login Automatically

Raspberry Pi 相關

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
電源方面

進行長時間操作建議不要使用電池(例如:更新軟體、重灌系統)

結論: SMPS (12V 5A) 與 Battery (11.1V) 不能同時供電!一次僅能使用一個電源輸入

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Day 2-3 | ROS

Install ROS & ros_menu

  • Official
  • Adlink/ros_menu

    Server 啟動 ros1 遇到 $shell 名稱錯誤問題 /tmp/host_sourcefile.txt:source:3: 沒有此一檔案或目錄: /opt/ros/noetic/setup./usr/bin/zsh

    Solution: 重新定義/proc/$$/cmdline PID執行緒參數

    1. For Terminal
      Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More →
    2. For tmux
      Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More →
  • 連線埠查詢
    ​​​​$ sudo netstat -ntlp
    

Run Example Code

[sensor_msgs/BatteryState] 問題 [ERROR] [1642758400.659716]: Creation of publisher failed: Checksum does not match: 4ddae7f048e32fda22cac764685e3974,476f837fa6771f6e16e3bf4ef96f8770 Solution: OpenCR 的版本必須與 PC 的 ROS 相同

ROS 2 foxy for TB3

Install ros2 & ros_menu on SBC

Communicate with Windows using PuTTY

  • Download PuTTY
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

如何在 PuTTY 對 tmux 視窗貼上 Solution: Press shift

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
Communicate with Windows using Bitvise SSH

MATLAB ROS Toolbox

Joysticks x Raspberry Pi

Wiring PS3

Wireless PS2

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

GPIO Library Installation

由於 GPIO 原作者 Gordon 已不再維護,請使用 git clone https://github.com/WiringPi/WiringPi

Xbox

ROS Library

Pi Camera Module install on TB3 burger

Hardware Installation Tutorial

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

System Settings

Install raspi-config

$ git clone https://github.com/EmilGus/install_raspi-config
$ cd install_raspi-config
$ sudo sh install.sh

Enable Camera Module

[Your firmware appears to be out of date (no start_x.elf). Please update] 問題 Solution: 树莓派通过raspi-config启动摄像头时,出错:Your firmwave appears to be out of date (no start_x.elf). Please update

$ df -h
$ sudo mount /dev/mmcblk0p1 /boot
$ sudo raspi-config

Take a photo

Camera Module with Raspberry Pi4

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

$ vcgencmd get_camera
> supported=1 detected=1 # success
$ ls /dev/video*

# raspistill
$ sudo apt install libraspberrypi-bin
$ raspistill -v
$ sudo modprobe bcm2835-v4l2
$ sudo raspistill -o test.jpg

# fswebcam
$ sudo apt-get install fswebcam
$ sudo fswebcam image.jpg
$ sudo fswebcam /dev/video10 image.jpg

Use ROS

Install ROS Package raspicam (TurtleBot)

Run raspicam Node