Skip to content

Commit 52b875e

Browse files
committed
Added smarchitecture
1 parent 79502ee commit 52b875e

File tree

4 files changed

+73
-0
lines changed

4 files changed

+73
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ Each of the following directories also include more detailed readmes within.
1010
[This example](/behaviours/alars/alars/SuperSimpleActionServer.py) implements an action server that hides ALL of the ROS from your beautiful control implementations.
1111
It works with [the bt](./behaviours/wasp_bt/launch/wasp_bt.launch) out of the box.
1212

13+
14+
## [The general architecture of smarc2](/documentation/Smarchitecture.md)
15+
An overview of the general ideas and structures that we use across different vehicles.
16+
1317
## Stuff in this repo
1418

1519
> Add more directories as needed.

documentation/Smarchitecture.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# SMaRChitecture
2+
This document details the general structure that all vehicles that touch some part of the SMaRC project should follow.
3+
4+
#### General Idea
5+
- We use ROS messages `xxx_msgs.msg/Topics.msg` and `xxx_msgs/Links.msg` as global shared dictionaries that define common strings in the context of `xxx`.
6+
- For example: `smarc_msgs/Topics.msg` contains topic names for vehicle-agnostic mid-level hardware abstraction.
7+
- Use these message definitions to avoid hard-coding topics and links in your nodes!
8+
- All `Topics` messages should include the message type expected as a comment next to the string.
9+
- These
10+
- avoid the question of "what is the topic for...?"
11+
- allow self-discovery: "Is there a topic for...?"
12+
- keep the documentation in front of the people implementing things. No need to hunt a PDF to find out the message type of `smarc_msgs/Topics.msg::pos_latlon`
13+
14+
- All nodes/launch files take `robot_name` as a ROS param and append in front of topics/links as needed
15+
- No hard-coded `robot_names` for TF frames.
16+
- Use namespacing in launch files with the `robot_name` as the base.
17+
- _Everything_ that a launchfile/node pubs/subs must be under the same `robot_name`.
18+
19+
#### Low-level HAL
20+
- **\<vehicle\>_topics** and **\<vehicle\>_links** ROS messages act as the "low-level" hardware abstraction
21+
- For example: `sam_msgs/Topics.msg` contains topics specific to the SAM vehicle, used by nodes that communicate internally for SAM.
22+
- These are vehicle-specific and can be custom types as needed.
23+
24+
#### Mid-level HAL
25+
- `smarc_msgs/Topics.msg` and `smarc_action_base.gentler_action_server::GentlerActionServer` are the "mid-level", inside-the-vehicle hardware abstraction layer.
26+
- The topics should be kept as base types i.e no custom message types.
27+
- The main consumer of this layer is the **WaspBT**, which is vehicle-agnostic.
28+
- The `GentlerActionServer` has all the mechanisms to make a ROS action server easily, that can interact with the **WaspBT**.
29+
30+
#### High-level HAL
31+
- [WARA-PS API](https://api-docs.waraps.org/#/agent_communication/agent_communication) is the "high-level", outside-the-vehicle level of abstraction.
32+
- **WaspBT** can act as a bridge between the vehicle and this layer (See SAM, LoLo, ALARS)
33+
- Vehicles can choose to implement the WARA-PS API directly from the hardware, without using the above levels. (See Evolo/Puffins)
34+
35+
#### Simulator
36+
- The sim has a finger on every level:
37+
- Can mimic the hardware by publishing sensor data and listening to actuation signals at the **low-level**
38+
- Can mimic the in-vehicle ROS-stack by publishing into **SmarcTopics** directly, touching the **mid-level**
39+
- Can mimic the entire vehicle at a **high-level** by publishing into **WARA-PS API** directly
40+
- **C2** sees vehicles through the **WARA-PS API** only
41+
42+
43+
## Graphical
44+
Large images, zooming in recommended :)
45+
46+
### Without simulator
47+
![nosim](/documentation/media/Smarchitecture_nosim.png)
48+
49+
### With simulator
50+
The simulator is split into 3 separate nodes to avoid too many lines overlapping, but it is the same sim.
51+
52+
![withsim](/documentation/media/Smarchitecture_withsim.png)
53+
54+
55+
## Example workflows:
56+
- **Controller dev**
57+
- SIM -> GT state -> HAL-Low -> do-thing Action Server -> actuation -> SIM
58+
- **DR/SLAM dev**
59+
- SIM -> drive around manually
60+
- SIM -> sensor data -> vehicle-nodes for DR -> state -> estimate
61+
- SIM -> GT state
62+
- Compare estimate vs GT
63+
- **BT dev**
64+
- SIM -> SmarcTopics -> state -> WaspBT -> state+cmd -> WARA-PS API -> SIM and back
65+
- **Real vehicle**
66+
- Vehicle -> Sensor data -> vehicle-nodes ->
67+
- SmarcTopics -> WaspBT -> WARA-PS API -> SIM(C2) -> cmd -> WARA-PS API -> WaspBT -> cmd ->
68+
- state -> HAL-Low -> state ->
69+
- *state and cmd from above lines* -> do-something-action-server (GentlerActionServer) -> actuation -> Vehicle
1.08 MB
Loading
1.36 MB
Loading

0 commit comments

Comments
 (0)