mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-29 10:32:10 +08:00
80bc61dc6c
* Pose calibrator * Fix static analysis * Fix static * Fix test_latcontrol * Fix test_latcontrol * Update services in process replay * Fix static * Matmul not mul * Add assertion * Move pose calibration to data_sample * Update ref commit * Remove llk from cycle alerts * Deprecated nogps event * Switch power_draw to lp * Bring back noGps alert * Add handling code back * get_bool * Bring inputsok back old-commit-hash: 9734015bbb6d448bb6b0fb453370ec702fa73106
40 lines
1.5 KiB
Python
40 lines
1.5 KiB
Python
from parameterized import parameterized
|
|
|
|
from cereal import car, log
|
|
from openpilot.selfdrive.car.car_helpers import interfaces
|
|
from openpilot.selfdrive.car.honda.values import CAR as HONDA
|
|
from openpilot.selfdrive.car.toyota.values import CAR as TOYOTA
|
|
from openpilot.selfdrive.car.nissan.values import CAR as NISSAN
|
|
from openpilot.selfdrive.controls.lib.latcontrol_pid import LatControlPID
|
|
from openpilot.selfdrive.controls.lib.latcontrol_torque import LatControlTorque
|
|
from openpilot.selfdrive.controls.lib.latcontrol_angle import LatControlAngle
|
|
from openpilot.selfdrive.controls.lib.vehicle_model import VehicleModel
|
|
from openpilot.selfdrive.locationd.helpers import Pose
|
|
from openpilot.common.mock.generators import generate_livePose
|
|
|
|
|
|
class TestLatControl:
|
|
|
|
@parameterized.expand([(HONDA.HONDA_CIVIC, LatControlPID), (TOYOTA.TOYOTA_RAV4, LatControlTorque), (NISSAN.NISSAN_LEAF, LatControlAngle)])
|
|
def test_saturation(self, car_name, controller):
|
|
CarInterface, CarController, CarState = interfaces[car_name]
|
|
CP = CarInterface.get_non_essential_params(car_name)
|
|
CI = CarInterface(CP, CarController, CarState)
|
|
VM = VehicleModel(CP)
|
|
|
|
controller = controller(CP.as_reader(), CI)
|
|
|
|
CS = car.CarState.new_message()
|
|
CS.vEgo = 30
|
|
CS.steeringPressed = False
|
|
|
|
params = log.LiveParametersData.new_message()
|
|
|
|
lp = generate_livePose()
|
|
pose = Pose.from_live_pose(lp.livePose)
|
|
|
|
for _ in range(1000):
|
|
_, _, lac_log = controller.update(True, CS, VM, params, False, 1, pose)
|
|
|
|
assert lac_log.saturated
|