IQ.Pilot Release Commit @ d2ce8a8
This commit is contained in:
@@ -135,7 +135,9 @@ def migrate_drivingModelData(msgs):
|
||||
setattr(dmd.drivingModelData, field, getattr(msg.modelV2, field))
|
||||
for meta_field in ["laneChangeState", "laneChangeState"]:
|
||||
setattr(dmd.drivingModelData.meta, meta_field, getattr(msg.modelV2.meta, meta_field))
|
||||
if len(msg.modelV2.laneLines) and len(msg.modelV2.laneLineProbs):
|
||||
lane_lines = msg.modelV2.laneLines
|
||||
lane_probs = msg.modelV2.laneLineProbs
|
||||
if len(lane_lines) > 2 and len(lane_probs) > 2 and len(lane_lines[1].y) and len(lane_lines[2].y):
|
||||
fill_lane_line_meta(dmd.drivingModelData.laneLineMeta, msg.modelV2.laneLines, msg.modelV2.laneLineProbs)
|
||||
if all(len(a) for a in [msg.modelV2.position.x, msg.modelV2.position.y, msg.modelV2.position.z]):
|
||||
fill_xyz_poly(dmd.drivingModelData.path, ModelConstants.POLY_PATH_DEGREE, msg.modelV2.position.x, msg.modelV2.position.y, msg.modelV2.position.z)
|
||||
|
||||
19
iqpilot/selfdrive/test/process_replay/test_migration.py
Normal file
19
iqpilot/selfdrive/test/process_replay/test_migration.py
Normal file
@@ -0,0 +1,19 @@
|
||||
"""
|
||||
Copyright © IQ.Lvbs, apart of Project Teal Lvbs, All Rights Reserved, licensed under https://konn3kt.com/tos
|
||||
"""
|
||||
from iqpilot.cereal import messaging
|
||||
from iqpilot.selfdrive.test.process_replay.migration import migrate_drivingModelData
|
||||
|
||||
|
||||
def test_driving_model_migration_ignores_incomplete_lane_metadata():
|
||||
msg = messaging.new_message("modelV2")
|
||||
msg.modelV2.init("laneLines", 4)
|
||||
for lane_line in msg.modelV2.laneLines:
|
||||
lane_line.y = [1.0]
|
||||
msg.modelV2.laneLineProbs = [0.5]
|
||||
|
||||
_, added, _ = migrate_drivingModelData([(0, msg.as_reader())])
|
||||
|
||||
assert len(added) == 1
|
||||
assert added[0].drivingModelData.laneLineMeta.leftProb == 0.0
|
||||
assert added[0].drivingModelData.laneLineMeta.rightProb == 0.0
|
||||
Reference in New Issue
Block a user