Bye Bye Moore

PoCソルジャーな零細事業主が作業メモを残すブログ

ODYSSEY X86J4105864を初期化しUbuntu 22LTSとROS2 humbleを入れる

実際のところ

USBストレージにubuntu 22 LTSの日本語版をいれる

Live USB入れて 電源ボタン長押し + F7

ログイン後の処理

リモート環境の構築
$ sudo apt update
$ sudo apt upgrade -y
$ sudo apt install -y openssh-server avahi-daemon
$ sudo systemctl start ssh
$ sudo systemctl enable ssh

$ sudo systemctl start avahi-daemon
$ sudo systemctl enable avahi-daemon

sshとmDNS用のポートを有効化

sudo ufw allow ssh
sudo ufw allow mdns

ROS2の環境構築

ここからはリモートで
日本語LTSで入れてるのでja.UTF-8になっています

$ locale
LANG=ja_JP.UTF-8
LANGUAGE=
LC_CTYPE="ja_JP.UTF-8"
LC_NUMERIC="ja_JP.UTF-8"
LC_TIME="ja_JP.UTF-8"
LC_COLLATE="ja_JP.UTF-8"
LC_MONETARY="ja_JP.UTF-8"
LC_MESSAGES="ja_JP.UTF-8"
LC_PAPER="ja_JP.UTF-8"
LC_NAME="ja_JP.UTF-8"
LC_ADDRESS="ja_JP.UTF-8"
LC_TELEPHONE="ja_JP.UTF-8"
LC_MEASUREMENT="ja_JP.UTF-8"
LC_IDENTIFICATION="ja_JP.UTF-8"
LC_ALL=

リポジトリにコミュニティメンテのUniverseを追加

$ sudo apt install software-properties-common
$ sudo add-apt-repository universe

リポジトリ用のGPGキーを追加
ダウンロードにcurlを入れるので、それもついでに

sudo apt update && sudo apt install curl -y
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 $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

リポジトリを反映し、ROS2-humbleのデスクトップ版を導入。

$ sudo apt update && sudo apt upgrade -y
$ sudo apt install ros-humble-desktop -y
 echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
ROS2 humble動作確認
ros2 run demo_nodes_cpp talker

[INFO] [1693719697.285535717] [talker]: Publishing: 'Hello World: 1'
[INFO] [1693719698.285476613] [talker]: Publishing: 'Hello World: 2'
[INFO] [1693719699.285508438] [talker]: Publishing: 'Hello World: 3'
[INFO] [1693719700.285522392] [talker]: Publishing: 'Hello World: 4'
[INFO] [1693719701.285511647] [talker]: Publishing: 'Hello World: 5'
[INFO] [1693719702.285094371] [talker]: Publishing: 'Hello World: 6'
[INFO] [1693719703.285501864] [talker]: Publishing: 'Hello World: 7'
...
[INFO] [1693719716.285129524] [talker]: Publishing: 'Hello World: 20'
[INFO] [1693719717.285087722] [talker]: Publishing: 'Hello World: 21'
[INFO] [1693719718.285337326] [talker]: Publishing: 'Hello World: 22'
[INFO] [1693719719.285143746] [talker]: Publishing: 'Hello World: 23'
[INFO] [1693719720.285105324] [talker]: Publishing: 'Hello World: 24'
[INFO] [1693719721.285345898] [talker]: Publishing: 'Hello World: 25'
[INFO] [1693719722.285059046] [talker]: Publishing: 'Hello World: 26'
[INFO] [1693719723.285343916] [talker]: Publishing: 'Hello World: 27'
...

別の端末で読み取り

$ ros2 run demo_nodes_py listener
[INFO] [1693719717.326701741] [listener]: I heard: [Hello World: 21]
[INFO] [1693719718.288781420] [listener]: I heard: [Hello World: 22]
[INFO] [1693719719.288851957] [listener]: I heard: [Hello World: 23]
[INFO] [1693719720.288178508] [listener]: I heard: [Hello World: 24]
[INFO] [1693719721.289447045] [listener]: I heard: [Hello World: 25]
^C