Signed-off-by: Jakub Delicat <delicat.kuba@gmail.com>
This commit is contained in:
Jakub Delicat 2023-08-16 16:33:44 +02:00
parent 7360abc3f4
commit 21d327c74f

View File

@ -3,8 +3,8 @@
from safety_master_plugin.clutch_state import ClutchState as CS from safety_master_plugin.clutch_state import ClutchState as CS
from safety_master_plugin.stop_state import StopState as SS from safety_master_plugin.stop_state import StopState as SS
class RobotInfo:
class RobotInfo:
def __init__(self, robot_id): def __init__(self, robot_id):
self.robot_id = robot_id self.robot_id = robot_id
self.battery_voltage = None self.battery_voltage = None
@ -16,15 +16,23 @@ class RobotInfo:
def update_robot_info(self, robot_info_msg): def update_robot_info(self, robot_info_msg):
self.robot_id = robot_info_msg.robot_id.data self.robot_id = robot_info_msg.robot_id.data
self.battery_voltage = robot_info_msg.battery_voltage.data self.battery_voltage = robot_info_msg.battery_voltage.data
self.linear_velocity = [robot_info_msg.twist.linear.x,robot_info_msg.twist.linear.y,robot_info_msg.twist.linear.z] self.linear_velocity = [
self.angular_velocity = [robot_info_msg.twist.angular.x,robot_info_msg.twist.angular.y,robot_info_msg.twist.angular.z] robot_info_msg.twist.linear.x,
robot_info_msg.twist.linear.y,
robot_info_msg.twist.linear.z,
]
self.angular_velocity = [
robot_info_msg.twist.angular.x,
robot_info_msg.twist.angular.y,
robot_info_msg.twist.angular.z,
]
if robot_info_msg.state.data == True: if robot_info_msg.state.data is True:
self.state = SS.RUNNING self.state = SS.RUNNING
else: else:
self.state = SS.STOPPED self.state = SS.STOPPED
if robot_info_msg.clutch.data == True: if robot_info_msg.clutch.data is True:
self.clutch = CS.ENGAGED self.clutch = CS.ENGAGED
else: else:
self.clutch = CS.DISENGAGED self.clutch = CS.DISENGAGED