fix snapshot camerad crash due to core affinity setting (#22648)

Co-authored-by: Comma Device <device@comma.ai>
pull/22649/head
Adeeb Shihadeh 2021-10-21 00:26:01 -07:00 committed by GitHub
parent dffff03c37
commit e9cb2104e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 10 deletions

View File

@ -11,7 +11,7 @@ import cereal.messaging as messaging
from common.params import Params
from common.realtime import DT_MDL
from common.transformations.camera import eon_f_frame_size, eon_d_frame_size, tici_f_frame_size
from selfdrive.hardware import TICI
from selfdrive.hardware import HARDWARE, TICI
from selfdrive.controls.lib.alertmanager import set_offroad_alert
from selfdrive.manager.process_config import managed_processes
@ -88,20 +88,23 @@ def snapshot():
os.environ["SEND_ROAD"] = "1"
os.environ["SEND_WIDE_ROAD"] = "1"
if front_camera_allowed:
os.environ["SEND_DRIVER"] = "1"
managed_processes['camerad'].start()
frame = "wideRoadCameraState" if TICI else "roadCameraState"
front_frame = "driverCameraState" if front_camera_allowed else None
focus_perc_threshold = 0. if TICI else 10 / 12.
try:
HARDWARE.set_power_save(False)
managed_processes['camerad'].start()
frame = "wideRoadCameraState" if TICI else "roadCameraState"
front_frame = "driverCameraState" if front_camera_allowed else None
focus_perc_threshold = 0. if TICI else 10 / 12.
rear, front = get_snapshots(frame, front_frame, focus_perc_threshold)
managed_processes['camerad'].stop()
rear, front = get_snapshots(frame, front_frame, focus_perc_threshold)
finally:
managed_processes['camerad'].stop()
HARDWARE.set_power_save(True)
params.put_bool("IsTakingSnapshot", False)
set_offroad_alert("Offroad_IsTakingSnapshot", False)
params.put_bool("IsTakingSnapshot", False)
set_offroad_alert("Offroad_IsTakingSnapshot", False)
if not front_camera_allowed:
front = None