全体構成
rogi_launch/launch/rogi_nav.launch.py が、profile YAML を読み込んで各 component launch を組み合わせます。
多くの C++ ノードは rclcpp_components の composable node として実装され、必要に応じて
component_container_mt にロードされます。
example/sample/config/real.yaml と example/sample/config/sim.yaml の
launch.components で、コンポーネント単位またはノード単位に有効/無効を切り替えます。
ノードはパッケージのディレクトリごとに 1 つの component launch から起動します。launch.components の key も同じ対応です。
各パッケージには launch / config を同梱せず、パラメータは example/<example>/config/<component>/ に置きます。
rogi_nav.launch.py は launch をまとめるだけで、ノードを直接起動しません。各 component launch に
config_dir / config_profile / config_file だけを渡して include します。録画用の引数
(record_all / record_output_dir / record_bag_name / record_storage_id)は rosbag_record_all.launch.py が宣言し、
record_all:=true のときは録画を先に開始して component_start_delay を 1 秒に設定します。rogi_nav.launch.py はその値だけ component の起動を遅らせます。
各 component の include は GroupAction(scoped=True) で囲み、component 内(例: simple_sim.launch.py の config_file)で設定された
launch configuration が後続の component に漏れないようにしています(ROS 2 の IncludeLaunchDescription 自体はスコープを持ちません)。
設定の読込と有効/無効の判定は各 component launch が共通モジュール components/component_config.py を使って行うため、
component 単体でも同じ設定で起動できます。
ros2 launch rogi_launch control.launch.py config_dir:=$PWD/example/haru_revenge/config config_profile:=real
ディレクトリ |
component launch |
|
ノード |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(外部パッケージ) |
|
|
|
旧配置の key(launch.components.pure_pursuit.simple_pure_pursuit、launch.components.control.simple_sim、launch.components.control.pose2d_to_odometry)も、
録画時に保存された設定を再利用できるよう引き続き読み込みます。
データの流れは大きく次の順序です。
map_loaderが CSV 地図をrogi_msgs/msg/Mapとして配信し、map_converterが自己位置推定用のOccupancyGridに変換します。実機では
sick_scan_xdが LiDAR scan を出し、scan_mergerが複数 scan をbase_link基準の 1 本の scan に統合します。シミュレーションでは Gazebo 側の scan が同じ後段に入ります。line_detectorが scan 点群から RANSAC で線分を抽出し、選択したransac_localizerが地図線分・観測線分・odom、またはemcl2が占有格子・scan・odom TF を使ってmap上の robot pose を推定します。simple_pure_pursuitが推定 pose と CSV 経路から/cmd_velを生成します。実機では
cmd_vel_to_dcmotor_nodeが/cmd_velを Rogidrive motor command に変換し、wheel_odometryが encoder から/odomを更新します。state_nodeが BehaviorTree を tick し、FollowPathaction を通じて pure pursuit の経路実行順を管理します。
frame は map -> odom -> base_link -> sensor が基本です。統合 launch は localization.method に一致し、かつ enabled の自己位置推定ノードを起動します。両方の enabled が true でも手法は一方が選ばれます。