Dynamic human obstacles are animated pedestrian actors that walk predefined looping paths inside a Gazebo Fortress world. They are essential for social navigation research: a robot must learn to anticipate, yield to, and navigate around moving people in cluttered environments rather than only avoiding static geometry. RoboTerrain implements dynamic obstacles using Gazebo’s built-in SDFDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/jackvice/RoboTerrain/llms.txt
Use this file to discover all available pages before exploring further.
<actor> system combined with the <script> / <trajectory> element. The spawn.py script in ros2_ws/src/dynamic_obstacles/ reads a waypoint SDF file, computes timing and heading for each waypoint at a desired walking speed, mirrors the path for a terrain-following return leg, and injects the fully assembled actor SDF into a running Gazebo world via the ign service CLI.
Available Trajectory Files
Pre-built trajectory files live inros2_ws/src/dynamic_obstacles/trajectories/.
Inspection World Trajectories
| File | Path Pattern | Description |
|---|---|---|
inspect_linear.sdf | Straight line across the inspection site | Simple crossing path — good for evaluating head-on avoidance |
inspect_diag.sdf | Diagonal traverse | Cross-traffic scenario where the actor cuts across the robot’s likely heading |
inspect_corner_triangle.sdf | Triangular path around box corners | Occlusion scenario — actor appears and disappears behind inspection crates |
Flat-Terrain Trajectories
| File | Description |
|---|---|
flat_triangle_traject.sdf | Equilateral triangle loop for open flat areas |
flat_triangle_traject_2nd.sdf | Second triangle variant with a different phase offset for multi-actor runs |
flat_triangle_traject_3rd.sdf | Third variant enabling a third simultaneous actor with minimal path overlap |
Construction World Trajectories
| File | Description |
|---|---|
construction_lower.sdf | Ground-level path through the lower section of the CPR construction site |
construction_upper.sdf | Elevated path through the upper construction level — tests vertical clearance awareness |
Spawning Actors
Actors are spawned after the Gazebo simulation is already running. Each call tospawn.py injects one actor; run the script multiple times with different arguments for multi-actor scenarios.
The
--world_name argument must exactly match the internal Gazebo world name — not the filename. For example, inspection_boxes_v4.world uses --world_name inspect. If the names do not match, the ign service call to /world/<name>/create will return an error.CLI Arguments
spawn.py accepts four command-line arguments:
| Argument | Default | Description |
|---|---|---|
--trajectory_file | flat_triangle_traject_rev.sdf | Path to the trajectory SDF file (relative or absolute). Note: this default does not exist in trajectories/ — always pass an explicit path from the table above. |
--actor_name | first | Unique name for the Gazebo actor entity (e.g. linear, diag). Also used as the ROS 2 topic prefix: /<actor_name>_actor/pose. |
--animate_name | actor1 | Unique animation name within the SDF to prevent Gazebo animation conflicts when multiple actors are present |
--world_name | moon | Gazebo internal world name matching the loaded world (e.g. inspect, default) |
Example: Inspection World — Three Actors
From theActive_Vision_README.md setup procedure (Terminal 5):
Example: Construction World — Two Actors
How spawn.py Works
Spawn pipeline internals
Spawn pipeline internals
When
spawn.py is called, it executes the following steps:- Load the raw waypoint list from the trajectory SDF file.
- Downsample waypoints using the
sample_intervalparameter (default: every waypoint). - Compute timing — cumulative travel time is calculated from Euclidean distances between waypoints at
desired_velocity=1.0 m/s. - Mirror the path — waypoints are reversed and appended so the actor automatically returns to the start, creating an infinite loop without a teleport.
- Compute heading — yaw angle at each waypoint is set to face the next waypoint. A brief
TURN_DURATION = 0.1 ssnap-turn waypoint is inserted at every corner to prevent the actor from sliding sideways. - Assemble actor SDF — wraps the processed trajectory in a full Gazebo actor SDF block, including the
walk.daeskin mesh from Gazebo Fuel and theActorPosePublisherplugin. - Write to
/tmp/actor_with_trajectory.sdfand call:
Generating Custom Trajectories
RoboTerrain includes several Python utilities for creating new trajectory SDF files from scratch.generate_trajectory.py
General-purpose trajectory generator. Converts a set of
(x, y) waypoints into a properly formatted SDF <trajectory> block for use with spawn.py.Located at: ros2_ws/src/dynamic_obstacles/generate_trajectory.pygenerate_flat_trajectory.py
Specialised for flat-terrain environments. Generates triangle and polygon trajectories on a flat ground plane.Located at:
ros2_ws/src/dynamic_obstacles/generate_flat_trajectory.pytrajectory_dev/ subdirectory contains additional development tools:
| File | Description |
|---|---|
trajectory_generator.py | Interactive trajectory generator for authoring custom paths |
ray_trajectory_generator.py | Generates radial ray-pattern trajectories |
spawn-actor-sequential.py | Spawns multiple actors in sequence with configurable delays |
spawn-actor-corrected.py | Corrected spawn logic for complex world geometries |
Actor Position Publisher
Each spawned actor is equipped with theActorPosePublisher Gazebo Fortress system plugin, which publishes the actor’s world-frame pose over a dedicated ROS 2 topic at 30 Hz.
Plugin source: actor_publisher/src/actor_pos_publisher.cc
The plugin is compiled from C++ and loaded at actor spawn time. It configures two parameters per actor:
/<actor_name>_actor/pose and is bridged to ROS 2 geometry_msgs/msg/Pose via the ros_gz_bridge entries in Leo_rover_fisheye.launch.py: