Running the output
--target and --output turn a checked program into one directory that runs as it is.
mobiledsl compile robot.core robot.world robot.task robot.eval --library parts \
--target ros-gz-nav2 --output buildTargets
| Target | For |
|---|---|
ros-gz-nav2 | ROS 2 Jazzy, Gazebo Harmonic, ros2_control, Nav2 |
ros-mujoco-nav2 | ROS 2 Jazzy, MuJoCo, ros2_control, Nav2 |
Both write the same robot description, controllers, navigation settings, task and runtime; they differ in the simulator. See Gazebo or MuJoCo.
The output directory
build/
├── robot/ robot.urdf, controllers.yaml, meshes/, and hulls/ when a part declares a hull
├── world/ world.sdf and bridge.yaml, or mujoco.json
├── nav/ nav2.base.yaml, nav2.robot.yaml, map.pgm, map.yaml
├── task/ behavior_tree.xml, mission.json, evaluation.json
├── launch/ bringup.launch.py
├── runtime/ the task runner and helpers, needing only ROS 2
└── compile.json what the compiler knew: facts, validation, stand-ins, sourcesNothing in it is built or installed, and it holds no absolute path, so it can be moved or mounted anywhere. The same program, libraries and compiler version always produce the same bytes. Compiling again overwrites the files it writes and leaves every other file alone.
Launching
ros2 launch build/launch/bringup.launch.pyThe launch brings up the simulator, the robot, its drive controller, Nav2 and the task runner, in that order, and shuts everything down when the task ends.
| Argument | Does |
|---|---|
headless:=false | Opens Gazebo's window; MuJoCo has none |
navigation:=false | Brings up only the simulator, the robot and its controller, to drive it by hand |
exit_on_task_end:=false | Keeps everything running after the task ends |
run_dir:=DIR | Writes the run's results to DIR instead of build/run |
To drive the base by hand, publish geometry_msgs/msg/TwistStamped on /cmd_vel. A command older than half a second stops the base.
Topics
| Topic | Carries |
|---|---|
/cmd_vel | Velocity commands to the base |
/odom | The base's wheel odometry |
/scan | The first laser, or a scan made from another range sensor |
/model/<robot>/pose | The simulator's own pose of the robot, which the evaluation trusts |
Sensors lists every sensor's topics.
Results
A run writes run/task_result.json, the task's own account, and run/evaluation.json, the three verdicts. The compiler never writes into run/, so compiling again keeps earlier results. Judging a run explains both files.
Stand-ins
Where a simulator cannot model something as it is, the target stands in for it and says so. A mecanum wheel in Gazebo is a sphere that slides freely along its rollers' axis; a lidar gets a default beam count because the library does not state one. Every stand-in is listed under approximations in compile.json, next to the component it concerns:
python -m json.tool build/compile.json | lessWhat a target cannot stand in for, it refuses at compile time, and nothing is written.
Next
The Advanced pages go deeper, starting with Adding your own part.