Atlas Robotics
Lesson 5/6 · about 25 min

Read and understand the launch file

Each command ros2 launch of M01 is a Python file in directory launch/ of the package. Reading it means knowing which node the command starts, with what parameters, and which configuration file it reads.

Can you point out: which file was created by node /fastlio2_body_to_base in lesson 1, and why x:=-6.0 passed to bringup.launch.py reached the robot spawn place.

Bringup: four nested files

  • atlas3d_bringup/launch/bringup.launch.py
    • rviz2 if rviz:=true, configure rviz/sim3d.rviz
    • atlas3d_control/launch/controller.launch.py
      • spawner joint_state_broadcaster
      • spawner diff_drive_controller wheel_odom_tf:=false → add config/no_wheel_odom_tf.yaml
      • atlas3d_gazebo/launch/spawn_robot.launch.py
        • ign gazebo via ros_gz_sim gz_sim.launch.py; headless:=true → -s --headless-rendering
        • robot_state_publisher URDF = xacro atlas3d.control.xacro
        • ros_gz_sim create spawn robot at SPAWN_POSES[world] or x/y/z/yaw, then exit
        • ros_gz_bridge parameter_bridge config/gz_bridge.yaml
        • imu_filter_node

Each file just IncludeLaunchDescription the file immediately below it and add your own part, do not rewrite. spawner and create are programs that finish running and exit, so they are not in ros2 node list. controller_manager, gz_ros2_control, diff_drive_controller live inside the Gazebo process (plugin gz_ros2_control in URDF).

Parameters go down to subfiles

ros2 launch atlas3d_bringup bringup.launch.py --show-args
Arguments (pass arguments as '<name>:=<value>'):

    'world':
        File world trong atlas3d_gazebo/worlds: empty, warehouse, corridor, ramp, terrain, parking (.sdf)
        (default: 'terrain.sdf')
    'headless': ...
    'wheel_odom_tf': ...
    'rviz': ...

bringup.launch.py only declares 4 parameters. But x:=-6.0 y:=2.0 z:=0.40 in lesson 3 can still place the robot in the middle of the slope, because the parameter of ros2 launch is common to the entire included file tree. spawn_robot.launch.py declares x, y, z, yaw and reads that value. See all parameters of subfile:

ros2 launch atlas3d_gazebo spawn_robot.launch.py --show-args

fastlio2.launch.py: one file, three modes

mode:=NodeConfiguration
pgo (default)lio_node, fastlio2_body_to_base, pgo_nodefastlio2_vlp16.yaml, fastlio2_pgo.yaml
localizationlio_node, fastlio2_body_to_base, localizer_node, relocalize.pyfastlio2_vlp16.yaml, fastlio2_localizer.yaml + map_path, pose_file
mappinglio_node, fastlio2_body_to_base, voxel_map_node, static TF map → odomJust to test FAST-LIO2 without PGO

All three have lio_node and static TF body → base_footprint (code snippet below); just different from transmitter block map → odom. Therefore, do not run two modes at the same time: two nodes broadcast map → odom.

# src/atlas3d_slam/launch/fastlio2.launch.py
nodes = [Node(package="fastlio2", executable="lio_node", namespace="fastlio2",
              parameters=[common, {"config_path": config}], output="screen"),
         Node(package="tf2_ros", executable="static_transform_publisher",
              name="fastlio2_body_to_base",
              arguments=["--z", str(-BODY_HEIGHT), "--frame-id", "body", "--child-frame-id", "base_footprint"],
              parameters=[common])]

namespace="fastlio2" is the reason the node is named /fastlio2/lio_node and the topic is /fastlio2/lio_odom.

navigation.launch.py: reuse localization

  1. Check nav_map.yaml: not available or older than map.pcd, then run pcd_to_navmap.py right during launch (statistics line in M01, article 4).
  2. Include fastlio2.launch.py mode:=localization with map.pcd + poses.txt of map_dir.
  3. Adds map_server (read nav_map.yaml), obstacle_filter (read traversability.yaml), 4 Nav2 nodes (read nav2_params.yaml) and lifecycle_manager.

This is the same way as bringup: don't copy the localization part but include it, you should edit the localizer in one place and both commands will change at the same time.

Configuration file according to node

FileNode readsPurpose
atlas3d_description/config/dimensions.yaml(xacro, when launch) → robot_state_publisherAll robot sizes
atlas3d_gazebo/config/gz_bridge.yamlros_gz_bridgeWhich topic is connected to Gazebo ↔ ROS
atlas3d_control/config/diff_drive_controller.yamldiff_drive_controllerWheel distance, maximum speed
atlas3d_slam/config/fastlio2_vlp16.yamllio_nodeTopic sensor, LiDAR–IMU, gravity_align
atlas3d_slam/config/fastlio2_pgo.yamlpgo_nodeKeyframe, closed search loop
atlas3d_slam/config/fastlio2_localizer.yamllocalizer_nodeDetection range ±1 m ±30°, ICP
atlas3d_navigation/config/traversability.yamlobstacle_filter, pcd_to_navmap.pySlope ≤ 15°, steps ≤ 7 cm
atlas3d_navigation/config/nav2_params.yamlNav2Footprint, costmap, traction speed

After editing the file in src/, you must re-install it with colcon build (or build with --symlink-install): launch reads the version installed in install/.

Reading launch files · Module 2: The big picture — Atlas Robotics