Skip to content

Wiki

Launch与包依赖配置

About 3 min read

Existing English translations were reused. 8 current source blocks remain in Simplified Chinese, without triggering paid translation.

1.Launch与包依赖配置

Modify the launch redirection to point to our model; focus primarily on the launch below:

  • pb2025_nav_bringupinrm_navigation_reality_launch.py

    • under the same functional packagerobot_state_publisher_launch.py
  • rmu_gazebo_simulatorinbringup_sim.launch.py

    • under the same functional packagespawn_robots.launch.py
    • under the same functional packagepackage.xml
  • robot_descriptioninrobot_description_launch.py

1.1.robot_state_publisher_launch.py(机器人关节TF发布入口)

    pkg_pb2025_robot_description_dir = get_package_share_directory(
        "pb2025_robot_description"
    )

    declare_robot_name_cmd = DeclareLaunchArgument(
        "robot_name",
        default_value="pb2025_sentry_robot",
        description="The file name of the robot xmacro to be used",
    )

Change to

    pkg_robot_description_dir = get_package_share_directory(
        "robot_description"
    )

    declare_robot_name_cmd = DeclareLaunchArgument(
        "robot_name",
        default_value="reality_robot",
        description="The file name of the robot xmacro to be used",
    )

1.2.spawn_robots.launch.py(生成仿真机器人)

    pkg_pb2025_robot_description = get_package_share_directory(
        "pb2025_robot_description"
    )

    robot_xmacro_path = os.path.join(
        pkg_pb2025_robot_description,
        "resource",
        "xmacro",
        "simulation_robot.sdf.xmacro",
    )

Change to:

    pkg_robot_description = get_package_share_directory(
        "robot_description"
    )

    robot_xmacro_path = os.path.join(
        pkg_robot_description,
        "resource",
        "xmacro",
        "simulation_robot.sdf.xmacro",
    )

1.3.robot_description_launch.py(机器人模型加载入口)

def generate_launch_description():
    # Get the launch directory
    bringup_dir = get_package_share_directory("pb2025_robot_description")

Change to

def generate_launch_description():
    # Get the launch directory
    bringup_dir = get_package_share_directory("robot_description")

1.4.pb2025_nav_bringup里的package.xml(导航启动包依赖)

This package's robot_state_publisher_launch.py loads robot_description; therefore, add the runtime dependency:

<exec_depend>robot_description</exec_depend>

robot_state_publisher_launch.py defaults to reality_robot; the description package’s own robot_description_launch.py still defaults to simulation_robot. Gazebo’s spawn_robots.launch.py continues to load simulation_robot.sdf.xmacro.

1.5.rmu_gazebo_simulator里的package.xml(仿真包依赖)

<depend>pb2025_robot_description</depend>

Change to

<depend>robot_description</depend>

1.6.test

rm -rf build install log
colcon build --symlink-install
source install/setup.bash
ros2 launch rmu_gazebo_simulator bringup_sim.launch.py
source install/setup.bash

ros2 launch pb2025_nav_bringup rm_navigation_simulation_launch.py \
  world:=rmuc_2025 \
  slam:=False

Test whether Gazebo still loads the model normally; if it does, that means there is no problem.

This concludes everything.