l1.5-safety-system/safety_user_plugin/scripts/robot_info.py
2018-09-18 19:09:59 +02:00

19 lines
783 B
Python

#!/usr/bin/env python
class RobotInfo:
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):
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]
self.state = robot_info_msg.state.data
self.clutch = robot_info_msg.clutch.data