From 0bbfc63c9c11bab25767ef10cea5b70b520cba7f Mon Sep 17 00:00:00 2001 From: Keyvan Fatehi Date: Sun, 1 May 2022 18:41:50 -0700 Subject: [PATCH] body: add fuelGauge to body carState (#24386) --- cereal | 2 +- selfdrive/car/body/carstate.py | 2 ++ selfdrive/test/process_replay/ref_commit | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cereal b/cereal index a1f97eaca..8e9e9d3ce 160000 --- a/cereal +++ b/cereal @@ -1 +1 @@ -Subproject commit a1f97eaca24a04e778c2326e6c992b1e3943429a +Subproject commit 8e9e9d3ceef850c3c759ac39737bbfbd5801cea5 diff --git a/selfdrive/car/body/carstate.py b/selfdrive/car/body/carstate.py index 520aab8fa..9d9e9b84c 100644 --- a/selfdrive/car/body/carstate.py +++ b/selfdrive/car/body/carstate.py @@ -20,6 +20,8 @@ class CarState(CarStateBase): ret.steerFaultPermanent = any([cp.vl['VAR_VALUES']['MOTOR_ERR_L'], cp.vl['VAR_VALUES']['MOTOR_ERR_R'], cp.vl['VAR_VALUES']['FAULT']]) + ret.fuelGauge = cp.vl["BODY_DATA"]["BATT_PERCENTAGE"] / 100 + # irrelevant for non-car ret.gearShifter = car.CarState.GearShifter.drive ret.cruiseState.enabled = True diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index b870f9846..bf3824224 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -d17ecea1f071007193a8a1e1ececf78c96b9deac \ No newline at end of file +9385014c512d253655f574d77fe1e07558f4157d \ No newline at end of file