harryzhang1018's picture
Add reproduction code and README
0c3dd1d verified
|
Raw History Blame Contribute Delete
8.22 kB

Episode output schema (tr-c1-episode/1)

Each completed episode is a directory OUT/episodes/<episode_id>/ that appears atomically (written as .tmp_<id>_<pid> and renamed). Infrastructure failures go to OUT/infrastructure_errors/<episode_id>_<ms>/ instead and are retried by the next campaign.py invocation. Files:

File Content
episode_config.json normalized config (defaults filled); its SHA256 over canonical JSON is config_hash
ticks.csv.gz one row per 10 Hz controller tick
state100.csv.gz 100 Hz true-state log (every 10 physics steps, from step 0)
summary.json outcome, metrics, wall-time split, file hashes
server_stderr.txt physics-server stderr
mpc_diag.csv.gz only for the released MPC and MPC-based plug-ins: one row per OSQP solve, see below
obs_noise.csv.gz only when observation noise is on: one row per tick that observed a state

CSV: gzip (mtime 0, deterministic bytes), header row, floats written with Python repr (exact round trip), empty field = not applicable. Units: m, rad, s, m/s. Angles CCW positive; yaw from the released formula atan2(2(e0 e3 + e1 e2), e0^2 + e1^2 - e2^2 - e3^2) on the Chrono chassis quaternion (e0 = w). Position = chassis COG (what ChROSBodyHandler publishes).

ticks.csv.gz

Column Meaning
tick, step, t, t_ctrl tick index; physics boundary (steps completed); ChSystem time; t - control_start_s
status ok, no_state (released pub_callback returned before the first pose, ros_emulated start-up), controller_dead (after a controller failure), controller_solver_failure, controller_exception, controller_nonfinite_output
obs_pub_step, obs_age_steps boundary of the state the controller saw (ideal: = step) and its age
x y z yaw yaw_unwrapped speed vx vy yaw_rate TRUE chassis state at the tick boundary (yaw_unwrapped over ticks; speed = planar norm of COG velocity; yaw_rate = world-z angular rate)
obs_x obs_y obs_theta obs_v what the released node stored (state_callback/vel_callback; includes observation noise) - these are the released logger's x, y, theta
e0..e3 controller input error_state(1.0) (1 m lookahead) captured from pub_callback
et0..et3 error_state(0.0) (= released e_tracking): et1 lateral, et2 heading error
idx_lookahead, idx_track, arc_s_track nearest-waypoint indices of the two error states; arc length of idx_track
raw_throttle, raw_steering controller law output before the rate limit (MPC steering already x1.6667)
rl_steering, rate_limited self.steering after the 0.25/tick limiter; whether the limiter acted
published, pub_steering, pub_throttle, pub_braking published DriverInputs (clipped)
apply_step, applied_* boundary at which THIS tick's command reached driver->Set* and the stored driver values (after steering bias, ChDriver clamp); -1 = superseded before any driver tick (ros_emulated) or never applied
drv_steering, drv_throttle, drv_braking driver inputs in effect at the tick boundary (before this tick's command)
compute_wall_s wall time of pub_callback (excluded from determinism comparisons)

state100.csv.gz

step, t, x, y, z, yaw, yaw_unwrapped, speed, vx, vy, yaw_rate (true state), in_steering, in_throttle, in_braking (inputs used by the last physics step), e_long, e_lat, e_head, e_speed, nearest_idx, arc_s (released error_state(0.0) definitions evaluated on the true state, vectorised and checked against the released function), progress_idx (path_completion tracker), dist_min (distance to nearest waypoint, divergence rule).

summary.json (selected keys)

  • status: ok | infrastructure_error. outcome (only when ok): horizon_reached, completed, timeout, diverged, controller_solver_failure, controller_exception, controller_nonfinite_output.
  • failure: category, tick, step, t, traceback (controller failures and infrastructure errors).
  • tube_entry_time_100hz_s: first 100 Hz sample (t relative to control start) with |e_lat| < tube_lat_m and |e_head| < tube_head_rad (true state); tube_entry_time_tick_s: same on published ticks (et1, et2); stay_in_tube_time_100hz_s, fraction_inside_tube_after_entry, tube_exits_after_entry; max_abs_lat_100hz_m, final_e_*.
  • completion_step (path_completion), run_mae_lateral_m, run_mae_heading_rad, run_mae_samples: definitions of physical/physical_runs.py on published ticks' observed pose up to completion (or the last tick).
  • wall: init_s (controller reset + server spawn/initialisation), stepping_s (physics round trips), controller_s (sum of pub_callback), other_s, total_s; physics_pure_step_wall_s (inside the server); server_spawn_to_ready_s.
  • files: SHA256 of the two CSV files; config_hash; reference_sha256; mpc_osqp_adaptive_rho_interval used.

mpc_diag.csv.gz (READ-ONLY OSQP diagnostics)

One row per osqp.OSQP.solve() made during a controller tick (released MPC, plugin:wrapped_released with base mpc, plugin:mpc_n5). Recorded by a wrapper around osqp.OSQP.solve that returns the solver's results object unchanged; commands are bitwise identical with and without it.

Column Meaning
tick, step, solve_index controller tick, its boundary, index of the solve within the tick (always 0 for nsim = 1)
status, status_val, status_polish OSQP res.info status text / code / polish status (solved = 1)
iter, rho_updates, rho_estimate ADMM iterations, number of rho updates, final rho estimate
obj_val, pri_res, dua_res objective, primal and dual residuals
setup_time, solve_time, update_time, polish_time, run_time OSQP's own WALL-CLOCK timings in s (excluded from determinism comparisons)
adaptive_rho_interval_requested value passed to setup (25 = the runner pin; empty = OSQP automatic, chosen from wall-clock time inside the solver and not readable safely through the osqp 0.6.5 Python API)
setup_max_iter, setup_warm_start values the released code passed to setup (10000, true)
qp_n, qp_m QP size from OSQP.dimensions() (N = 10: 64 x 108; N = 5: 34 x 58)
diag_error empty unless reading the diagnostics failed (never changes an outcome)

Summary key mpc_osqp: n_solves, status_counts, n_not_solved, iter_total / mean / max, rho_updates_total, n_solves_with_rho_update, rho_estimate_min / max, adaptive_rho_interval_requested, qp_dims, n_diag_errors (all deterministic); wall.osqp_run_s = sum of run_time.

obs_noise.csv.gz

tick, step, obs_pub_step, z_x, z_y, z_yaw, noise_x, noise_y, noise_yaw: the standard normals of the observed publication (SeedSequence([7301, obs_noise.seed, obs_pub_step])) and the noise actually added (std x z; exactly 0 where std = 0). Summary key obs_noise_model names the model (null without noise).

Recovery summary fields

horizon_mean_abs_e_lat_m, horizon_mean_abs_e_head_rad (100 Hz true-state tracking error, every sample from control start t = 0 to the end of the log), horizon_mean_n_samples, horizon_mean_from_sim0_* (from sim time 0), horizon_mean_covers_horizon; by_H = {"15", "25", "40"} (windows 0 <= t <= H inside the horizon): abs_e_lat_m, abs_e_head_rad, n_samples, covered, tube_entry_s, tube_exits_after_entry; divergence_events (offline replay of the online rule: start_step, fire_step, end_step), n_divergence_events, divergence_flag, diverged_then_recovered, first_tube_entry_after_divergence_s, entered_then_diverged, returned_within_divergence_dist, divergence_offline_matches_online; controller_params_effective (plug-ins: parameters with defaults filled in). With termination.stop_on_divergence = false the episode always runs to horizon_s; the online outcome is still diverged once the rule fires. The post-entry exit count is tube_exits_after_entry.

Run level

OUT/summary.jsonl (append-only, one flattened row per finished episode per invocation), OUT/summary.csv (rebuilt from all summary.json, sorted by episode_id), OUT/manifest_<run_id>.json (input hashes, environment, config hashes, counts, per-episode wall times).