2018-09-17 19:41:31 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2018-09-19 21:20:04 +02:00
|
|
|
from enums.clutch_state import ClutchState as CS
|
|
|
|
from enums.stop_state import StopState as SS
|
|
|
|
|
2018-09-17 19:41:31 +02:00
|
|
|
class RobotInfo:
|
|
|
|
|
2018-09-18 19:09:59 +02:00
|
|
|
def __init__(self,robot_id):
|
|
|
|
self.robot_id = robot_id
|
|
|
|
self.battery_voltage = None
|
|
|
|
self.linear_velocity = None
|
|
|
|
self.angular_velocity = None
|
|
|
|
self.state = None
|
|
|
|
self.clutch = None
|
|
|
|
|
|
|
|
def update_robot_info(self,robot_info_msg):
|
2018-09-18 02:29:14 +02:00
|
|
|
self.robot_id = robot_info_msg.robot_id.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.angular_velocity = [robot_info_msg.twist.angular.x,robot_info_msg.twist.angular.y,robot_info_msg.twist.angular.z]
|
2018-09-19 21:20:04 +02:00
|
|
|
|
|
|
|
if robot_info_msg.state.data == True:
|
|
|
|
self.state = SS.RUNNING
|
|
|
|
else:
|
|
|
|
self.state = SS.STOPPED
|
|
|
|
|
|
|
|
if robot_info_msg.clutch.data == True:
|
|
|
|
self.clutch = CS.ENGAGED
|
|
|
|
else:
|
|
|
|
self.clutch = CS.DISENGAGED
|