mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-16 23:02:07 +08:00
controlsd: ensure actuators packet is finite (#21958)
* controlsd: ensure actuators packet is finite * do not hardcode fields * cleaner way to get fields * move line up old-commit-hash: 4fcd51e0215d5f81a343d2f12108ad1528ab496e
This commit is contained in:
@@ -37,6 +37,8 @@ IGNORE_PROCESSES = {"rtshield", "uploader", "deleter", "loggerd", "logmessaged",
|
||||
"logcatd", "proclogd", "clocksd", "updated", "timezoned", "manage_athenad"} | \
|
||||
{k for k, v in managed_processes.items() if not v.enabled}
|
||||
|
||||
ACTUATOR_FIELDS = set(car.CarControl.Actuators.schema.fields.keys())
|
||||
|
||||
ThermalStatus = log.DeviceState.ThermalStatus
|
||||
State = log.ControlsState.OpenpilotState
|
||||
PandaType = log.PandaState.PandaType
|
||||
@@ -500,6 +502,12 @@ class Controls:
|
||||
if left_deviation or right_deviation:
|
||||
self.events.add(EventName.steerSaturated)
|
||||
|
||||
# Ensure no NaNs/Infs
|
||||
for p in ACTUATOR_FIELDS:
|
||||
if not math.isfinite(getattr(actuators, p)):
|
||||
cloudlog.error(f"actuators.{p} not finite {actuators.to_dict()}")
|
||||
setattr(actuators, p, 0.0)
|
||||
|
||||
return actuators, lac_log
|
||||
|
||||
def publish_logs(self, CS, start_time, actuators, lac_log):
|
||||
|
||||
Reference in New Issue
Block a user