Skip to content

Development Toolchain

Robot development involves model description, visualization debugging, behavior orchestration, build systems, and more. This article surveys commonly used development tools in the ROS2 ecosystem and beyond.

This note focuses on formats and tools. For how robots, objects, sensors, and materials become usable simulation assets, see Simulation Assets. For how those assets are assembled into worlds with physics, timing, randomization, and evaluation rules, see Simulation World Building & Physics Rules.

graph LR
    subgraph Modeling["Modeling Phase"]
        URDF[URDF / Xacro]
        MJCF[MJCF]
        SDF[SDF]
    end

    subgraph Development["Development Phase"]
        BUILD[colcon + CMake<br/>Build System]
        BT[Behavior Trees<br/>BT.CPP / py_trees]
    end

    subgraph Debugging["Debugging & Visualization"]
        RVIZ[RViz2]
        FOX[Foxglove]
        RERUN[rerun.io]
        BAG[rosbag2 / MCAP]
    end

    URDF --> BUILD
    BUILD --> BT
    BT --> RVIZ
    BAG --> FOX
    BAG --> RERUN

    style Modeling fill:#e8eaf6
    style Development fill:#e8f5e9
    style Debugging fill:#fff3e0

Robot Description Formats

URDF (Unified Robot Description Format)

URDF is the most widely used robot description format in the ROS ecosystem, based on XML.

Core Elements:

Element Description Key Attributes
<link> Rigid body link visual, collision, inertial
<joint> Joint type (revolute/prismatic/fixed), limits, axis
<transmission> Transmission Connects joints and actuators
<gazebo> Simulation plugins Physical parameters, sensor plugins
<robot name="my_arm">
  <link name="base_link">
    <visual>
      <geometry><mesh filename="package://my_robot/meshes/base.stl"/></geometry>
      <material><color rgba="0.8 0.8 0.8 1.0"/></material>
    </visual>
    <collision>
      <geometry><mesh filename="package://my_robot/meshes/base_collision.stl"/></geometry>
    </collision>
    <inertial>
      <mass value="2.5"/>
      <inertia ixx="0.01" iyy="0.01" izz="0.01" ixy="0" ixz="0" iyz="0"/>
    </inertial>
  </link>

  <joint name="joint1" type="revolute">
    <parent link="base_link"/>
    <child link="link1"/>
    <origin xyz="0 0 0.1" rpy="0 0 0"/>
    <axis xyz="0 0 1"/>
    <limit lower="-3.14" upper="3.14" effort="10.0" velocity="1.0"/>
    <dynamics damping="0.5" friction="0.1"/>
  </joint>
</robot>

URDF Limitations:

  • Does not support closed-loop kinematic chains
  • Does not support variable topology (dynamic connect/disconnect)
  • Inertial parameters must be manually specified
  • Does not support soft bodies

Xacro Macros: Use xacro to define parameterizable macros, avoiding repetitive definitions. Generate final URDF via xacro my_robot.urdf.xacro > my_robot.urdf.

MJCF (MuJoCo Format)

MJCF is MuJoCo's native description format, more powerful than URDF.

Comparison Dimension URDF MJCF
Closed chains Not supported Supported (equality constraint)
Contact parameters Limited Rich (condim, solref, solimp)
Tendons/springs Not supported Native support (tendon)
Soft bodies Not supported composite body
Actuators Simple Multiple types (motor, position, velocity)
Sensors Plugin Native support
<mujoco model="arm">
  <worldbody>
    <body name="link1" pos="0 0 0.1">
      <joint name="joint1" type="hinge" axis="0 0 1" range="-180 180"/>
      <geom type="capsule" size="0.02" fromto="0 0 0 0 0 0.2"/>
      <body name="link2" pos="0 0 0.2">
        <joint name="joint2" type="hinge" axis="0 1 0" range="-120 120"/>
        <geom type="capsule" size="0.015" fromto="0 0 0 0 0 0.15"/>
      </body>
    </body>
  </worldbody>

  <actuator>
    <motor joint="joint1" ctrlrange="-1 1" gear="50"/>
    <position joint="joint2" kp="100" ctrlrange="-2.09 2.09"/>
  </actuator>

  <sensor>
    <jointpos joint="joint1"/>
    <jointvel joint="joint2"/>
    <touch site="fingertip_site"/>
  </sensor>
</mujoco>

SDF (Simulation Description Format)

SDF is the scene description format used by Gazebo, more versatile than URDF.

Feature Description
Scene support Can describe complete scenes (multiple models, lights, physics properties)
Closed chains Supported
Sensors Native support for Camera, LiDAR, IMU, etc.
Nested models Supports model composition

Format Conversion

# URDF -> SDF (Gazebo tool)
gz sdf -p my_robot.urdf > my_robot.sdf

# URDF -> MJCF (MuJoCo tool)
python -c "import mujoco; m = mujoco.MjModel.from_xml_path('my_robot.urdf')"

# OnShape/SolidWorks -> URDF
# Use onshape-to-robot or sw_urdf_exporter plugin

The syntax-oriented view of these formats is enough for this note, but their role inside real asset production flows is covered in Simulation Assets. How they feed into complete worlds and influence contact, timing, and task logic is covered in Simulation World Building & Physics Rules.


Visualization Tools

RViz2

RViz2 is the standard 3D visualization tool for ROS2.

Common Display Types:

Display Topic Type Purpose
RobotModel robot_description Display robot model
TF tf2_msgs/TFMessage Transform visualization
PointCloud2 sensor_msgs/PointCloud2 Point cloud display
Image sensor_msgs/Image Camera images
LaserScan sensor_msgs/LaserScan Laser scan
MarkerArray visualization_msgs/MarkerArray Custom markers
Path nav_msgs/Path Planned paths
Map nav_msgs/OccupancyGrid Grid maps
Wrench geometry_msgs/WrenchStamped Force/torque
# Launch RViz2
rviz2

# Load configuration file
rviz2 -d my_config.rviz

Foxglove Studio

Foxglove is a next-generation robot data visualization platform supporting both web and desktop.

Comparison RViz2 Foxglove
Platform Linux (X11/Wayland) Web/Desktop (cross-platform)
Data Sources Live ROS2 topics ROS2 live + rosbag playback + MCAP
3D Rendering Medium Better (WebGL)
Custom Panels Limited Rich (extension system)
Remote Access Requires VNC/SSH Native WebSocket
Collaboration None Cloud sharing
# Install Foxglove Bridge (ROS2 -> Foxglove)
sudo apt install ros-humble-foxglove-bridge
ros2 launch foxglove_bridge foxglove_bridge_launch.xml
# Access via browser at https://app.foxglove.dev

rerun.io

rerun is a visualization framework for multimodal data, especially suited for AI/ML pipeline debugging. Supports images, point clouds, 3D meshes, time series, and other multimodal data. Python-first (pip install rerun-sdk), with built-in timeline playback.

import rerun as rr
rr.init("robot_debug", spawn=True)
rr.log("camera/rgb", rr.Image(image_array))
rr.log("lidar/points", rr.Points3D(point_cloud, colors=colors))

Behavior Trees

Behavior trees are the mainstream method for robot task orchestration. Frameworks like Nav2 manage navigation flows based on behavior trees.

Core Concepts

Node Type Symbol Behavior
Sequence -> Execute children in order, stop on FAILURE
Fallback ? Try children in order, stop on SUCCESS
Action [] Execute a specific action
Condition () Check a condition
Decorator <> Modify child node (retry, invert, timeout, etc.)

BT.CPP / py_trees

BT.CPP is a C++ behavior tree library and the underlying dependency of Nav2. Behavior tree structure is defined via XML files, with concrete Action/Condition nodes implemented in C++.

<!-- BT.CPP Behavior Tree XML -->
<root BTCPP_format="4">
  <BehaviorTree ID="PickAndPlace">
    <Sequence>
      <DetectObject object_name="cup" pose="{target_pose}"/>
      <PlanMotion goal="{target_pose}" trajectory="{traj}"/>
      <ExecuteTrajectory trajectory="{traj}"/>
      <CloseGripper/>
    </Sequence>
  </BehaviorTree>
</root>

py_trees is a Python behavior tree library suitable for rapid prototyping, building behavior trees with a pure Python API.


Build System

colcon

colcon is the standard build tool for ROS2.

# Basic build
colcon build

# Common options
colcon build --symlink-install          # Symlink Python packages (avoid recompilation)
colcon build --packages-select my_pkg   # Build only specified package
colcon build --packages-up-to my_pkg    # Build specified package and dependencies
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release  # Release mode
colcon build --parallel-workers 4       # Parallel build count

# Testing
colcon test
colcon test-result --verbose

CMake / ament Build

ROS2 C++ packages use ament_cmake, Python packages use ament_python. Key files:

  • C++ packages: CMakeLists.txt + package.xml, declare dependencies with ament_target_dependencies()
  • Python packages: setup.py + package.xml, register nodes in entry_points

Debugging Tools

rosbag2 Recording and Playback

# Record all topics
ros2 bag record -a -o experiment_001

# Record specific topics
ros2 bag record /camera/image_raw /joint_states /tf -o experiment_001

# Record in MCAP format (recommended, Foxglove compatible)
ros2 bag record -a -s mcap -o experiment_001

# Playback
ros2 bag play experiment_001
ros2 bag play experiment_001 --rate 0.5    # Half-speed playback
ros2 bag play experiment_001 --loop        # Loop playback

# View bag info
ros2 bag info experiment_001

TF2 Debugging

TF (Transform) is the core of coordinate transformations in ROS. TF issues are among the most common debugging scenarios.

# View TF tree
ros2 run tf2_tools view_frames
# Generates frames.pdf

# View transform between two frames
ros2 run tf2_ros tf2_echo base_link camera_link

# Monitor TF publish frequency
ros2 run tf2_ros tf2_monitor

# Common troubleshooting
# 1. "Could not transform..." -> Check if TF tree is connected
# 2. TF delay -> Check timestamp synchronization
# 3. TF jitter -> Check sensor calibration

Other Debugging Commands

ros2 topic hz /camera/image_raw     # Publish frequency
ros2 topic bw /pointcloud           # Bandwidth
rqt_graph                           # Node graph visualization


评论 #