feat(level1): ROS2 完全体 12 包 / 80 测试 / 23 文档 / 工程化 / Docker 分组
This commit is contained in:
@@ -1,35 +1,47 @@
|
||||
"""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 节点同时运行。
|
||||
"""
|
||||
full_demo_launch.py —— 整合所有 demo(全套启动)。
|
||||
|
||||
启动的节点:
|
||||
- 4 个 pub/sub 节点(pubsub)
|
||||
- add_two_ints server(srv)
|
||||
- fibonacci action server(action)
|
||||
- 3 节点 URDF TF2(robot)
|
||||
- fake_camera + image_processor(vision)
|
||||
|
||||
总计 ~10 个节点同时运行,展示整个 ROS2 通信栈。
|
||||
"""
|
||||
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import IncludeLaunchDescription
|
||||
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||||
from launch_ros.substitutions import FindPackageShare
|
||||
from launch.substitutions import PathJoinSubstitution
|
||||
from launch_ros.substitutions import FindPackageShare
|
||||
|
||||
|
||||
def _include(pkg_name, launch_file):
|
||||
pkg = FindPackageShare(pkg_name)
|
||||
path = PathJoinSubstitution([pkg, 'launch', launch_file])
|
||||
return IncludeLaunchDescription(PythonLaunchDescriptionSource(path))
|
||||
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',
|
||||
])
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
return LaunchDescription([
|
||||
_include('py_pubsub', 'pubsub_launch.py'),
|
||||
_include('cpp_pubsub', 'pubsub_launch.py'),
|
||||
_include('py_srv', 'srv_launch.py'),
|
||||
_include('py_action_demo', 'action_launch.py'),
|
||||
_include('cpp_robot_tf2', 'robot_tf2_launch.py'),
|
||||
_include('py_vision_demo', 'vision_launch.py'),
|
||||
IncludeLaunchDescription(PythonLaunchDescriptionSource(pubsub_launch)),
|
||||
IncludeLaunchDescription(PythonLaunchDescriptionSource(service_launch)),
|
||||
IncludeLaunchDescription(PythonLaunchDescriptionSource(action_launch)),
|
||||
IncludeLaunchDescription(PythonLaunchDescriptionSource(robot_launch)),
|
||||
IncludeLaunchDescription(PythonLaunchDescriptionSource(vision_launch)),
|
||||
])
|
||||
Reference in New Issue
Block a user