Files
sunnypilot/selfdrive/test/longitudinal_maneuvers/test_accel.py
T
Jason Wen bbf530027c GAC: Gap Adjust Cruise implementation (#44)
* Gap Adjust Cruise (GAC): init

* cs: add longitudinal supported cars

* disable for Toyota for now

* send to car cluster

* more

* KrKeegan: More Aggresive Start from Standstill

* fix

* set prev button after

* init bool

* wrong var

* use common update param function

* bruh no wonder why

* lock to default distance when using exp mode

* make vw match other makes

* implement ui button

* gate ui button

* log desired_TF

* move button

* only show when cruise state available

* only allow press when cruise state available

* Revert "KrKeegan: More Aggresive Start from Standstill"

This reverts commit 20bdff34c83d5a0c248d6996155c995c8a99810f.

* unnecessary

* nothing else

* pass it through

* add toyota support

* fixup! add toyota support

* oops, necessary

* don't show ui button when using e2e long

* different signal to use

* Forgot to update

* Clean it up?

* this?

* ugh

* force int!!

* convert then round

* hide when in exp mode

* toyota: log button

* Revert "different signal to use"

This reverts commit edc64d31af527af842aabe2934e5720f73bf75cc.

* toyota flippy flippy

* wrong signal for vw

* oops
2023-02-24 17:41:52 -05:00

58 lines
1.4 KiB
Python

#!/usr/bin/env python3
import os
import unittest
from common.params import Params
from selfdrive.test.longitudinal_maneuvers.maneuver import Maneuver
maneuvers = [
# In Stock with jerk cost of 5.0 this results in a maximum desired_dist_diff of 51m
# Setting jerk cost to 0 drops it down to 25m
# Setting jerk cost to .5 drops it down to 38m
Maneuver(
'Start from standstill behind car acc at 1.2m/s',
duration=20.,
initial_speed=0.,
lead_relevancy=True,
initial_distance_lead=4, # In real world the stopping distance is less than desired
speed_lead_values=[0., 12., 12.],
breakpoints=[0., 10., 20.],
cruise_values=[35., 35., 35.],
),
]
class LongitudinalControl(unittest.TestCase):
@classmethod
def setUpClass(cls):
os.environ['SIMULATION'] = "1"
os.environ['SKIP_FW_QUERY'] = "1"
os.environ['NO_CAN_TIMEOUT'] = "1"
params = Params()
params.clear_all()
params.put_bool("Passive", bool(os.getenv("PASSIVE")))
params.put_bool("OpenpilotEnabledToggle", True)
# hack
def test_longitudinal_setup(self):
pass
def run_maneuver_worker(k):
def run(self):
man = maneuvers[k]
print(man.title)
valid, _ = man.evaluate()
self.assertTrue(valid, msg=man.title)
return run
for k in range(len(maneuvers)):
setattr(LongitudinalControl, f"test_longitudinal_maneuvers_{k+1}",
run_maneuver_worker(k))
if __name__ == "__main__":
unittest.main(failfast=True)