mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-07-10 18:22:06 +08:00
3e7240516e
* sp flags * pass CP_SP to card and car interfaces * CP_SP in radar interface * bump opendbc * use dataclass like old times * bump opendbc * write to params for controls * fix test models * fix * need to use copy instead * fix data type * add service * more * fix * Revert "fix" This reverts commit74723d7fb2. * Revert "fix data type" This reverts commit02355f44df. * missed * more * no more lagging * Reapply "fix data type" This reverts commitdbf1b8583f. * Reapply "fix" This reverts commit9cbce9968a. * Revert "Reapply "fix"" This reverts commit1871919b63. * Revert "Reapply "fix data type"" This reverts commit5e95752fd5. * no longer * Revert "no longer" This reverts commit66ee1ba151. * Reapply "Reapply "fix data type"" This reverts commit670a384333. * Reapply "Reapply "fix"" This reverts commit42f09f955c. * only for car params sp * rename * fix more test * no need for process replay * pass stock car params to sp set car params * pass stock car params to sp set car params * deprecate CarParams.sunnypilotFlags to CarParamsSP.flags * missed arg * fix tests * tests fixed * need to pass this too * must generate cp_sp! * fix typing * must be initialized prior can comm callback! * no more cancer (@devtekve) * remove more cancer * Refactor `get_non_essential_params_sp` to simplify arguments (#612) * Refactor 'get_non_essential_params_sp' function calls in tests In both `test_latcontrol.py` and `process_replay.py`, simplified the function calls to 'get_non_essential_params_sp'. Removed an unnecessary call to 'get_non_essential_params'. This change makes the code cleaner and more efficient by reducing redundancy in the function calls. This modification also ensures consistency across different code files. * Refactor get_non_essential_params_sp to take car_params. Simplify parameters by modifying `get_non_essential_params_sp` to use `car_params` as input. Adjust related calls in test files and process replay to match the updated method signature. This improves code clarity and reduces redundancy. * bump opendbc * Refactor parameter handling for `get_params_sp`. Removed unnecessary reassignment of `car_params` in calls to `get_params_sp`, ensuring a cleaner and more streamlined code structure. This change improves code clarity and eliminates redundant operations. All relevant assertions and behavior remain unaffected. * bumping opedbc * bump opendbc --------- Co-authored-by: DevTekVE <devtekve@gmail.com>
41 lines
1.6 KiB
Python
41 lines
1.6 KiB
Python
from parameterized import parameterized
|
|
|
|
from cereal import car, log
|
|
from opendbc.car.car_helpers import interfaces
|
|
from opendbc.car.honda.values import CAR as HONDA
|
|
from opendbc.car.toyota.values import CAR as TOYOTA
|
|
from opendbc.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, RadarInterface = interfaces[car_name]
|
|
CP = CarInterface.get_non_essential_params(car_name)
|
|
CP_SP = CarInterface.get_non_essential_params_sp(CP, car_name)
|
|
CI = CarInterface(CP, CP_SP, 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
|