47 lines
1.8 KiB
Python
47 lines
1.8 KiB
Python
"""full_demo_launch.py - 同时启动所有 11 个节点。
|
|
|
|
节点组合:
|
|
- 2 Publisher(py + cpp)
|
|
- 2 Subscriber(py + cpp)
|
|
- 1 AddTwoInts server
|
|
- 1 Fibonacci server
|
|
- 1 JointState publisher(C++)
|
|
- 1 robot_state_publisher(系统包)
|
|
- 1 TF2 listener(C++)
|
|
- 1 fake_camera(Python)
|
|
- 1 image_processor(Python)
|
|
|
|
总计:11 个 ROS2 节点同时运行。
|
|
"""
|
|
from launch import LaunchDescription
|
|
from launch.actions import IncludeLaunchDescription
|
|
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
|
from launch.substitutions import PathJoinSubstitution
|
|
from launch_ros.substitutions import FindPackageShare
|
|
|
|
|
|
def generate_launch_description() -> LaunchDescription:
|
|
"""生成启动描述:11 节点全开(每个子场景独立 launch)。"""
|
|
pubsub_launch = PathJoinSubstitution([
|
|
FindPackageShare('bringup'), 'launch', 'pubsub_launch.py',
|
|
])
|
|
service_launch = PathJoinSubstitution([
|
|
FindPackageShare('bringup'), 'launch', 'service_launch.py',
|
|
])
|
|
action_launch = PathJoinSubstitution([
|
|
FindPackageShare('bringup'), 'launch', 'action_launch.py',
|
|
])
|
|
robot_launch = PathJoinSubstitution([
|
|
FindPackageShare('bringup'), 'launch', 'robot_launch.py',
|
|
])
|
|
vision_launch = PathJoinSubstitution([
|
|
FindPackageShare('bringup'), 'launch', 'vision_launch.py',
|
|
])
|
|
|
|
return LaunchDescription([
|
|
IncludeLaunchDescription(PythonLaunchDescriptionSource(pubsub_launch)),
|
|
IncludeLaunchDescription(PythonLaunchDescriptionSource(service_launch)),
|
|
IncludeLaunchDescription(PythonLaunchDescriptionSource(action_launch)),
|
|
IncludeLaunchDescription(PythonLaunchDescriptionSource(robot_launch)),
|
|
IncludeLaunchDescription(PythonLaunchDescriptionSource(vision_launch)),
|
|
]) |