以下を$HOME/ros2_setup.bash
に記載する
#
# ROS2
#
source /opt/ros/humble/setup.bash
source /home/itohemon/microros_ws/install/setup.bash
source /home/itohemon/ros2_ws/install/setup.bash
export PICO_SDK_PATH=/home/itohemon/pico-sdk
zennの記事 を参考にセットアップする
zennの記事を参考にセットアップする
mkdir ~/tmp
cd ~/tmp
git clone https://github.com/joan2937/pigpio.git
cd pigpio
mkdir build
cd build
cmake ..
make
sudo make install
sudo vi /lib/systemd/system/pigpiod.service
ファイルの中身は以下。
[Unit]
Description=Pigpio daemon
[Service]
Type=forking
PIDFile=pigpio.pid
ExecStart=/usr/local/bin/pigpiod -l -n 127.0.0.1 -s 10
ExecStop=/usr/bin/systemctl kill pigpiod
[Install]
WantedBy=multi-user.target
起動確認。
sudo systemctl enable pigpiod
sudo systemctl start pigpiod
sudo systemctl status pigpiod
リブートして ps
コマンドでpigpiodが立ち上がってるか確認する。
[参照] (https://qiita.com/mashi0727/items/1e25c4eea511968066ca)
cd ~/ros2_ws/src/cylinder_ros2/
mkdir build
cd build
cmake ..
make
コンパイル完了したら、RaspberryPiPicoをUbuntuから見えるよう以下実行
- BOOTSELを押しながらUSB接続
- BOOTSELを離す
Picoが自動マウントされるのでマウント先に.uf2ファイルをコピーする
cp cylinder_ros2_pico_micro_ros.uf2 /media/$USER/RPI-RP2
ros2 launch cylinder_ros2 cylinder.launch.py
あるいは
ros2 launch cylinder_ros2 cylinder_withIMU.launch.py
terminal#2
ros2 launch cylinder_ros2 online_async_launch.py
terminal#3
cd /home/ubuntu/ros2_ws/src/cylinder_ros2/cmd
./map_save.sh <mapname>
terminal#3
ros2 launch cylinder_ros2 navigation2.launch.py