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
308 changes: 308 additions & 0 deletions .github/ci/tesla_preap_longitudinal_mutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,264 @@ class HistoricalMutation:
"test_inner_feedback_holds_cruise_against_sustained_road_load"
),
),
HistoricalMutation(
name="hard-inner-error-deadband-restored",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=b" error = self._gate_pid_error_noise(error, freeze_integrator)\n",
replacement=(
b" if abs(error) < PID_ERROR_DEADBAND:\n" +
b" error = 0.0\n"
),
test_node=(
"opendbc/car/tesla/preap/tests/test_virtual_das.py::TestInnerPID::" +
"test_persistent_sub_deadband_error_earns_residual_authority[0.0196]"
),
),
HistoricalMutation(
name="inner-error-noise-gate-call-bypassed",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=b" error = self._gate_pid_error_noise(error, freeze_integrator)\n",
replacement=b" error = error\n",
test_node=(
"opendbc/car/tesla/preap/tests/test_virtual_das.py::TestInnerPID::" +
"test_sub_deadband_sign_changing_noise_does_not_accumulate_residual_authority"
),
),
HistoricalMutation(
name="persistent-error-dwell-removed",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=b" if self.persistent_error_elapsed_s < PID_PERSISTENT_ERROR_DWELL_S:\n",
replacement=b" if False:\n",
test_node=(
"opendbc/car/tesla/preap/tests/test_virtual_das.py::TestInnerPID::" +
"test_sign_changing_sub_deadband_error_never_completes_dwell"
),
),
HistoricalMutation(
name="persistent-error-sign-reset-removed",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=(
b" if error_sign != self.persistent_error_sign:\n" +
b" self.persistent_error_sign = error_sign\n" +
b" self.persistent_error_elapsed_s = self.dt\n"
),
replacement=(
b" if error_sign != self.persistent_error_sign:\n" +
b" self.persistent_error_sign = error_sign\n"
),
test_node=(
"opendbc/car/tesla/preap/tests/test_virtual_das.py::TestInnerPID::" +
"test_sign_changing_sub_deadband_error_never_completes_dwell"
),
),
HistoricalMutation(
name="persistent-error-freeze-reset-removed",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=b" if freeze_integrator or error == 0.0:\n",
replacement=b" if error == 0.0:\n",
test_node=(
"opendbc/car/tesla/preap/tests/test_virtual_das.py::TestInnerPID::" +
"test_persistent_error_dwell_restarts_after_freeze_observe_and_reset"
),
),
HistoricalMutation(
name="persistent-error-observe-reset-removed",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=(
b" self.inner_pid.reset()\n" +
b" self._reset_negative_handoff()\n" +
b" self._reset_persistent_error()\n\n" +
b" def reset("
),
replacement=(
b" self.inner_pid.reset()\n" +
b" self._reset_negative_handoff()\n\n" +
b" def reset("
),
test_node=(
"opendbc/car/tesla/preap/tests/test_virtual_das.py::TestInnerPID::" +
"test_persistent_error_dwell_restarts_after_freeze_observe_and_reset"
),
),
HistoricalMutation(
name="persistent-error-command-reset-removed",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=(
b" self._reset_negative_handoff()\n" +
b" self._reset_persistent_error()\n\n" +
b" def _gate_pid_error_noise("
),
replacement=(
b" self._reset_negative_handoff()\n\n" +
b" def _gate_pid_error_noise("
),
test_node=(
"opendbc/car/tesla/preap/tests/test_virtual_das.py::TestInnerPID::" +
"test_persistent_error_dwell_restarts_after_freeze_observe_and_reset"
),
),
HistoricalMutation(
name="steady-grade-removed-from-effort",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=(
b" a_limited + steady_grade_compensation + transient_pitch_compensation,\n"
),
replacement=b" a_limited + transient_pitch_compensation,\n",
test_node=(
"opendbc/car/tesla/preap/tests/test_vdas_grade_control.py::" +
"test_preserved_grade_handoff_holds_net_acceleration_for_1p5_seconds[0.5-15.0]"
),
),
HistoricalMutation(
name="steady-grade-subtracted-from-net-feedback",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=(
b" a_ego_filtered = self.a_ego_filter.update(a_ego)\n" +
b" self.a_ego_initialized = True\n"
),
replacement=(
b" a_ego_corrected = a_ego - steady_grade_compensation\n" +
b" a_ego_filtered = self.a_ego_filter.update(a_ego_corrected)\n" +
b" self.a_ego_initialized = True\n"
),
test_node=(
"opendbc/car/tesla/preap/tests/test_vdas_grade_control.py::" +
"test_steady_grade_hold_does_not_double_compensate[0.5-15.0]"
),
),
HistoricalMutation(
name="engage-grade-bypasses-effort-envelope",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=b" effort_min, effort_max = accel_effort_limits or (REGEN_MAX, ACCEL_MAX)\n",
replacement=b" effort_min, effort_max = REGEN_MAX, ACCEL_MAX\n",
test_node=(
"opendbc/car/tesla/preap/tests/test_virtual_das.py::TestVDASDomainBoundaries::" +
"test_engage_effort_limits_include_grade_compensation"
),
),
HistoricalMutation(
name="engage-grade-bypasses-pedal-slew-envelope",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=(
b" pedal_di = self._rate_limit(\n" +
b" pedal_di_bounded,\n" +
b" prev_pedal_di,\n" +
b" pedal_ramp_rate_up,\n" +
b" pedal_ramp_rate_down,\n" +
b" )\n"
),
replacement=(
b" pedal_di = self._rate_limit(\n" +
b" pedal_di_bounded,\n" +
b" prev_pedal_di,\n" +
b" PEDAL_RAMP_RATE_UP,\n" +
b" pedal_ramp_rate_down,\n" +
b" )\n"
),
test_node=(
"opendbc/car/tesla/preap/tests/test_virtual_das.py::TestVDASDomainBoundaries::" +
"test_engage_pedal_ramp_limit_applies_after_feedforward"
),
),
HistoricalMutation(
name="engage-slew-stops-before-pedal-catches-up",
source_path="opendbc/car/tesla/preap/carcontroller.py",
original=(
b" pedal_ramp_rate_up = (\n" +
b" ENGAGE_GRACE_PEDAL_RAMP_RATE_UP\n" +
b" if self.preap_long_handoff_slew_active\n" +
b" else PEDAL_RAMP_RATE_UP\n" +
b" )\n"
),
replacement=b" pedal_ramp_rate_up = PEDAL_RAMP_RATE_UP\n",
test_node=(
"opendbc/car/tesla/preap/tests/test_pedal_authority.py::" +
"test_non_timeout_gas_override_release_has_no_launch_for_1p5_seconds"
),
),
HistoricalMutation(
name="full-strength-transient-grade-overshoot",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=b"TRANSIENT_GRADE_GAIN = 0.4\n",
replacement=b"TRANSIENT_GRADE_GAIN = 1.0\n",
test_node=(
"opendbc/car/tesla/preap/tests/test_vdas_grade_control.py::" +
"test_flat_to_grade_step_improves_on_no_pitch_baseline_at_1p5_seconds[0.4]"
),
),
HistoricalMutation(
name="steady-grade-pitch-outlier-unbounded",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=b" pitch = float(clip(orientation_ned[1], -maximum_pitch, maximum_pitch))\n",
replacement=b" pitch = orientation_ned[1]\n",
test_node=(
"opendbc/car/tesla/preap/tests/test_virtual_das.py::TestGradeEstimator::" +
"test_sustained_pitch_outlier_cannot_exceed_steady_grade_limit"
),
),
HistoricalMutation(
name="orientation-dropout-skips-short-hold",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=(
b" dropout_decay_elapsed_s = self.missing_orientation_elapsed_s - " +
b"ORIENTATION_DROPOUT_HOLD_S\n"
),
replacement=b" dropout_decay_elapsed_s = self.missing_orientation_elapsed_s\n",
test_node=(
"opendbc/car/tesla/preap/tests/test_virtual_das.py::TestGradeEstimator::" +
"test_orientation_dropout_holds_then_decays_steady_grade[0.5-1.0]"
),
),
HistoricalMutation(
name="orientation-dropout-disables-bounded-decay",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=b" self.pitch_lp.x = self.pitch_before_dropout_rad * dropout_grade_scale\n",
replacement=b" self.pitch_lp.x = self.pitch_before_dropout_rad\n",
test_node=(
"opendbc/car/tesla/preap/tests/test_virtual_das.py::TestGradeEstimator::" +
"test_orientation_dropout_holds_then_decays_steady_grade[4.64-0.0]"
),
),
HistoricalMutation(
name="orientation-dropout-reset-retains-stale-state",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=(
b" self._clear_high_pass_state()\n" +
b" self.missing_orientation_elapsed_s = 0.0\n" +
b" self.pitch_before_dropout_rad = 0.0\n"
),
replacement=b"",
test_node=(
"opendbc/car/tesla/preap/tests/test_virtual_das.py::TestGradeEstimator::" +
"test_reset_clears_grade"
),
),
HistoricalMutation(
name="legacy-positive-fallback-actuator-gain",
source_path="opendbc/car/tesla/preap/ff_table_default.py",
original=(
b" [-5.00, -3.33, -1.67, 0.00, 9.62, 19.24, 28.86, 38.48, 48.10], # 20 m/s\n" +
b" [-5.00, -3.33, -1.67, 0.00, 10.66, 21.32, 31.98, 42.64, 53.30], # 30 m/s\n"
),
replacement=(
b" [-5.00, -3.33, -1.67, 0.00, 14.80, 29.60, 44.40, 59.20, 74.00], # 20 m/s\n" +
b" [-5.00, -3.33, -1.67, 0.00, 16.40, 32.80, 49.20, 65.60, 82.00], # 30 m/s\n"
),
test_node=(
"opendbc/car/tesla/preap/tests/test_vdas_grade_control.py::" +
"test_route_shaped_positive_transition_bounds_delivered_acceleration"
),
),
HistoricalMutation(
name="legacy-5mps-positive-fallback-transition",
source_path="opendbc/car/tesla/preap/ff_table_default.py",
original=b" [-5.00, -3.33, -1.67, 0.00, 7.54, 15.08, 22.62, 30.16, 37.70], # 5 m/s\n",
replacement=b" [-5.00, -3.33, -1.67, 0.00, 11.60, 23.20, 34.80, 46.40, 58.00], # 5 m/s\n",
test_node=(
"opendbc/car/tesla/preap/tests/test_vdas_grade_control.py::" +
"test_speed_ramp_through_fallback_transition_is_smooth"
),
),
HistoricalMutation(
name="focused-job-skip-bypass",
source_path=".github/workflows/tests.yml",
Expand Down Expand Up @@ -199,6 +457,56 @@ class HistoricalMutation:
"test_retained_integral_is_clipped_to_remaining_acceleration_authority"
),
),
HistoricalMutation(
name="negative-handoff-integral-shaping-removed",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=b"NEGATIVE_HANDOFF_INTEGRAL_SLEW = 0.25 # m/s\xc2\xb3\n",
replacement=b"NEGATIVE_HANDOFF_INTEGRAL_SLEW = 100.0 # m/s\xc2\xb3\n",
test_node=(
"opendbc/car/tesla/preap/tests/test_vdas_grade_control.py::" +
"test_negative_command_handoff_keeps_grade_effort_separate"
),
),
HistoricalMutation(
name="negative-handoff-braking-effort-budget-removed",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=(
b" shared_effort_min = max(\n" +
b" effort_min,\n" +
b" previous_accel_effort - VDAS_DECEL_JERK_MAX * self.dt,\n" +
b" )\n"
),
replacement=b" shared_effort_min = effort_min\n",
test_node=(
"opendbc/car/tesla/preap/tests/test_vdas_grade_control.py::" +
"test_handoff_shares_command_jerk_budget_in_both_directions"
),
),
HistoricalMutation(
name="negative-handoff-recovery-effort-budget-removed",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=(
b" shared_effort_max = min(\n" +
b" effort_max,\n" +
b" previous_accel_effort + VDAS_ACCEL_JERK_MAX * self.dt,\n" +
b" )\n"
),
replacement=b" shared_effort_max = effort_max\n",
test_node=(
"opendbc/car/tesla/preap/tests/test_vdas_grade_control.py::" +
"test_handoff_shares_command_jerk_budget_in_both_directions"
),
),
HistoricalMutation(
name="negative-handoff-comfort-pedal-step-removed",
source_path="opendbc/car/tesla/preap/virtual_das.py",
original=b"NEGATIVE_HANDOFF_PEDAL_STEP = 0.50 # DI/update\n",
replacement=b"NEGATIVE_HANDOFF_PEDAL_STEP = PEDAL_RAMP_RATE_DOWN # DI/update\n",
test_node=(
"opendbc/car/tesla/preap/tests/test_vdas_grade_control.py::" +
"test_handoff_full_brake_and_recovery_stay_inside_comfort_pedal_step"
),
),
HistoricalMutation(
name="hidden-physical-profile-clipping",
source_path="opendbc/car/tesla/preap/virtual_das.py",
Expand Down
Loading
Loading