Skip to content

Commit

Permalink
check can err
Browse files Browse the repository at this point in the history
  • Loading branch information
KmakD committed May 22, 2023
1 parent 07315ae commit 3f404b7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions panther_battery/src/roboteq_republisher_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ def __init__(self, name: str) -> None:

def _motor_controllers_state_cb(self, msg: DriverState) -> None:
with self._lock:
# don't update battery data if can communication error occurred
if msg.front.fault_flag.can_net_err or msg.rear.fault_flag.can_net_err:
return

new_voltage = (msg.front.voltage + msg.rear.voltage) / 2.0

self._last_battery_info_time = rospy.get_time()
Expand Down

0 comments on commit 3f404b7

Please sign in to comment.