mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-10 14:33:42 +08:00
twitch 4
This commit is contained in:
@@ -83,7 +83,7 @@ def get_action_from_model(model_output: dict[str, np.ndarray], prev_action: log.
|
||||
lat_action_t)
|
||||
else:
|
||||
desired_accel = model_output['action'][0,1]
|
||||
desired_curvature = model_output['action'][0,0] / (max(2.5, v_ego))**2
|
||||
desired_curvature = model_output['action'][0,0] / (max(1.0, v_ego))**2
|
||||
stop = should_stop(v_ego, desired_accel)
|
||||
desired_accel = smooth_value(desired_accel, prev_action.desiredAcceleration, LONG_SMOOTH_SECONDS)
|
||||
if v_ego > MIN_LAT_CONTROL_SPEED:
|
||||
|
||||
@@ -25,7 +25,7 @@ def action_function():
|
||||
def test_action_curvature_low_speed_threshold(speed):
|
||||
previous = log.ModelDataV2.Action(desiredCurvature=0.01, desiredAcceleration=0.1)
|
||||
action = action_function()({"action": np.array([[0.25, 0.5]])}, previous, 0.2, 0.2, speed)
|
||||
expected = smooth_value(0.25 / max(2.5, speed) ** 2, 0.01, LAT_SMOOTH_SECONDS) if speed > 0.3 else 0.01
|
||||
expected = smooth_value(0.25 / max(1.0, speed) ** 2, 0.01, LAT_SMOOTH_SECONDS) if speed > 0.3 else 0.01
|
||||
assert action.desiredCurvature == pytest.approx(expected)
|
||||
assert action.desiredAcceleration == pytest.approx(smooth_value(0.5, 0.1, 0.3))
|
||||
assert not action.shouldStop
|
||||
|
||||
Reference in New Issue
Block a user