mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-07 04:53:47 +08:00
a82935f326
Integrate onroad views, configurable widgets, local settings, steering-profile contracts, Bluetooth and Android Auto with their device and runtime services. Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> Co-authored-by: Daniel Koepping <elkoled@gmail.com> Co-authored-by: Danny <dannyirwin31@yahoo.com> Co-authored-by: DimitriChrysafis <Dimitri.chrysafis@gmail.com> Co-authored-by: Dom <168790843+firestar5683@users.noreply.github.com> Co-authored-by: Harald Schäfer <harald.the.engineer@gmail.com> Co-authored-by: Prabhaav Pillai <prabhaav@msu.edu> Co-authored-by: Shane Smiskol <shane@smiskol.com> Co-authored-by: dirwin31 <83434411+dirwin31@users.noreply.github.com> Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com> Co-authored-by: stef <19478336+stefpi@users.noreply.github.com> Co-authored-by: whoisdomi <dcantu83@gmail.com> Co-authored-by: Intelli <contact@intelli.software> Co-authored-by: pharmacomaniac <blittle65@gmail.com> Co-authored-by: prabhaavp <prabhaav@msu.edu>
39 lines
1.5 KiB
Python
39 lines
1.5 KiB
Python
from openpilot.common.test import OpenpilotTestCase
|
|
from openpilot.common.parameterized import parameterized
|
|
|
|
from openpilot.cereal import log
|
|
from opendbc.car.structs import car
|
|
from opendbc.car.car_helpers import interfaces
|
|
from opendbc.car.toyota.values import CAR as TOYOTA
|
|
from opendbc.car.vehicle_model import VehicleModel
|
|
from openpilot.common.realtime import DT_CTRL
|
|
from openpilot.selfdrive.controls.lib.latcontrol_torque import LatControlTorque, LAT_ACCEL_REQUEST_BUFFER_SECONDS
|
|
|
|
def get_controller(car_name):
|
|
CarInterface = interfaces[car_name]
|
|
CP = CarInterface.get_non_essential_params(car_name)
|
|
CI = CarInterface(CP)
|
|
VM = VehicleModel(CP)
|
|
controller = LatControlTorque(CP.as_reader(), CI, DT_CTRL)
|
|
return controller, VM
|
|
|
|
class TestLatControlTorqueBuffer(OpenpilotTestCase):
|
|
|
|
@parameterized.expand([(TOYOTA.TOYOTA_RAV4_TSS2,)])
|
|
def test_request_buffer_consistency(self, car_name):
|
|
buffer_steps = int(LAT_ACCEL_REQUEST_BUFFER_SECONDS / DT_CTRL)
|
|
controller, VM = get_controller(car_name)
|
|
|
|
CS = car.CarState.new_message()
|
|
CS.vEgo = 30
|
|
CS.steeringPressed = False
|
|
params = log.VehicleParameters.new_message()
|
|
|
|
for _ in range(buffer_steps):
|
|
controller.update(True, CS, VM, params, False, 0.001, False, 0.2)
|
|
assert all(val != 0 for val in controller.lat_accel_request_buffer)
|
|
|
|
for _ in range(buffer_steps):
|
|
controller.update(False, CS, VM, params, False, 0.0, False, 0.2)
|
|
assert all(val == 0 for val in controller.lat_accel_request_buffer)
|