Skip to content

Commit

Permalink
More specific state messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
AileenCleary committed Sep 18, 2024
1 parent bab8c67 commit 2f3dcdb
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 21 deletions.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion src/mir_driver/mir_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()
Expand Down
33 changes: 14 additions & 19 deletions src/mir_rest_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 2f3dcdb

Please sign in to comment.