- ROS 2 Humble
- JetPack 6
- torch 2.2.0a0+6a974be
- torchvision 0.16.2
- 必要なパッケージをインストールする
sudo apt install ros-$ROS_DISTRO-joy* ros-$ROS_DISTRO-async-web-server-cpp pip install pykeigan-motor onnx ultralytics
- src にパッケージをクローンする
git clone https://github.com/satokazlab/robot_platoon.git src
- モーターの ID を変更する
vi src/keigan_motor/config/parameter.yaml
- パッケージをビルドする
colcon build --symlink-install source install/local_setup.bash
- 物体検出処理を立ち上げる
- カメラと物体検出ノードを分ける場合
ros2 launch object_detection yolov8_and_camera.launch.py
- カメラと物体検出ノードをまとめる場合
ros2 launch object_detection yolov8_with_camera.launch.py
- パラメータ
- camera_count
- 型:int
- デフォルト:1
- model
- 型:str
- デフォルト:nano_10000.pt
- confidence_threshold
- 型:float
- 範囲:0 ~ 1.0
- デフォルト:0.7
- intersection_over_union
- 型:float
- 範囲:0 ~ 1.0
- デフォルト:0.7
- device:
- 型:str
- 範囲:cpu, cuda:0, cuda:1
- デフォルト:cuda:0
- max_detection:
- 型:int
- デフォルト:25
- show_log
- 型:bool
- デフォルト:False
- camera_count
- カメラと物体検出ノードを分ける場合
- 検出結果を確認する
ros2 run rqt_image_view rqt_image_view
- Keigan モーターを起動する
ros2 launch keigan_motor motor.launch.py
- コントローラーを使う場合
ros2 launch keigan_motor joystick_and_motor.launch.py
- コントローラーを使う場合
- 以下のメッセージが出力されたら、正常に動いてる
[motor_node]: Initializing motors ... [motor_node]: All status normal
- 実行ファイルに権限を与える
sudo chmod +x src/auto_start.sh
- ファイルパスを取得する
readlink -f src/auto_start.sh
- 起動時に自動的に実行する設定を行う
sudo vi /etc/systemd/system/platoonsystem.service
- 一番下の行に以下を追加する
[Unit] Description=Start ros program [Service] WorkingDirectory=/home/<ユーザー> User=<ユーザー> ExecStart=<ファイルパス> [Install] WantedBy=multi-user.target
- 一番下の行に以下を追加する
- 設定を有効にする
sudo systemctl enable platoonsystem.service sudo systemctl start platoonsystem.service