mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-11 10:43:46 +08:00
meb
This commit is contained in:
@@ -109,6 +109,7 @@ class RadarInterfaceBase(ABC):
|
||||
self.CP = CP
|
||||
self.rcp = None
|
||||
self.pts: dict[int, structs.RadarData.RadarPoint] = {}
|
||||
self.track_id: int = 0
|
||||
self.frame = 0
|
||||
|
||||
def update(self, can_packets: list[tuple[int, list[CanData]]]) -> structs.RadarDataT | None:
|
||||
|
||||
@@ -243,6 +243,8 @@ VOLKSWAGEN_MQB_MEB_CONSTANTS: dict[int, list[int]] = {
|
||||
0xC5, 0x91, 0x0F, 0x27, 0x34, 0x04, 0x7F, 0x02], # EA_02
|
||||
0x20A: [0x9D, 0xE8, 0x36, 0xA1, 0xCA, 0x3B, 0x1D, 0x33,
|
||||
0xE0, 0xD5, 0xBB, 0x5F, 0xAE, 0x3C, 0x31, 0x9F], # EML_06
|
||||
0x25D: [0xDA, 0x6B, 0x0E, 0xB2, 0x78, 0xBD, 0x5A, 0x81,
|
||||
0x7B, 0xD6, 0x41, 0x39, 0x76, 0xB6, 0xD7, 0x35], # KLR_01
|
||||
0x26B: [0xCE, 0xCC, 0xBD, 0x69, 0xA1, 0x3C, 0x18, 0x76,
|
||||
0x0F, 0x04, 0xF2, 0x3A, 0x93, 0x24, 0x19, 0x51], # TA_01
|
||||
0x30C: [0x0F] * 16, # ACC_02
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
import random
|
||||
import re
|
||||
|
||||
import pytest
|
||||
|
||||
from opendbc.can.packer import CANPacker
|
||||
from opendbc.car import Bus
|
||||
from opendbc.car.structs import CarParams
|
||||
from opendbc.car.volkswagen.interface import CarInterface
|
||||
from opendbc.car.volkswagen.values import CAR, FW_QUERY_CONFIG, WMI, VolkswagenFlags, VolkswagenSafetyFlags
|
||||
from opendbc.car.volkswagen.fingerprints import FW_VERSIONS
|
||||
from opendbc.car.volkswagen.mqbcan import volkswagen_mqb_meb_checksum
|
||||
from opendbc.car.volkswagen.radar_interface import RadarInterface
|
||||
from opendbc.car.volkswagen.values import CAR, DBC, FW_QUERY_CONFIG, WMI, CanBus, VolkswagenFlags, VolkswagenSafetyFlags
|
||||
|
||||
Ecu = CarParams.Ecu
|
||||
|
||||
@@ -60,6 +66,35 @@ class TestVolkswagenPlatformConfigs:
|
||||
assert not cp.pcmCruise
|
||||
assert cp.safetyConfigs[-1].safetyParam & VolkswagenSafetyFlags.LONG_CONTROL
|
||||
|
||||
@pytest.mark.parametrize("data_hex", (
|
||||
"fc03fcfcfc0f0000",
|
||||
"e304fcfcfc0f0000",
|
||||
"1105fcfcfc0f0000",
|
||||
))
|
||||
def test_meb_klr_checksum(self, data_hex):
|
||||
data = bytearray.fromhex(data_hex)
|
||||
assert volkswagen_mqb_meb_checksum(0x25D, None, data) == data[0]
|
||||
|
||||
def test_meb_camera_radar_tracks(self):
|
||||
cp = self._get_meb_params(CAR.SKODA_ENYAQ_MK1)
|
||||
radar = RadarInterface(cp)
|
||||
packer = CANPacker(DBC[cp.carFingerprint][Bus.radar])
|
||||
message = packer.make_can_msg("MEB_Distance_01", CanBus(cp).cam, {
|
||||
"Distance_Status": 0,
|
||||
"Same_Lane_01_ObjectID": 1,
|
||||
"Same_Lane_01_Long_Distance": 25.0,
|
||||
"Same_Lane_01_Lat_Distance": 0.5,
|
||||
"Same_Lane_01_Rel_Velo": -2.0,
|
||||
})
|
||||
|
||||
radar_data = radar.update([(1_000_000_000, [message])])
|
||||
assert radar_data is not None
|
||||
assert len(radar_data.points) == 1
|
||||
assert radar_data.points[0].trackId == 0
|
||||
assert radar_data.points[0].dRel == pytest.approx(25.0, abs=0.1)
|
||||
assert radar_data.points[0].yRel == pytest.approx(0.5, abs=0.1)
|
||||
assert radar_data.points[0].vRel == pytest.approx(-2.0, abs=0.1)
|
||||
|
||||
def test_taos_longitudinal_actuator_delay(self):
|
||||
taos_cp = CarInterface.get_non_essential_params(CAR.VOLKSWAGEN_TAOS_MK1)
|
||||
golf_cp = CarInterface.get_non_essential_params(CAR.VOLKSWAGEN_GOLF_MK7)
|
||||
|
||||
Reference in New Issue
Block a user