diff --git a/README.md b/README.md index 9dba7bb..55f4559 100644 --- a/README.md +++ b/README.md @@ -1 +1,23 @@ -# mir_module +# MiR Base 250 Module + +## Overview + +The 'mir_module' repository is a comprehensive package that includes a MiR driver and REST node compatible with Mobile Industrial Robots (MiR) MiR 250 Base robot. This module is designed to provide a comprehensive and intuitive approach to controlling and interacting with a MiR 250. The repository allows for both immediate, simplified control of the MiR along with higher-level development of complex missions and experiments. + +## Features + +### MiR 250 Driver Package + +The MiR 250 driver package in this repository supports various methods to enable complete and comprehensive control of your MiR base robot and development of both simple and complex missions and environments. Key focuses and functions of the driver include: + +1. **Debugging and Development** + - Methods such as *get_actions* and *get_action_type* provide detailed information on the types of actions available to the MiR and the necessary parameters for continued development. + +2. **Mission Queue Configuration and Monitoring** + - Upon initialization of your MiR_Base robot, a new mission "session" is started. Functions related to mission queues will refer only to missions started during the session. The session can be reset after initialization as desired. + +3. **High-Level, Multi-Action Mission Development** + +4. **Simplified and Immediate MiR Control** + +... WIP diff --git a/src/mir_driver/mir_driver.py b/src/mir_driver/mir_driver.py index a3ebdfd..807b9f3 100644 --- a/src/mir_driver/mir_driver.py +++ b/src/mir_driver/mir_driver.py @@ -689,7 +689,6 @@ def get_state(self): url = "status/?whitelist=state_text" state = self.receive_response(url, False).get("state_text") print(state.upper()) - self.status = state.upper() return state.upper() @@ -800,6 +799,10 @@ def wait(self, delay_seconds): # for i in range(1): # mir_base.move("test_move") # mir_base.move("another_move") + # print(mir_base.get_state()) + # print(mir_base.get_state()) + # print(mir_base.get_state()) + # print(mir_base.get_state()) # time.sleep(20) # mir_base.check_queue_completion() # mir_base.abort_mission_queue() diff --git a/src/mir_rest_node.py b/src/mir_rest_node.py index a004126..f629c55 100644 --- a/src/mir_rest_node.py +++ b/src/mir_rest_node.py @@ -41,28 +41,23 @@ def mir_startup(state: State): @rest_module.state_handler() -def state( - state: State, -): # ** TBD, added "EXECUTING" state to "ModuleStatus" because MiR can be ready to accept missions but also executing them. Need to test if this works. +def state(state: State): """Returns the current state of the UR module""" - if state.status not in [ - ModuleStatus.ERROR, - ModuleStatus.INIT, - None, - ]: - if state.mir.status == "BUSY": - state.status = ModuleStatus.BUSY - elif state.mir.status == "IDLE": + if state.mir.status != "BUSY": + robot_state = state.mir.get_state() + if robot_state == "ERROR": + state.status = ModuleStatus.ERROR # MiR state messages do not align. IDLE should be READY, I believe. Need to run MiR to determine other state messages. + error = "" + elif robot_state == "EXECUTING": state.status = ModuleStatus.IDLE + error = "Executing current mission, can still accept more missions." else: - state.mir.status = state.mir.get_state() - if state.mir.status in ["READY", "IDLE"]: - state.status = ModuleStatus.IDLE - elif state.mir.status in ["PENDING", "EXECUTING"]: - state.status = ModuleStatus.EXECUTING - else: - state.status = ModuleStatus.ERROR - return ModuleState(status=state.status, error="") + state.status = ModuleStatus.IDLE + error = "All missions complete." + else: + state.status = ModuleStatus.BUSY + error = "Waiting for other modules to finish." + return ModuleState(status=state.status, error=error) @rest_module.action(