Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ PROJECT_NAME="airstack"
# If you've run ./airstack.sh setup, then this will auto-generate from the git commit hash every time a change is made
# to a Dockerfile or docker-compose.yaml file. Otherwise this can also be set explicitly to make a release version.
# auto-generated from git commit hash
VERSION="0.21.0-dev.20"
VERSION="0.21.0-dev.21"
# Image-tag discriminator ONLY (appears in the image tag suffix, e.g. ..._robot-x86-64_dev).
# No Dockerfile consumes it: "prebuilt" does NOT bake the built ros_ws into the image today —
# a real prebuilt (workspace-baked) stage is future work. Keep "dev" (mounted code, built live).
Expand Down
2 changes: 2 additions & 0 deletions airstack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ function print_command_help {
echo " the full_default dispatch)"
echo " --fleet=NAME Fleet preset under config/fleets/ (derives the"
echo " robot count, overriding --num-robots)"
echo " --physics=MODEL Project AirSim dynamics: fast-physics or jsbsim"
echo " (default: fast-physics; ignored by other sims)"
echo " --stress-iterations=N Up/down cycles per config (default: 1)"
echo " --stable-duration=SECS Seconds test_stable polls for (default: 120)"
echo " --stable-interval=SECS Seconds between polls (default: 10)"
Expand Down
5 changes: 3 additions & 2 deletions docs/release_notes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ its own notes. -->
(`sensors/ouster/point_cloud_raw`). Unlike Microsoft AirSim (legacy), the
default MIGHTY stack therefore runs on it, and cameras render headless. New
flag `--physics fast-physics|jsbsim`, per robot via fleet
`robots.<name>.physics` / `sim.physics` (JSBSim is experimental: PX4's EKF
does not yet complete tilt alignment). Validated with liveliness, sensors,
`robots.<name>.physics` / `sim.physics`, and `airstack test --physics`.
JSBSim integrates in 1 ms substeps (at the 3 ms simulator tick its landing
gear chattered and PX4 needed ~90 s to pass preflight). Validated with liveliness, sensors,
takeoff/hover/land (0.5–2 m/s), fixed trajectories, MIGHTY waypoint flight,
and two robots. `PROJECT_AIRSIM_LUMEN` toggles Lumen GI and reflections
per camera in environments packaged with the plugin from Project AirSim
Expand Down
8 changes: 6 additions & 2 deletions docs/simulation/project-airsim/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ Because Project AirSim's own control link is parked on an unused port, its param
| | `fast-physics` (default) | `jsbsim` |
|---|---|---|
| Model | Project AirSim's rigid-body quad: point-mass rotors, box drag | Auterion's `quadrotor_x` JSBSim flight-dynamics model |
| Status | Validated: liveliness, sensors, takeoff/hover/land, fixed trajectories, MIGHTY waypoint flight, two robots | **Experimental:** the scene loads and sensors stream, but PX4's EKF does not complete tilt alignment at rest (IMU contact jitter) |
| Use for | All AirStack testing | Investigating flight-dynamics fidelity |
| Status | Validated: liveliness, sensors, takeoff/hover/land, fixed trajectories, MIGHTY waypoint flight, two robots | Validated: liveliness, takeoff/hover/land (0.5–2 m/s), one robot |
| Use for | All AirStack testing | Flight-dynamics fidelity: JSBSim's aerodynamics, propulsion and landing gear |

Selection, first match wins:

Expand All @@ -148,6 +148,10 @@ sim:

Both variants carry identical sensors and PX4 settings; only the dynamics differ. The choice per robot is printed in the container log (`generate_scene: robot_1: physics=...`).

JSBSim integrates in 1 ms substeps, three per 3 ms simulator tick. At the tick itself, `quadrotor_x`'s landing-gear friction solves unstably: the vehicle chatters on the ground (IMU spikes near 50 m/s²) and PX4 takes about 90 s to pass preflight. With 1 ms substeps it is at rest and ready in seconds, at no measurable CPU or real-time-factor cost.

The system tests take the same choice: `airstack test ... --sim projectairsim --physics jsbsim`.

## Spawn origins

Project AirSim places `0 0 0` at the Unreal world origin, not at a player start. In the packaged Blocks environment that origin lies inside a block and below the ground surface. A drone spawned there is pushed out of the geometry every few seconds, which looks like it teleports to the ground mid-flight. Each environment therefore has a **spawn origin** (NED metres, world frame), and fleet `spawn:` offsets apply relative to it:
Expand Down
8 changes: 7 additions & 1 deletion simulation/project-airsim/config/generate_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
from pathlib import Path

PHYSICS_CHOICES = ("fast-physics", "jsbsim")
# Largest JSBSim integration step. Project AirSim runs JSBSim in substeps of at
# most jsbsim-dt per clock tick. At the 3 ms tick, quadrotor_x's landing-gear
# friction (mu = 5) solves unstably: the vehicle chatters at rest (IMU spikes
# near 50 m/s^2) and PX4 needs ~90 s to align and pass preflight. 1 ms substeps
# remove the chatter (preflight in ~5 s) at no measurable CPU or RTF cost.
JSBSIM_MAX_DT_S = 0.001
DEFAULT_PHYSICS = "fast-physics"
SCENE_ID = "SceneAirStack"
HIL_TCP_BASE = 4560
Expand Down Expand Up @@ -454,7 +460,7 @@ def build_robot_config(robot, params):
"jsbsim-aircraft-path": "aircraft",
"jsbsim-engine-path": "engine",
"jsbsim-systems-path": "systems",
"jsbsim-dt": params["step_ns"] / 1e9,
"jsbsim-dt": min(params["step_ns"] / 1e9, JSBSIM_MAX_DT_S),
})
else:
cfg["physics-type"] = "fast-physics"
Expand Down
11 changes: 10 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ def pytest_addoption(parser):
"= the default dispatch, stacks/full_default. The "
"wiring test drift-checks against "
"stacks/<name>/wiring.md.")
parser.addoption("--physics", default=None,
choices=("fast-physics", "jsbsim"),
help="Project AirSim dynamics model for every robot, "
"same as `airstack up --physics` (sets "
"PROJECT_AIRSIM_PHYSICS). Ignored by other sims. "
"Default: None = the sim's default (fast-physics).")
parser.addoption("--fleet", default=None,
help="Fleet preset under config/fleets/ (RFC #380 §2), "
"e.g. sim_three_mixed. Sets FLEET_CONFIG_FILE for "
Expand Down Expand Up @@ -160,7 +166,7 @@ def pytest_sessionfinish(session, exitstatus):
"sim", "num_robots", "stress_iterations", "stable_duration",
"stable_interval", "gui", "takeoff_velocities",
"trajectory_types", "waypoints", "waypoint_tolerance",
"goal_tolerance", "waypoint_timeout",
"goal_tolerance", "waypoint_timeout", "physics",
):
try:
campaign_config[key] = session.config.getoption(
Expand Down Expand Up @@ -276,6 +282,9 @@ def airstack_env(request):
# Forces rviz/Qt apps to render offscreen instead of spawning windows.
env_overrides["QT_QPA_PLATFORM"] = "offscreen"
env_overrides.update(cfg.get("extra_env", {}))
physics = request.config.getoption("--physics")
if physics and sim == "projectairsim":
env_overrides["PROJECT_AIRSIM_PHYSICS"] = physics

# Stack dispatch (RFC #379 §3): route robot.launch.xml to the stack's
# entry launch file (unset = the full_default default). Container path —
Expand Down
1 change: 1 addition & 0 deletions tests/harness/run_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def is_simulation_test_id(test_id: str) -> bool:
"waypoint_tolerance",
"goal_tolerance",
"waypoint_timeout",
"physics",
)


Expand Down
16 changes: 16 additions & 0 deletions tests/meta/test_project_airsim_scene_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,22 @@ def test_jsbsim_differs_only_in_dynamics(gen, tmp_path):
assert escs == [f"fcs/esc-cmd-norm[{k}]" for k in range(4)]


@pytest.mark.parametrize("step_ns, want_dt", [
(None, 0.001), # default 3 ms tick -> three 1 ms JSBSim substeps
("500000", 0.0005), # a tick finer than the cap is used as-is
])
def test_jsbsim_substeps_at_most_1ms(gen, tmp_path, step_ns, want_dt):
"""quadrotor_x's gear friction chatters at a 3 ms step (IMU spikes ~50
m/s^2, PX4 preflight ~90 s); jsbsim-dt is capped at 1 ms (016)."""
env = {"PROJECT_AIRSIM_PHYSICS": "jsbsim"}
if step_ns:
env["PROJECT_AIRSIM_STEP_NS"] = step_ns
scene, _ = _generate(gen, tmp_path, **env)
dt = scene["actors"][0]["robot-config"]["jsbsim-dt"]
assert dt == pytest.approx(want_dt)
assert dt <= gen.JSBSIM_MAX_DT_S


def test_fleet_physics_per_robot(gen, tmp_path):
fleet = {
"defaults": {"vehicle": "quad_default", "stack": "stacks/full_default"},
Expand Down
Loading