raspimouse_navigation_examples
Navigation sample package for Raspberry Pi Mouse V3
README
raspimouse_navigation_examples
Nav2のSimple Commander APIを使用したサンプルパッケージです。
Table of Contents
How To Use Examples
Waypoint Navigation
指定した4つのWaypointに対して順番にナビゲーションを行います。
ナビゲーションのCommander APIは、followWaypoint()
を使用します。
各Waypointへの経路は、直前のWaypoint到達後に次の目標地点ごとに個別に計画されます。
[!NOTE] Waypoint Navigationサンプルで設定している4つのWaypointは、サンプルとしてLake Houseを想定して設定されています。実機動作時は、ナビゲーション対象の環境に合わせたwaypointを指定してください。
raspimouse_navigation_examples/waypoint.py内で、各Waypointの位置姿勢が設定されています。generate_pose()
の引数を変更し、動作環境に合わせた位置姿勢を設定してください。
初期位置
# Initial pose initial_pose = generate_pose(navigator=nav, x=0.0, y=0.0, deg=0.0) nav.setInitialPose(initial_pose)
Waypoints
# Set goal_1 goal_poses = [] goal_pose1 = generate_pose(navigator=nav, x=0.0, y=0.5, deg=90.0) goal_poses.append(goal_pose1) # Set goal_2 goal_pose2 = generate_pose(navigator=nav, x=1.0, y=0.5, deg=0.0) goal_poses.append(goal_pose2) # Set goal_3 goal_pose3 = generate_pose(navigator=nav, x=1.0, y=-0.5, deg=-90.0) goal_poses.append(goal_pose3) # Set goal_4 goal_pose4 = generate_pose(navigator=nav, x=0.0, y=-0.5, deg=180.0) goal_poses.append(goal_pose4)
ナビゲーションを実行した状態で、Remote PC上の新規ターミナルで以下のコマンドを実行します。
ros2 launch raspimouse_navigation_examples example.launch.py example:=waypoint
コマンドを実行すると、指定したWaypointを順に走行します。
90秒以内に最後のWaypointに到達できない場合は初期位置に戻り、180秒経過しても完了しない場合はその場でナビゲーションタスクを終了します。
