cereal cleanup part 2 (#20092)

* car stuff

* thermal

* Revert "car stuff"

This reverts commit 77fd1c65ebd01abfa8493ae12c9e6b14f7ada976.

* panda state

* camera stuff

* start deg

* most is building

* builds

* planner + controls run

* fix up paramsd

* cleanup

* process replay passes

* fix webcam build

* camerad

* no more frame

* thermald

* ui

* paramsd

* camera replay

* fix long tests

* fix camerad tests

* maxSteeringAngle

* bump cereal

* more frame

* cereal master
old-commit-hash: 312b681a46b8153314a8420611b6479dd6f70dfc
This commit is contained in:
Adeeb Shihadeh
2021-02-16 21:39:32 -08:00
committed by GitHub
parent 29d994027f
commit 05eb44115e
86 changed files with 500 additions and 515 deletions
+6 -6
View File
@@ -16,11 +16,11 @@ def cycle_alerts(duration=200, is_metric=False):
print(alerts)
CP = CarInterface.get_params("HONDA CIVIC 2016 TOURING")
sm = messaging.SubMaster(['thermal', 'health', 'frame', 'model', 'liveCalibration',
'driverMonitoringState', 'plan', 'lateralPlan', 'liveLocationKalman'])
sm = messaging.SubMaster(['deviceState', 'pandaState', 'roadCameraState', 'modelV2', 'liveCalibration',
'driverMonitoringState', 'longitudinalPlan', 'lateralPlan', 'liveLocationKalman'])
controls_state = messaging.pub_sock('controlsState')
thermal = messaging.pub_sock('thermal')
deviceState = messaging.pub_sock('deviceState')
idx, last_alert_millis = 0, 0
@@ -56,9 +56,9 @@ def cycle_alerts(duration=200, is_metric=False):
controls_state.send(dat.to_bytes())
dat = messaging.new_message()
dat.init('thermal')
dat.thermal.started = True
thermal.send(dat.to_bytes())
dat.init('deviceState')
dat.deviceState.started = True
deviceState.send(dat.to_bytes())
frame += 1
time.sleep(0.01)
@@ -4,7 +4,7 @@ import cereal.messaging as messaging
if __name__ == "__main__":
sm = messaging.SubMaster(['thermal', 'health', 'model', 'liveCalibration', 'driverMonitoringState', 'plan', 'lateralPlan'])
sm = messaging.SubMaster(['deviceState', 'pandaState', 'modelV2', 'liveCalibration', 'driverMonitoringState', 'longitudinalPlan', 'lateralPlan'])
i = 0
while True:
@@ -47,7 +47,7 @@ if __name__ == "__main__":
if cnt >= 500:
# calculate error before rounding
actual_angle = sm['controlsState'].angleSteers
desired_angle = sm['carControl'].actuators.steerAngle
desired_angle = sm['carControl'].actuators.steeringAngleDeg
angle_error = abs(desired_angle - actual_angle)
# round numbers
@@ -19,7 +19,7 @@ if __name__ == "__main__":
os.environ["LD_LIBRARY_PATH"] = ""
sm = messaging.SubMaster(["thermal"])
sm = messaging.SubMaster(["deviceState"])
FNULL = open(os.devnull, "w")
start_time = time.time()
@@ -42,4 +42,4 @@ if __name__ == "__main__":
s = time.time() - start_time
hhmmss = str(datetime.timedelta(seconds=s)).split(".")[0]
print("test duration:", hhmmss)
print("\tbattery percent", sm["thermal"].batteryPercent)
print("\tbattery percent", sm["deviceState"].batteryPercent)
+5 -5
View File
@@ -33,7 +33,7 @@ if __name__ == "__main__":
parser.add_argument('--cpu', action='store_true')
args = parser.parse_args()
sm = SubMaster(['thermal', 'procLog'])
sm = SubMaster(['deviceState', 'procLog'])
last_temp = 0.0
last_mem = 0.0
@@ -46,10 +46,10 @@ if __name__ == "__main__":
while True:
sm.update()
if sm.updated['thermal']:
t = sm['thermal']
last_temp = mean(t.cpu)
last_mem = t.memUsedPercent
if sm.updated['deviceState']:
t = sm['deviceState']
last_temp = mean(t.cpuTempC)
last_mem = t.memoryUsagePercent
if sm.updated['procLog']:
m = sm['procLog']
+2 -2
View File
@@ -46,8 +46,8 @@ if __name__ == "__main__":
lr = LogReader(qlog_path)
for msg in lr:
if msg.which() == "health":
if msg.health.pandaType not in ['uno', 'blackPanda']:
if msg.which() == "pandaState":
if msg.pandaState.pandaType not in ['uno', 'blackPanda']:
dongles.append(dongle_id)
break
+5 -5
View File
@@ -3,20 +3,20 @@ import time
import cereal.messaging as messaging
from selfdrive.manager import start_managed_process, kill_managed_process
services = ['controlsState', 'thermal', 'radarState'] # the services needed to be spoofed to start ui offroad
services = ['controlsState', 'deviceState', 'radarState'] # the services needed to be spoofed to start ui offroad
procs = ['camerad', 'ui', 'modeld', 'calibrationd']
[start_managed_process(p) for p in procs] # start needed processes
pm = messaging.PubMaster(services)
dat_cs, dat_thermal, dat_radar = [messaging.new_message(s) for s in services]
dat_cs, dat_deviceState, dat_radar = [messaging.new_message(s) for s in services]
dat_cs.controlsState.rearViewCam = False # ui checks for these two messages
dat_thermal.thermal.started = True
dat_deviceState.deviceState.started = True
try:
while True:
pm.send('controlsState', dat_cs)
pm.send('thermal', dat_thermal)
pm.send('deviceState', dat_deviceState)
pm.send('radarState', dat_radar)
time.sleep(1 / 100) # continually send, rate doesn't matter for thermal
time.sleep(1 / 100) # continually send, rate doesn't matter for deviceState
except KeyboardInterrupt:
[kill_managed_process(p) for p in procs]