Skip to content

JinYien/robot_platoon

Repository files navigation

環境

  • ROS 2 Humble
  • JetPack 6
  • torch 2.2.0a0+6a974be
  • torchvision 0.16.2

セットアップ

  1. 必要なパッケージをインストールする
    sudo apt install ros-$ROS_DISTRO-joy* ros-$ROS_DISTRO-async-web-server-cpp
    pip install pykeigan-motor onnx ultralytics
    
  2. src にパッケージをクローンする
    git clone https://github.com/satokazlab/robot_platoon.git src
    
  3. モーターの ID を変更する
    vi src/keigan_motor/config/parameter.yaml
    
  4. パッケージをビルドする
    colcon build --symlink-install
    source install/local_setup.bash
    
  5. 物体検出処理を立ち上げる
    • カメラと物体検出ノードを分ける場合
      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
  6. 検出結果を確認する
    ros2 run rqt_image_view rqt_image_view
    
  7. Keigan モーターを起動する
    ros2 launch keigan_motor motor.launch.py
    
    • コントローラーを使う場合
      ros2 launch keigan_motor joystick_and_motor.launch.py
      
  8. 以下のメッセージが出力されたら、正常に動いてる
    [motor_node]: Initializing motors ...
    [motor_node]: All status normal
    

起動時の自動実行(任意)

  1. 実行ファイルに権限を与える
    sudo chmod +x src/auto_start.sh
    
  2. ファイルパスを取得する
    readlink -f src/auto_start.sh
    
  3. 起動時に自動的に実行する設定を行う
    sudo vi /etc/systemd/system/platoonsystem.service
    
    • 一番下の行に以下を追加する
      [Unit]
      Description=Start ros program
      
      [Service]
      WorkingDirectory=/home/<ユーザー>
      User=<ユーザー>
      ExecStart=<ファイルパス>
      
      [Install]
      WantedBy=multi-user.target
      
      
  4. 設定を有効にする
    sudo systemctl enable platoonsystem.service
    sudo systemctl start platoonsystem.service
    

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published