l1.5-safety-system/safety_user_plugin/scripts/user_info.py

35 lines
1.1 KiB
Python
Raw Normal View History

#!/usr/bin/env python
2018-09-17 21:39:35 +02:00
from robot_info import RobotInfo
class UserInfo:
2018-09-17 21:39:35 +02:00
def __init__(self):
self.selected_robot = None
self.robots_id_list = []
self.user_stop_state = None
self.master_stop_state = None
self.clutch_state = None
def select_robot(self,robot_id):
self.selected_robot = RobotInfo(robot_id)
def release_robot(self):
2018-09-17 21:39:35 +02:00
self.selected_robot = None
2018-09-17 21:39:35 +02:00
def update_robots_id_list(self,robots_id_list):
2018-09-18 01:46:10 +02:00
self.robots_id_list = robots_id_list
def update_selected_robot_info(self,new_robot_info):
2018-09-18 21:47:49 +02:00
self.selected_robot.robot_id = new_robot_info.robot_id
self.selected_robot.battery_voltage = new_robot_info.battery_voltage
self.selected_robot.linear_velocity = new_robot_info.linear_velocity
self.selected_robot.angular_velocity = new_robot_info.angular_velocity
self.selected_robot.state = new_robot_info.state
self.selected_robot.clutch = new_robot_info.clutch
2018-09-18 01:46:10 +02:00
def get_user_stop_state(self):
return self.user_stop_state
def get_clutch_state(self):
return self.clutch_state