From 6f6548d5f46a02fbc9720a2ec7b579d3864c08d0 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 15 Jan 2025 20:04:45 -0800 Subject: [PATCH 1/3] log gas and brake again --- opendbc/car/toyota/carstate.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/opendbc/car/toyota/carstate.py b/opendbc/car/toyota/carstate.py index bd68d693a0..a204c23ab6 100644 --- a/opendbc/car/toyota/carstate.py +++ b/opendbc/car/toyota/carstate.py @@ -84,6 +84,12 @@ def update(self, can_parsers) -> structs.CarState: if self.CP.carFingerprint != CAR.TOYOTA_MIRAI: ret.engineRpm = cp.vl["ENGINE_RPM"]["RPM"] + if self.CP.flags & ToyotaFlags.HYBRID: + ret.brake = cp.vl["BRAKE"]["BRAKE_FORCE"] + ret.gas = cp.vl["GAS_PEDAL_HYBRID"]["GAS_PEDAL"] + else: + ret.gas = cp.vl["GAS_PEDAL"]["GAS_PEDAL"] + ret.wheelSpeeds = self.get_wheel_speeds( cp.vl["WHEEL_SPEEDS"]["WHEEL_SPEED_FL"], cp.vl["WHEEL_SPEEDS"]["WHEEL_SPEED_FR"], @@ -220,6 +226,12 @@ def get_can_parsers(CP): if CP.carFingerprint not in [CAR.TOYOTA_MIRAI]: pt_messages.append(("ENGINE_RPM", 42)) + if CP.flags & ToyotaFlags.HYBRID: + pt_messages.append(("BRAKE", 83)) + pt_messages.append(("GAS_PEDAL_HYBRID", 33)) + else: + pt_messages.append(("GAS_PEDAL", 33)) + pt_messages += [ ("GEAR_PACKET", 1), ] From c01e326bf4bdc767f4f229679eacafae2e25c3a1 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 15 Jan 2025 20:06:00 -0800 Subject: [PATCH 2/3] cmt --- opendbc/car/toyota/carstate.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/opendbc/car/toyota/carstate.py b/opendbc/car/toyota/carstate.py index a204c23ab6..31c1fb9357 100644 --- a/opendbc/car/toyota/carstate.py +++ b/opendbc/car/toyota/carstate.py @@ -85,10 +85,8 @@ def update(self, can_parsers) -> structs.CarState: ret.engineRpm = cp.vl["ENGINE_RPM"]["RPM"] if self.CP.flags & ToyotaFlags.HYBRID: - ret.brake = cp.vl["BRAKE"]["BRAKE_FORCE"] ret.gas = cp.vl["GAS_PEDAL_HYBRID"]["GAS_PEDAL"] - else: - ret.gas = cp.vl["GAS_PEDAL"]["GAS_PEDAL"] + ret.brake = cp.vl["BRAKE"]["BRAKE_FORCE"] # includes user and computer ret.wheelSpeeds = self.get_wheel_speeds( cp.vl["WHEEL_SPEEDS"]["WHEEL_SPEED_FL"], @@ -229,8 +227,6 @@ def get_can_parsers(CP): if CP.flags & ToyotaFlags.HYBRID: pt_messages.append(("BRAKE", 83)) pt_messages.append(("GAS_PEDAL_HYBRID", 33)) - else: - pt_messages.append(("GAS_PEDAL", 33)) pt_messages += [ ("GEAR_PACKET", 1), From bd5e0fbf5c4f24089009e2e18265de9550fcc214 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 15 Jan 2025 20:08:20 -0800 Subject: [PATCH 3/3] only user --- opendbc/car/toyota/carstate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/toyota/carstate.py b/opendbc/car/toyota/carstate.py index 31c1fb9357..73cc7c93db 100644 --- a/opendbc/car/toyota/carstate.py +++ b/opendbc/car/toyota/carstate.py @@ -86,7 +86,7 @@ def update(self, can_parsers) -> structs.CarState: if self.CP.flags & ToyotaFlags.HYBRID: ret.gas = cp.vl["GAS_PEDAL_HYBRID"]["GAS_PEDAL"] - ret.brake = cp.vl["BRAKE"]["BRAKE_FORCE"] # includes user and computer + ret.brake = cp.vl["BRAKE"]["BRAKE_AMOUNT"] ret.wheelSpeeds = self.get_wheel_speeds( cp.vl["WHEEL_SPEEDS"]["WHEEL_SPEED_FL"],