Skip to content

Commit 40d2c33

Browse files
committed
working version
1 parent 24e2578 commit 40d2c33

9 files changed

Lines changed: 2144 additions & 7 deletions

File tree

.madsci/registry.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"version": 1,
3+
"created_at": "2026-04-10T18:48:42.671753Z",
4+
"updated_at": "2026-04-22T19:30:07.188732Z",
5+
"entries": {
6+
"mir_node": {
7+
"id": "01KNWBK6DFKD8A0BW9MQD7X8Z2",
8+
"component_type": "node",
9+
"created_at": "2026-04-10T18:48:42.671780Z",
10+
"last_seen": "2026-04-22T19:30:06.803122Z",
11+
"metadata": {
12+
"module_name": "mir_node"
13+
},
14+
"lock": null,
15+
"workcell_id": null
16+
}
17+
}
18+
}

.pdm-python

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/home/rpl/workspace/mir_module/.venv/bin/python

pdm.lock

Lines changed: 2054 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ dependencies = [
1818
"fastapi>=0.103.2",
1919
"uvicorn>=0.21.1",
2020
"pytest",
21+
"filelock>=3.25.2",
2122
]
22-
requires-python = ">=3.8.1"
23+
requires-python = ">=3.10.1"
2324
readme = "README.md"
2425
license = {text = "MIT"}
2526

src/locations.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"RPL": {
3+
"camera_marker": {
4+
"pos_x": 8.209,
5+
"guid": "4ccacd0d-7f46-11ee-8521-0001297b4d50",
6+
"orientation": 180.0,
7+
"pos_y": 16.306,
8+
"type_id": 9
9+
},
10+
"charger1": {
11+
"pos_x": 10.119,
12+
"guid": "f0908191-7f46-11ee-8521-0001297b4d50",
13+
"orientation": 88.936,
14+
"pos_y": 21.557,
15+
"type_id": 20
16+
},
17+
"N9": {
18+
"pos_x": 11.0,
19+
"guid": "7224a20f-d65c-11ee-a833-0001297b4d50",
20+
"orientation": 0.0,
21+
"pos_y": 16.372,
22+
"type_id": 11
23+
},
24+
"test_pos": {
25+
"pos_x": 10.119,
26+
"guid": "88c7d8ff-54d0-11ef-90e0-0001297b4d50",
27+
"orientation": 88.936,
28+
"pos_y": 19.0,
29+
"type_id": 0
30+
},
31+
"test_move": {
32+
"pos_x": 7.0,
33+
"guid": "d99494c0-54d5-11ef-be3f-0001297b4d50",
34+
"orientation": 180.0,
35+
"pos_y": 20.2,
36+
"type_id": 0
37+
},
38+
"another_move": {
39+
"pos_x": 8.1,
40+
"guid": "b34d6e54-5670-11ef-a572-0001297b4d50",
41+
"orientation": 3.18,
42+
"pos_y": 20.4,
43+
"type_id": 0
44+
},
45+
"Charger2": {
46+
"pos_x": 2.924,
47+
"guid": "29604cea-1400-11f1-85eb-0001297b4d50",
48+
"orientation": 177.737,
49+
"pos_y": 11.338,
50+
"type_id": 20
51+
}
52+
}
53+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414
"pos_y": 21.557,
1515
"type_id": 20
1616
},
17+
"charger2": {
18+
"pos_x": 3.266,
19+
"guid": "f0908191-7f46-11ee-8521-0001297b4d50",
20+
"orientation": 179.510,
21+
"pos_y": 11.488,
22+
"type_id": 20
23+
24+
},
1725
"N9": {
1826
"pos_x": 11.0,
1927
"guid": "7224a20f-d65c-11ee-a833-0001297b4d50",

src/mir_rest_node.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from pathlib import Path
44
from typing import List, Optional
55

6-
from mir_driver.mir_driver import MiR_Base
6+
from mir_interface.mir_interface import MiR_Base
77
from typing_extensions import Annotated
88
from madsci.common.ownership import get_current_ownership_info
99
from madsci.common.types.node_types import RestNodeConfig
@@ -16,7 +16,7 @@ class MIRConfig(RestNodeConfig):
1616
mir_host: str = "mirbase2.cels.anl.gov"
1717
map_name: str = "RPL"
1818

19-
class MIRNode:
19+
class MIRNode(RestNode):
2020
"""A node to control the mobile MIR Base"""
2121

2222
config: MIRConfig = MIRConfig()
@@ -25,6 +25,7 @@ def startup_handler(self):
2525
"""MIR startup handler."""
2626

2727
self.mir = MiR_Base(mir_ip=self.config.mir_host, map_name=self.config.map_name)
28+
self.mir.create_position_dict()
2829
print("MIR Base online")
2930

3031
def status_handler(self):
@@ -39,7 +40,8 @@ def status_handler(self):
3940
error = "Executing current mission, can still accept more missions."
4041
elif len(self.node_status.running_actions) == 0:
4142
self.node_status.busy = False
42-
43+
def state_handler(self):
44+
return self.mir.get_state()
4345

4446

4547
@action
@@ -51,7 +53,7 @@ def move(
5153
) -> None:
5254
"""Sends a move command to the MIR Base"""
5355
self.mir.move(
54-
location_name=target_location.representation,
56+
location_name=target_location.representation["location_name"],
5557
)
5658

5759

@@ -64,7 +66,7 @@ def dock(self,
6466
) -> None:
6567
"""Sends a docking command to the MIR Base"""
6668
self.mir.dock(
67-
location_name=target_location.representation,
69+
location_name=target_location.representation["location_name"],
6870
)
6971
self.mir.wait_until_finished()
7072

@@ -105,4 +107,4 @@ def add_wait(
105107

106108
if __name__ == "__main__":
107109
MIR_node = MIRNode()
108-
MIR_node.start_node
110+
MIR_node.start_node()

0 commit comments

Comments
 (0)