Skip to content

Commit 2a28348

Browse files
authored
Merge pull request #12 from osrf/fix/docs-and-running
Quick update and fixes to perform dry run
2 parents a64be08 + 8be74e3 commit 2a28348

File tree

5 files changed

+31
-23
lines changed

5 files changed

+31
-23
lines changed

README.md

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
11
# fleet_adapter_mir
2-
MiR100 Fleet Adapter using the https://github.com/osrf/rmf_fleet_adapter_python
2+
MiR100 Fleet Adapter using the https://github.com/open-rmf/rmf_ros2/tree/main/rmf_fleet_adapter_python
33

44

55

66
## Pre-Requisites
77

8-
- ROS2
9-
- [rmf_core](https://github.com/osrf/rmf_core)
10-
- [rmf_fleet_adapter_python](https://github.com/osrf/rmf_fleet_adapter_python)
8+
- ROS 2 (Foxy onwards)
9+
- [open-rmf](https://github.com/open-rmf/rmf) (source build recommended)
1110

1211

1312

1413
## Installation
1514

16-
Place the pre-requisite packages into your ROS2 workspace, and run `colcon build` as per normal, remembering to source the workspace.
15+
If a source build of `open-rmf` is used, source the built workspace as an underlay, and clone the repository.
16+
17+
```bash
18+
source ~/rmf_ws/install/setup.bash
19+
git clone https://github.com/osrf/fleet_adapter_mir ~/fleet_adapter_mir
20+
```
1721

1822

1923

2024
## Description
2125

2226
This package implements a MiR robot command handle that is managed by a fleet adapter in Python. (Along with some helpers.) It can be used to command and manage a fleet of MiR 100 robots using RMF!
2327

24-
It uses the `rmf_fleet_adapter_python` bindings, which allows for communication with `rmf_core` libraries and ROS2 nodes.
28+
It uses the `rmf_fleet_adapter_python` bindings, which allows for communication with `open-rmf` libraries and ROS2 nodes.
2529

26-
In effect, it interfaces the MiR REST API with `rmf_core`, all without needing to directly use ROS2 messages to communicate with `rmf_core`!
30+
In effect, it interfaces the MiR REST API with `open-rmf`, all without needing to directly use ROS 2 messages to communicate with `open-rmf`!
2731

2832

2933

@@ -35,20 +39,20 @@ An example usage of the implemented adapter can be found in the `main.py` file.
3539

3640
Call it like so:
3741

38-
```shell
39-
# Remember to source the workspace you've installed the pre-requisites in!
42+
```bash
43+
# Remember to source the underlay workspace!
4044

4145
# Get help
42-
$ python3 main.py -h
46+
python3 main.py -h
4347

44-
# Run in dry-run mode. Disables ROS2 publishing and MiR REST calls
45-
$ python3 main.py mir_config.yaml -d
48+
# Run in dry-run mode. Disables ROS 2 publishing and MiR REST calls
49+
python3 main.py -c mir_config.yaml -n nav_graph.yaml -d
4650
```
4751

48-
Alternatively, if you want to run everything with full capabilities, (though note that it will require an `rmf_core` schedule node to be active, and the MiR REST server to be available)
52+
Alternatively, if you want to run everything with full capabilities, (though note that it will require an `rmf_traffic_ros2` schedule node to be active, and the MiR REST server to be available)
4953

50-
```shell
51-
$ python3 main.py mir_config.yaml
54+
```bash
55+
python3 main.py -c mir_config.yaml -n nav_graph.yaml
5256
```
5357

5458

@@ -88,9 +92,9 @@ The example script `main.py` does this.
8892

8993
### Robot Transforms: Two Coordinate Systems
9094

91-
Since we are interfacing MiR and `rmf_core`, we need to deal with two coordinate systems and two forms of 'maps'.
95+
Since we are interfacing MiR and `open-rmf`, we need to deal with two coordinate systems and two forms of 'maps'.
9296

93-
We have to deal with the `rmf_core` navgraph and the MiR map, with their own individual coordinate systems, waypoints/positions, and waypoint keys/position names.
97+
We have to deal with the `rmf_traffic` navgraph and the MiR map, with their own individual coordinate systems, waypoints/positions, and waypoint keys/position names.
9498

9599
Luckily, we can leverage the `nudged` Python library to compute coordinate transforms between the two sets of coordinates. You just have to make sure to provide equivalent reference points within the two maps so transforms can be computed.
96100

@@ -108,7 +112,7 @@ In order for the appropriate `RobotUpdateHandle.update_position()` method calls
108112

109113
The trouble is, since we are using the MiR REST API, the only way we can obtain information about the robot's state is by polling it via REST calls.
110114

111-
Even harder than that, the MiR REST API does not care to store information about the `rmf_core` navigation graph, and any goals that are set with respect ot that. In fact, the corresponding path following calls that `rmf_core` issues gets translated into move-to-coordinate missions for the MiR to execute.
115+
Even harder than that, the MiR REST API does not care to store information about the `rmf_traffic` navigation graph, and any goals that are set with respect to that. In fact, the corresponding path following calls that `open-rmf` issues gets translated into move-to-coordinate missions for the MiR to execute.
112116

113117
This is **very messy**. Mainly because we cannot immediately infer the semantic state of the robot (with respect to RMF.) Instead, we have to infer it based off of what we know, from the tracking variables we are using, and the robot's mode.
114118

@@ -132,7 +136,7 @@ The `RobotState` with the following robot modes:
132136
- `MODE_PAUSED`: Interrupted
133137
- `MODE_DOCKING`: Docking
134138

135-
And a flag that gets set whenever the robot is executing a path following request from `rmf_core`:
139+
And a flag that gets set whenever the robot is executing a path following request from `open-rmf`:
136140

137141
- `rmf_path_requested`: `True` if executing a path request, `False` once complete
138142

fleet_adapter_mir/MiRClientAPI.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
from urllib.error import HTTPError
44

55

6+
__all__ = [
7+
"MirAPI"
8+
]
9+
610

711
class MirAPI:
812
def __init__(self, prefix, headers, timeout=10.0, debug=False):

fleet_adapter_mir/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
from .fleet_adapter_mir import *
2+
from .MiRClientAPI import *

fleet_adapter_mir/fleet_adapter_mir.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def path_following_closure():
285285
or _current_waypoint):
286286

287287
# DEBUG PRINTOUT
288-
print([str(x[1].graph_index) for x in self.rmf_remaining_path_waypoints])
288+
# print([str(x[1].graph_index) for x in self.rmf_remaining_path_waypoints])
289289

290290
if not self.paused: # Skipped if paused
291291
if _current_waypoint is None:
@@ -406,7 +406,7 @@ def path_following_closure():
406406
)
407407

408408
# NOTE(CH3): MiR Location is sent in Degrees
409-
_mir_ori = math.degrees(_mir_ori_rad % (2 * math.pi)
409+
_mir_ori = math.degrees(_mir_ori_rad % (2 * math.pi))
410410

411411
if _mir_ori > 180.0:
412412
_mir_ori = _mir_ori - 360.0

main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
from fleet_adapter_mir import MiRCommandHandle
2-
from MiRClientAPI import MirAPI
1+
from fleet_adapter_mir import MiRCommandHandle, MirAPI
32

43
from rmf_fleet_msgs.msg import FleetState
54
from rmf_task_msgs.msg import TaskProfile, TaskType

0 commit comments

Comments
 (0)