def run_following_distance_simulation(v_lead, t_end=100.0): man = Maneuver( '', duration=t_end, initial_speed=float(v_lead), lead_relevancy=True, initial_distance_lead=100, speed_lead_values=[v_lead], breakpoints=[0.], ) valid, output = man.evaluate() assert valid return output[-1, 2] - output[-1, 1]
def run_cruise_simulation(cruise, t_end=100.): man = Maneuver( '', duration=t_end, initial_speed=float(0.), lead_relevancy=True, initial_distance_lead=100, cruise_values=[cruise], prob_lead_values=[0.0], breakpoints=[0.], ) valid, output = man.evaluate() assert valid return output[-1,3]
def check_fcw(log): return any(log['fcw']) def check_engaged(log): return log['controls_state_msgs'][-1][-1].active maneuvers = [ Maneuver( 'while cruising at 40 mph, change cruise speed to 50mph', duration=30., initial_speed=40. * CV.MPH_TO_MS, cruise_button_presses=[(CB.DECEL_SET, 2.), (0, 2.3), (CB.RES_ACCEL, 10.), (0, 10.1), (CB.RES_ACCEL, 10.2), (0, 10.3)], checks=[check_engaged], ), Maneuver( 'while cruising at 60 mph, change cruise speed to 50mph', duration=30., initial_speed=60. * CV.MPH_TO_MS, cruise_button_presses=[(CB.DECEL_SET, 2.), (0, 2.3), (CB.DECEL_SET, 10.), (0, 10.1), (CB.DECEL_SET, 10.2), (0, 10.3)], checks=[check_engaged], ), Maneuver( 'while cruising at 20mph, grade change +10%',
#!/usr/bin/env python3 import os import unittest from common.params import Params from selfdrive.test.longitudinal_maneuvers.maneuver import Maneuver # TODO: make new FCW tests maneuvers = [ Maneuver( 'approach stopped car at 20m/s', duration=20., initial_speed=25., lead_relevancy=True, initial_distance_lead=120., speed_lead_values=[30., 0.], breakpoints=[0., 1.], ), Maneuver( 'approach stopped car at 20m/s', duration=20., initial_speed=20., lead_relevancy=True, initial_distance_lead=90., speed_lead_values=[20., 0.], breakpoints=[0., 1.], ), Maneuver( 'steady state following a car at 20m/s, then lead decel to 0mph at 1m/s^2', duration=50., initial_speed=20.,
#!/usr/bin/env python3 import os import unittest from common.params import Params from selfdrive.test.longitudinal_maneuvers.maneuver import Maneuver # TODO: make new FCW tests maneuvers = [ Maneuver( 'approach stopped car at 30m/s', duration=20., initial_speed=30., lead_relevancy=True, initial_distance_lead=120., speed_lead_values=[30., 0.], speed_lead_breakpoints=[0., 1.], ), Maneuver( 'approach stopped car at 20m/s', duration=20., initial_speed=20., lead_relevancy=True, initial_distance_lead=60., speed_lead_values=[20., 0.], speed_lead_breakpoints=[0., 1.], ), Maneuver( 'steady state following a car at 20m/s, then lead decel to 0mph at 1m/s^2', duration=50.,
def put_default_car_params(): from selfdrive.car.honda.values import CAR from selfdrive.car.honda.interface import CarInterface cp = CarInterface.get_params(CAR.CIVIC) Params().put("CarParams", cp.to_bytes()) # TODO: make new FCW tests maneuvers = [ Maneuver( 'steady state following a car at 20m/s, then lead decel to 0mph at 1m/s^2', duration=50., initial_speed=20., lead_relevancy=True, initial_distance_lead=35., speed_lead_values=[20., 20., 0.], speed_lead_breakpoints=[0., 15., 35.0], ), Maneuver( 'steady state following a car at 20m/s, then lead decel to 0mph at 2m/s^2', duration=50., initial_speed=20., lead_relevancy=True, initial_distance_lead=35., speed_lead_values=[20., 20., 0.], speed_lead_breakpoints=[0., 15., 25.0], ), Maneuver( 'steady state following a car at 20m/s, then lead decel to 0mph at 3m/s^2',
#!/usr/bin/env python3 import os import unittest from common.params import Params from selfdrive.controls.lib.longitudinal_mpc_lib.long_mpc import STOP_DISTANCE from selfdrive.test.longitudinal_maneuvers.maneuver import Maneuver # TODO: make new FCW tests maneuvers = [ Maneuver( 'approach stopped car at 20m/s, initial distance: 120m', duration=20., initial_speed=25., lead_relevancy=True, initial_distance_lead=120., speed_lead_values=[30., 0.], breakpoints=[0., 1.], ), Maneuver( 'approach stopped car at 20m/s, initial distance 90m', duration=20., initial_speed=20., lead_relevancy=True, initial_distance_lead=90., speed_lead_values=[20., 0.], breakpoints=[0., 1.], ), Maneuver( 'steady state following a car at 20m/s, then lead decel to 0mph at 1m/s^2', duration=50.,