swarmit 0.2.0__py3-none-any.whl → 0.4.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dotbot-firmware/doc/sphinx/conf.py +191 -0
- swarmit-0.4.4.dist-info/METADATA +127 -0
- swarmit-0.4.4.dist-info/RECORD +12 -0
- {swarmit-0.2.0.dist-info → swarmit-0.4.4.dist-info}/WHEEL +1 -1
- testbed/cli/main.py +265 -529
- testbed/swarmit/__init__.py +1 -0
- testbed/swarmit/adapter.py +142 -0
- testbed/swarmit/controller.py +664 -0
- testbed/swarmit/protocol.py +231 -0
- swarmit-0.2.0.dist-info/METADATA +0 -99
- swarmit-0.2.0.dist-info/RECORD +0 -7
- {swarmit-0.2.0.dist-info → swarmit-0.4.4.dist-info}/entry_points.txt +0 -0
- {swarmit-0.2.0.dist-info → swarmit-0.4.4.dist-info}/licenses/AUTHORS +0 -0
- {swarmit-0.2.0.dist-info → swarmit-0.4.4.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,231 @@
|
|
1
|
+
"""Swarmit protocol definition."""
|
2
|
+
|
3
|
+
import dataclasses
|
4
|
+
from dataclasses import dataclass
|
5
|
+
from enum import Enum, IntEnum
|
6
|
+
|
7
|
+
from dotbot.protocol import Payload, PayloadFieldMetadata, register_parser
|
8
|
+
|
9
|
+
|
10
|
+
class StatusType(Enum):
|
11
|
+
"""Types of device status."""
|
12
|
+
|
13
|
+
Bootloader = 0
|
14
|
+
Running = 1
|
15
|
+
Stopping = 2
|
16
|
+
Resetting = 3
|
17
|
+
Programming = 4
|
18
|
+
|
19
|
+
|
20
|
+
class SwarmitPayloadType(IntEnum):
|
21
|
+
"""Types of DotBot payload types."""
|
22
|
+
|
23
|
+
# Requests
|
24
|
+
SWARMIT_REQUEST_STATUS = 0x80
|
25
|
+
SWARMIT_REQUEST_START = 0x81
|
26
|
+
SWARMIT_REQUEST_STOP = 0x82
|
27
|
+
SWARMIT_REQUEST_RESET = 0x83
|
28
|
+
SWARMIT_REQUEST_OTA_START = 0x84
|
29
|
+
SWARMIT_REQUEST_OTA_CHUNK = 0x85
|
30
|
+
|
31
|
+
# Notifications
|
32
|
+
SWARMIT_NOTIFICATION_STATUS = 0x90
|
33
|
+
SWARMIT_NOTIFICATION_OTA_START_ACK = 0x93
|
34
|
+
SWARMIT_NOTIFICATION_OTA_CHUNK_ACK = 0x94
|
35
|
+
SWARMIT_NOTIFICATION_EVENT_GPIO = 0x95
|
36
|
+
SWARMIT_NOTIFICATION_EVENT_LOG = 0x96
|
37
|
+
|
38
|
+
# Custom messages
|
39
|
+
SWARMIT_MESSAGE = 0xA0
|
40
|
+
|
41
|
+
|
42
|
+
# Requests
|
43
|
+
|
44
|
+
|
45
|
+
@dataclass
|
46
|
+
class PayloadRequest(Payload):
|
47
|
+
"""Dataclass that holds an application request packet (start/stop/status)."""
|
48
|
+
|
49
|
+
metadata: list[PayloadFieldMetadata] = dataclasses.field(
|
50
|
+
default_factory=lambda: []
|
51
|
+
)
|
52
|
+
|
53
|
+
|
54
|
+
@dataclass
|
55
|
+
class PayloadStatusRequest(PayloadRequest):
|
56
|
+
"""Dataclass that holds an application status request packet."""
|
57
|
+
|
58
|
+
|
59
|
+
@dataclass
|
60
|
+
class PayloadStartRequest(PayloadRequest):
|
61
|
+
"""Dataclass that holds an application start request packet."""
|
62
|
+
|
63
|
+
|
64
|
+
@dataclass
|
65
|
+
class PayloadStopRequest(PayloadRequest):
|
66
|
+
"""Dataclass that holds an application stop request packet."""
|
67
|
+
|
68
|
+
|
69
|
+
@dataclass
|
70
|
+
class PayloadResetRequest(Payload):
|
71
|
+
"""Dataclass that holds an application reset request packet."""
|
72
|
+
|
73
|
+
metadata: list[PayloadFieldMetadata] = dataclasses.field(
|
74
|
+
default_factory=lambda: [
|
75
|
+
PayloadFieldMetadata(name="pos_x", length=4),
|
76
|
+
PayloadFieldMetadata(name="pos_y", length=4),
|
77
|
+
]
|
78
|
+
)
|
79
|
+
|
80
|
+
pos_x: int = 0
|
81
|
+
pos_y: int = 0
|
82
|
+
|
83
|
+
|
84
|
+
@dataclass
|
85
|
+
class PayloadOTAStartRequest(Payload):
|
86
|
+
"""Dataclass that holds an OTA start packet."""
|
87
|
+
|
88
|
+
metadata: list[PayloadFieldMetadata] = dataclasses.field(
|
89
|
+
default_factory=lambda: [
|
90
|
+
PayloadFieldMetadata(name="fw_length", disp="len.", length=4),
|
91
|
+
PayloadFieldMetadata(
|
92
|
+
name="fw_chunk_counts", disp="chunks", length=4
|
93
|
+
),
|
94
|
+
]
|
95
|
+
)
|
96
|
+
|
97
|
+
fw_length: int = 0
|
98
|
+
fw_chunk_count: int = 0
|
99
|
+
|
100
|
+
|
101
|
+
@dataclass
|
102
|
+
class PayloadOTAChunkRequest(Payload):
|
103
|
+
"""Dataclass that holds an OTA chunk packet."""
|
104
|
+
|
105
|
+
metadata: list[PayloadFieldMetadata] = dataclasses.field(
|
106
|
+
default_factory=lambda: [
|
107
|
+
PayloadFieldMetadata(name="index", disp="idx", length=4),
|
108
|
+
PayloadFieldMetadata(name="count", disp="size"),
|
109
|
+
PayloadFieldMetadata(name="sha", type_=bytes, length=8),
|
110
|
+
PayloadFieldMetadata(name="chunk", type_=bytes, length=0),
|
111
|
+
]
|
112
|
+
)
|
113
|
+
|
114
|
+
index: int = 0
|
115
|
+
count: int = 0
|
116
|
+
sha: bytes = dataclasses.field(default_factory=lambda: bytearray)
|
117
|
+
chunk: bytes = dataclasses.field(default_factory=lambda: bytearray)
|
118
|
+
|
119
|
+
|
120
|
+
# Notifications
|
121
|
+
|
122
|
+
|
123
|
+
@dataclass
|
124
|
+
class PayloadStatusNotification(Payload):
|
125
|
+
"""Dataclass that holds an application status notification packet."""
|
126
|
+
|
127
|
+
metadata: list[PayloadFieldMetadata] = dataclasses.field(
|
128
|
+
default_factory=lambda: [
|
129
|
+
PayloadFieldMetadata(name="status", disp="st."),
|
130
|
+
]
|
131
|
+
)
|
132
|
+
|
133
|
+
status: StatusType = StatusType.Bootloader
|
134
|
+
|
135
|
+
|
136
|
+
@dataclass
|
137
|
+
class PayloadOTAStartAckNotification(Payload):
|
138
|
+
"""Dataclass that holds an application OTA start ACK notification packet."""
|
139
|
+
|
140
|
+
metadata: list[PayloadFieldMetadata] = dataclasses.field(
|
141
|
+
default_factory=lambda: []
|
142
|
+
)
|
143
|
+
|
144
|
+
|
145
|
+
@dataclass
|
146
|
+
class PayloadOTAChunkAckNotification(Payload):
|
147
|
+
"""Dataclass that holds an application OTA chunk ACK notification packet."""
|
148
|
+
|
149
|
+
metadata: list[PayloadFieldMetadata] = dataclasses.field(
|
150
|
+
default_factory=lambda: [
|
151
|
+
PayloadFieldMetadata(name="index", disp="idx", length=4),
|
152
|
+
]
|
153
|
+
)
|
154
|
+
|
155
|
+
index: int = 0
|
156
|
+
|
157
|
+
|
158
|
+
@dataclass
|
159
|
+
class PayloadEventNotification(Payload):
|
160
|
+
"""Dataclass that holds an event notification packet."""
|
161
|
+
|
162
|
+
metadata: list[PayloadFieldMetadata] = dataclasses.field(
|
163
|
+
default_factory=lambda: [
|
164
|
+
PayloadFieldMetadata(name="timestamp", disp="ts", length=4),
|
165
|
+
PayloadFieldMetadata(name="count", disp="len."),
|
166
|
+
PayloadFieldMetadata(
|
167
|
+
name="data", disp="data", type_=bytes, length=0
|
168
|
+
),
|
169
|
+
]
|
170
|
+
)
|
171
|
+
|
172
|
+
timestamp: int = 0
|
173
|
+
count: int = 0
|
174
|
+
data: bytes = dataclasses.field(default_factory=lambda: bytearray)
|
175
|
+
|
176
|
+
|
177
|
+
@dataclass
|
178
|
+
class PayloadMessage(Payload):
|
179
|
+
"""Dataclass that holds a message packet."""
|
180
|
+
|
181
|
+
metadata: list[PayloadFieldMetadata] = dataclasses.field(
|
182
|
+
default_factory=lambda: [
|
183
|
+
PayloadFieldMetadata(name="count", disp="len."),
|
184
|
+
PayloadFieldMetadata(
|
185
|
+
name="message", disp="msg", type_=bytes, length=0
|
186
|
+
),
|
187
|
+
]
|
188
|
+
)
|
189
|
+
|
190
|
+
count: int = 0
|
191
|
+
message: bytes = dataclasses.field(default_factory=lambda: bytearray)
|
192
|
+
|
193
|
+
|
194
|
+
def register_parsers():
|
195
|
+
# Register all swarmit specific parsers at module level
|
196
|
+
register_parser(
|
197
|
+
SwarmitPayloadType.SWARMIT_REQUEST_STATUS,
|
198
|
+
PayloadStatusRequest,
|
199
|
+
)
|
200
|
+
register_parser(
|
201
|
+
SwarmitPayloadType.SWARMIT_REQUEST_START, PayloadStartRequest
|
202
|
+
)
|
203
|
+
register_parser(
|
204
|
+
SwarmitPayloadType.SWARMIT_REQUEST_STOP, PayloadStopRequest
|
205
|
+
)
|
206
|
+
register_parser(
|
207
|
+
SwarmitPayloadType.SWARMIT_REQUEST_RESET, PayloadResetRequest
|
208
|
+
)
|
209
|
+
register_parser(
|
210
|
+
SwarmitPayloadType.SWARMIT_REQUEST_OTA_START, PayloadOTAStartRequest
|
211
|
+
)
|
212
|
+
register_parser(
|
213
|
+
SwarmitPayloadType.SWARMIT_REQUEST_OTA_CHUNK, PayloadOTAChunkRequest
|
214
|
+
)
|
215
|
+
register_parser(
|
216
|
+
SwarmitPayloadType.SWARMIT_NOTIFICATION_STATUS,
|
217
|
+
PayloadStatusNotification,
|
218
|
+
)
|
219
|
+
register_parser(
|
220
|
+
SwarmitPayloadType.SWARMIT_NOTIFICATION_OTA_START_ACK,
|
221
|
+
PayloadOTAStartAckNotification,
|
222
|
+
)
|
223
|
+
register_parser(
|
224
|
+
SwarmitPayloadType.SWARMIT_NOTIFICATION_OTA_CHUNK_ACK,
|
225
|
+
PayloadOTAChunkAckNotification,
|
226
|
+
)
|
227
|
+
register_parser(
|
228
|
+
SwarmitPayloadType.SWARMIT_NOTIFICATION_EVENT_LOG,
|
229
|
+
PayloadEventNotification,
|
230
|
+
)
|
231
|
+
register_parser(SwarmitPayloadType.SWARMIT_MESSAGE, PayloadMessage)
|
swarmit-0.2.0.dist-info/METADATA
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.3
|
2
|
-
Name: swarmit
|
3
|
-
Version: 0.2.0
|
4
|
-
Summary: Run Your Own Robot Swarm Testbed.
|
5
|
-
Project-URL: Homepage, https://github.com/DotBots/swarmit
|
6
|
-
Project-URL: Bug Tracker, https://github.com/DotBots/swarmit/issues
|
7
|
-
Author-email: Alexandre Abadie <alexandre.abadie@inria.fr>
|
8
|
-
License-File: AUTHORS
|
9
|
-
License-File: LICENSE
|
10
|
-
Classifier: License :: OSI Approved :: BSD License
|
11
|
-
Classifier: Operating System :: MacOS
|
12
|
-
Classifier: Operating System :: Microsoft :: Windows
|
13
|
-
Classifier: Operating System :: POSIX :: Linux
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
15
|
-
Requires-Python: >=3.7
|
16
|
-
Requires-Dist: click==8.1.7
|
17
|
-
Requires-Dist: cryptography==43.0.1
|
18
|
-
Requires-Dist: pydotbot==0.22.0
|
19
|
-
Requires-Dist: pyserial==3.5
|
20
|
-
Requires-Dist: rich==13.8.1
|
21
|
-
Requires-Dist: structlog==24.4.0
|
22
|
-
Requires-Dist: tqdm==4.66.5
|
23
|
-
Description-Content-Type: text/markdown
|
24
|
-
|
25
|
-
# SwarmIT
|
26
|
-
|
27
|
-
SwarmIT provides a embedded C port for nRF53 as well as Python based services to
|
28
|
-
easily build and deploy a robotic swarm infrastructure testbed.
|
29
|
-
ARM TrustZone is used to create a sandboxed user environment on each device
|
30
|
-
under test, without requiring a control co-processor attached to it.
|
31
|
-
|
32
|
-
## Features
|
33
|
-
|
34
|
-
- Experiment management: start, stop, monitor and status check
|
35
|
-
- Deploy a custom firmware on all or on a subset of robots of a swarm testbed
|
36
|
-
- Resilient robot state: even when crashed by buggy user code, the robot can be reprogrammed remotely and wirelessly
|
37
|
-
|
38
|
-
## Usage
|
39
|
-
|
40
|
-
### Embedded C code
|
41
|
-
|
42
|
-
SwarmIT embedded C code can be built using
|
43
|
-
[Segger Embedded Studio (SES)](https://www.segger.com/products/development-tools/embedded-studio/).
|
44
|
-
|
45
|
-
To provision a device, follow the following steps:
|
46
|
-
1. open [netcore.emProject](device/network_core/netcore.emProject)
|
47
|
-
and [bootloader.emProject](device/bootloader/bootloader.emProject) in SES
|
48
|
-
2. build and load the netcore application on the nRF53 network core,
|
49
|
-
3. build and load the bootloader application on the nRF53 application core.
|
50
|
-
|
51
|
-
The device is now ready.
|
52
|
-
|
53
|
-
### Gateway
|
54
|
-
|
55
|
-
The communication between the computer and the swarm devices is performed via a
|
56
|
-
gateway board connected via USB to the computer.
|
57
|
-
The gateway board is a Nordic nRF53840DK.
|
58
|
-
|
59
|
-
The firmware to run on the gateway can also be compiled and flash using SES.
|
60
|
-
The SES project to open is located at [gateway.emProject](gateway/gateway.emProject).
|
61
|
-
|
62
|
-
After flashing the gateway firmware, LED1 on the DK should blink fast during 1s.
|
63
|
-
|
64
|
-
### Python CLI script
|
65
|
-
|
66
|
-
The Python CLI script provides commands for flashing, starting and stopping user
|
67
|
-
code on the device, as well as monitoring and checking the status of devices
|
68
|
-
in the swarm.
|
69
|
-
|
70
|
-
The Python CLI script connects via a virtual COM port to the gateway connected to
|
71
|
-
the computer.
|
72
|
-
|
73
|
-
The Python CLI script is available on PyPI. Install it using:
|
74
|
-
|
75
|
-
```
|
76
|
-
pip install swarmit
|
77
|
-
```
|
78
|
-
|
79
|
-
Default usage:
|
80
|
-
|
81
|
-
```
|
82
|
-
swarmit --help
|
83
|
-
Usage: swarmit [OPTIONS] COMMAND [ARGS]...
|
84
|
-
|
85
|
-
Options:
|
86
|
-
-p, --port TEXT Serial port to use to send the bitstream to the
|
87
|
-
gateway. Default: /dev/ttyACM0.
|
88
|
-
-b, --baudrate INTEGER Serial port baudrate. Default: 1000000.
|
89
|
-
-d, --devices TEXT Subset list of devices to interact with, separated
|
90
|
-
with ,
|
91
|
-
--help Show this message and exit.
|
92
|
-
|
93
|
-
Commands:
|
94
|
-
flash
|
95
|
-
monitor
|
96
|
-
start
|
97
|
-
status
|
98
|
-
stop
|
99
|
-
```
|
swarmit-0.2.0.dist-info/RECORD
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
testbed/cli/main.py,sha256=_mZJx_W549A_5FVMylU0jNXvCG_6cAcDj2fRMAoU65o,19689
|
2
|
-
swarmit-0.2.0.dist-info/METADATA,sha256=OkItUGFQ29DNW2xHUkOZLwYG0Mj9smwnmY9vjIlAt2Q,3279
|
3
|
-
swarmit-0.2.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
4
|
-
swarmit-0.2.0.dist-info/entry_points.txt,sha256=R6BGQe6I1FcI5B2jo7Dr-Gh6-Rjn1Ykx3uAGuV5rVTo,50
|
5
|
-
swarmit-0.2.0.dist-info/licenses/AUTHORS,sha256=o2cH3J5JkbZssK_1zYj0m8PHiGiILV0lySR6_hoWKK0,45
|
6
|
-
swarmit-0.2.0.dist-info/licenses/LICENSE,sha256=j97C1uBc5chpQWi4bv_2SrqExuvKaJK2Ch6L2LFkoc4,1492
|
7
|
-
swarmit-0.2.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|