swarmit 0.2.0__tar.gz → 0.4.4__tar.gz

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.
@@ -20,3 +20,6 @@ dist/
20
20
 
21
21
  # Virtual env folder
22
22
  .venv/
23
+
24
+ # Tox
25
+ .tox/
swarmit-0.4.4/PKG-INFO ADDED
@@ -0,0 +1,127 @@
1
+ Metadata-Version: 2.4
2
+ Name: swarmit
3
+ Version: 0.4.4
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: BSD
9
+ License-File: AUTHORS
10
+ License-File: LICENSE
11
+ Classifier: License :: OSI Approved :: BSD License
12
+ Classifier: Operating System :: MacOS
13
+ Classifier: Operating System :: Microsoft :: Windows
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Programming Language :: Python :: 3
16
+ Requires-Python: >=3.7
17
+ Requires-Dist: click==8.1.7
18
+ Requires-Dist: cryptography==43.0.1
19
+ Requires-Dist: marilib-pkg>=0.6.0
20
+ Requires-Dist: pydotbot>=0.24.1
21
+ Requires-Dist: rich==14.0.0
22
+ Requires-Dist: structlog==24.4.0
23
+ Requires-Dist: tqdm==4.66.5
24
+ Description-Content-Type: text/markdown
25
+
26
+ # SwarmIT
27
+
28
+ SwarmIT provides a embedded C port for nRF53 as well as Python based services to
29
+ easily build and deploy a robotic swarm infrastructure testbed.
30
+ ARM TrustZone is used to create a sandboxed user environment on each device
31
+ under test, without requiring a control co-processor attached to it.
32
+
33
+ https://github.com/user-attachments/assets/eff63b07-216a-41fb-9062-2e0e56f03c20
34
+
35
+ ## Features
36
+
37
+ - Experiment management: start, stop, monitor and status check
38
+ - Deploy a custom firmware on all or on a subset of robots of a swarm testbed
39
+ - Resilient robot state: even when crashed by buggy user code, the robot can be reprogrammed remotely and wirelessly
40
+
41
+ ## Usage
42
+
43
+ ### Get the code
44
+
45
+ Swarmit depends on the [DotBot-firmware](https://github.com/DotBots/DotBot-firmware)
46
+ and [Mari](https://github.com/DotBots/mari) repositories. They are included
47
+ in the codebase as [Git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules).
48
+
49
+ Use the following command to clone the Swarmit codebase locally:
50
+
51
+ ```
52
+ git clone --recurse-submodules https://github.com/DotBots/swarmit.git
53
+ ```
54
+
55
+ ### Embedded C code
56
+
57
+ SwarmIT embedded C code can be built using
58
+ [Segger Embedded Studio (SES)](https://www.segger.com/products/development-tools/embedded-studio/).
59
+ Use Tools > Package manager to install the CMSIS 5 CMSIS-CORE, CMSIS-DSP and nRF packages.
60
+
61
+ To provision a device, follow the following steps:
62
+ 1. open [netcore.emProject](swarmit-netcore.emProject)
63
+ and [bootloader.emProject](swarmit-bootloader-dotbot-v3.emProject)
64
+ (or [bootloader.emProject](swarmit-bootloader-dotbot-v2.emProject) depending on
65
+ your robot version) in SES
66
+ 2. build and load the netcore application on the nRF53 network core,
67
+ 3. build and load the bootloader application on the nRF53 application core.
68
+
69
+ The device is now ready.
70
+
71
+ ### Gateway
72
+
73
+ The communication between the computer and the swarm devices is performed via a
74
+ gateway board connected via USB to the computer.
75
+
76
+ This gateway uses the [mari](https://github.com/dotbots/mari) network stack and
77
+ the it must run the Mari gateway firmware, either Edge or Cloud version.
78
+
79
+ The documentation to setup a Mari gateway is located
80
+ [here](https://github.com/DotBots/mari/wiki/Getting-started#running-mari-network-on-your-computer).
81
+
82
+ ### Python CLI script
83
+
84
+ The Python CLI script provides commands for flashing, starting and stopping user
85
+ code on the device, as well as monitoring and checking the status of devices
86
+ in the swarm.
87
+
88
+ The Python CLI script connects via a virtual COM port to the gateway connected to
89
+ the computer.
90
+
91
+ The Python CLI script is available on PyPI. Install it using:
92
+
93
+ ```
94
+ pip install swarmit
95
+ ```
96
+
97
+ Print usage using `swarmit --help`:
98
+
99
+ ```
100
+ Usage: swarmit [OPTIONS] COMMAND [ARGS]...
101
+
102
+ Options:
103
+ -p, --port TEXT Serial port to use to send the bitstream to
104
+ the gateway. Default: /dev/ttyACM0.
105
+ -b, --baudrate INTEGER Serial port baudrate. Default: 1000000.
106
+ -H, --mqtt-host TEXT MQTT host. Default: localhost.
107
+ -P, --mqtt-port INTEGER MQTT port. Default: 1883.
108
+ -T, --mqtt-use_tls Use TLS with MQTT.
109
+ -n, --network-id INTEGER Marilib network ID to use. Default: 1
110
+ -a, --adapter [edge|cloud]
111
+ Choose the adapter to communicate with the
112
+ gateway. [default: edge]
113
+ -d, --devices TEXT Subset list of devices to interact with,
114
+ separated with ,
115
+ -v, --verbose Enable verbose mode.
116
+ -V, --version Show the version and exit.
117
+ -h, --help Show this message and exit.
118
+
119
+ Commands:
120
+ flash Flash a firmware to the robots.
121
+ message Send a custom text message to the robots.
122
+ monitor Monitor running applications.
123
+ reset Reset robots locations.
124
+ start Start the user application.
125
+ status Print current status of the robots.
126
+ stop Stop the user application.
127
+ ```
@@ -0,0 +1,102 @@
1
+ # SwarmIT
2
+
3
+ SwarmIT provides a embedded C port for nRF53 as well as Python based services to
4
+ easily build and deploy a robotic swarm infrastructure testbed.
5
+ ARM TrustZone is used to create a sandboxed user environment on each device
6
+ under test, without requiring a control co-processor attached to it.
7
+
8
+ https://github.com/user-attachments/assets/eff63b07-216a-41fb-9062-2e0e56f03c20
9
+
10
+ ## Features
11
+
12
+ - Experiment management: start, stop, monitor and status check
13
+ - Deploy a custom firmware on all or on a subset of robots of a swarm testbed
14
+ - Resilient robot state: even when crashed by buggy user code, the robot can be reprogrammed remotely and wirelessly
15
+
16
+ ## Usage
17
+
18
+ ### Get the code
19
+
20
+ Swarmit depends on the [DotBot-firmware](https://github.com/DotBots/DotBot-firmware)
21
+ and [Mari](https://github.com/DotBots/mari) repositories. They are included
22
+ in the codebase as [Git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules).
23
+
24
+ Use the following command to clone the Swarmit codebase locally:
25
+
26
+ ```
27
+ git clone --recurse-submodules https://github.com/DotBots/swarmit.git
28
+ ```
29
+
30
+ ### Embedded C code
31
+
32
+ SwarmIT embedded C code can be built using
33
+ [Segger Embedded Studio (SES)](https://www.segger.com/products/development-tools/embedded-studio/).
34
+ Use Tools > Package manager to install the CMSIS 5 CMSIS-CORE, CMSIS-DSP and nRF packages.
35
+
36
+ To provision a device, follow the following steps:
37
+ 1. open [netcore.emProject](swarmit-netcore.emProject)
38
+ and [bootloader.emProject](swarmit-bootloader-dotbot-v3.emProject)
39
+ (or [bootloader.emProject](swarmit-bootloader-dotbot-v2.emProject) depending on
40
+ your robot version) in SES
41
+ 2. build and load the netcore application on the nRF53 network core,
42
+ 3. build and load the bootloader application on the nRF53 application core.
43
+
44
+ The device is now ready.
45
+
46
+ ### Gateway
47
+
48
+ The communication between the computer and the swarm devices is performed via a
49
+ gateway board connected via USB to the computer.
50
+
51
+ This gateway uses the [mari](https://github.com/dotbots/mari) network stack and
52
+ the it must run the Mari gateway firmware, either Edge or Cloud version.
53
+
54
+ The documentation to setup a Mari gateway is located
55
+ [here](https://github.com/DotBots/mari/wiki/Getting-started#running-mari-network-on-your-computer).
56
+
57
+ ### Python CLI script
58
+
59
+ The Python CLI script provides commands for flashing, starting and stopping user
60
+ code on the device, as well as monitoring and checking the status of devices
61
+ in the swarm.
62
+
63
+ The Python CLI script connects via a virtual COM port to the gateway connected to
64
+ the computer.
65
+
66
+ The Python CLI script is available on PyPI. Install it using:
67
+
68
+ ```
69
+ pip install swarmit
70
+ ```
71
+
72
+ Print usage using `swarmit --help`:
73
+
74
+ ```
75
+ Usage: swarmit [OPTIONS] COMMAND [ARGS]...
76
+
77
+ Options:
78
+ -p, --port TEXT Serial port to use to send the bitstream to
79
+ the gateway. Default: /dev/ttyACM0.
80
+ -b, --baudrate INTEGER Serial port baudrate. Default: 1000000.
81
+ -H, --mqtt-host TEXT MQTT host. Default: localhost.
82
+ -P, --mqtt-port INTEGER MQTT port. Default: 1883.
83
+ -T, --mqtt-use_tls Use TLS with MQTT.
84
+ -n, --network-id INTEGER Marilib network ID to use. Default: 1
85
+ -a, --adapter [edge|cloud]
86
+ Choose the adapter to communicate with the
87
+ gateway. [default: edge]
88
+ -d, --devices TEXT Subset list of devices to interact with,
89
+ separated with ,
90
+ -v, --verbose Enable verbose mode.
91
+ -V, --version Show the version and exit.
92
+ -h, --help Show this message and exit.
93
+
94
+ Commands:
95
+ flash Flash a firmware to the robots.
96
+ message Send a custom text message to the robots.
97
+ monitor Monitor running applications.
98
+ reset Reset robots locations.
99
+ start Start the user application.
100
+ status Print current status of the robots.
101
+ stop Stop the user application.
102
+ ```
@@ -0,0 +1,191 @@
1
+ # Configuration file for the Sphinx documentation builder.
2
+
3
+ import glob
4
+ import os
5
+ import shutil
6
+ import subprocess
7
+ import sys
8
+
9
+
10
+ project = 'DotBot-firmware'
11
+ copyright = '2023, Inria'
12
+ author = 'Alexandre Abadie'
13
+
14
+ # -- General configuration ----------------------------------------------------
15
+ extensions = [
16
+ 'breathe',
17
+ "myst_parser",
18
+ "sphinx.ext.autodoc",
19
+ "sphinx.ext.autosummary",
20
+ "sphinx.ext.githubpages",
21
+ "sphinx.ext.graphviz",
22
+ "sphinx.ext.inheritance_diagram",
23
+ "sphinx.ext.todo",
24
+ "sphinx.ext.viewcode",
25
+ ]
26
+
27
+ language = "en"
28
+ tls_verify = False
29
+ templates_path = ['_templates']
30
+ exclude_patterns = ["_build"]
31
+ nitpick_ignore_regex = [
32
+ (r'c:.*', r'[u]*int\d{1,2}_t'), # ignore int8_t, uint8_t, ...
33
+ (r'c:.*', r'NRF_.*'), # ignore NRF_ macros
34
+ (r'c:.*', r'[s]*size_t'), # ignore size_t and ssize_t
35
+ (r'c:.*', r'[U]*INT\d{1,2}_MAX'), # ignore INT8_MAX, UINT8_MAX, ...
36
+ ]
37
+
38
+ # -- Options for breathe ------------------------------------------------------
39
+ breathe_projects = {"DotBot-firmware": "../doxygen/xml/"}
40
+ breathe_default_project = "DotBot-firmware"
41
+ breathe_show_include = False
42
+ breathe_domain_by_extension = {
43
+ "h" : "c",
44
+ }
45
+
46
+ myst_enable_extensions = ["html_image"]
47
+
48
+ # -- Options for HTML output --------------------------------------------------
49
+ html_theme = "pydata_sphinx_theme"
50
+ html_sourcelink_suffix = ""
51
+ html_static_path = ["_static"]
52
+
53
+ # Define the json_url for our version switcher.
54
+ json_url = "https://dotbot-firmware.readthedocs.io/en/latest/_static/switcher.json"
55
+ rtd_version = os.environ.get("READTHEDOCS_VERSION")
56
+ rtd_version_type = os.environ.get("READTHEDOCS_VERSION_TYPE")
57
+ rtd_git_identifier = os.environ.get("READTHEDOCS_GIT_IDENTIFIER")
58
+ # If READTHEDOCS_VERSION doesn't exist, we're not on RTD
59
+ # If it is an integer, we're in a PR build and the version isn't correct.
60
+ # If it's "latest" → change to "dev" (that's what we want the switcher to call it)
61
+ if not rtd_version or rtd_version.isdigit() or rtd_version == "latest":
62
+ rtd_version = "dev"
63
+ json_url = "_static/switcher.json"
64
+ elif rtd_version == "stable":
65
+ rtd_version = f"{rtd_git_identifier}"
66
+ elif rtd_version_type == "tag":
67
+ rtd_version = f"{rtd_git_identifier}"
68
+
69
+ html_theme_options = {
70
+ "external_links": [
71
+ {
72
+ "url": "https://github.com/DotBots/PyDotBot",
73
+ "name": "PyDotBot",
74
+ "attributes": {
75
+ "target" : "_blank",
76
+ "rel" : "noopener me",
77
+ },
78
+ },
79
+ {
80
+ "url": "https://github.com/DotBots/DotBot-hardware",
81
+ "name": "DotBot hardware",
82
+ "attributes": {
83
+ "target" : "_blank",
84
+ "rel" : "noopener me",
85
+ },
86
+ },
87
+ ],
88
+ "icon_links": [
89
+ {
90
+ "name": "GitHub",
91
+ "url": "https://github.com/DotBots/DotBot-firmware",
92
+ "icon": "fa-brands fa-github",
93
+ },
94
+ ],
95
+ "header_links_before_dropdown": 4,
96
+ "logo": {
97
+ "text": "DotBot firmware",
98
+ },
99
+ "navbar_align": "left",
100
+ "navbar_center": ["version-switcher", "navbar-nav"],
101
+ "switcher": {
102
+ "json_url": json_url,
103
+ "version_match": rtd_version,
104
+ },
105
+ "footer_start": ["copyright"],
106
+ "footer_center": ["sphinx-version"],
107
+ }
108
+
109
+ # -- Options for autosummary/autodoc output -----------------------------------
110
+ autosummary_generate = True
111
+ autodoc_typehints = "description"
112
+ autodoc_member_order = "groupwise"
113
+
114
+ # Hook for building doxygen documentation -------------------------------------
115
+
116
+ def run_doxygen(app):
117
+ """Run the doxygen make command."""
118
+ doxygen_path = "../doxygen"
119
+ try:
120
+ retcode = subprocess.call(f"make -C {doxygen_path}", shell=True)
121
+ if retcode < 0:
122
+ sys.stderr.write(f"doxygen terminated by signal {-retcode}")
123
+ except OSError as e:
124
+ sys.stderr.write(f"doxygen execution failed: {e}")
125
+
126
+ # Hook for generating linked README.md files --------------------------------------------
127
+
128
+ README_INCLUDE_TEMPLATE = """```{{include}} {path_to_readme}
129
+ :relative-images:
130
+ :relative-docs: ../../
131
+ ```
132
+ """
133
+
134
+ def generate_readme(app, prefix, dest):
135
+ projects_dir = os.path.join(app.srcdir, "../../projects/")
136
+ projects = [os.path.basename(project) for project in glob.glob(f"{projects_dir}/{prefix}*")]
137
+ output_dir = os.path.join(app.srcdir, dest)
138
+ if not os.path.exists(output_dir):
139
+ os.makedirs(output_dir, exist_ok=True)
140
+ for project in projects:
141
+ with open(os.path.join(output_dir, f"{project}.md"), "w") as f:
142
+ f.write(README_INCLUDE_TEMPLATE.format(path_to_readme=f"../../../projects/{project}/README.md"))
143
+
144
+
145
+ def generate_projects_readme(app):
146
+ for prefix, dest in [("01", "_examples"), ("03app", "_projects")]:
147
+ generate_readme(app, prefix, dest)
148
+
149
+
150
+ API_INCLUDE_TEMPLATE = """{title}
151
+ =================================
152
+
153
+ .. doxygengroup:: {module}
154
+ .. doxygenfile:: {header}
155
+
156
+ """
157
+ EXCLUDE_MODULES = [
158
+ "board_config",
159
+ "soft_ed25519",
160
+ "soft_edsign",
161
+ "soft_f25519",
162
+ "soft_fprime",
163
+ "soft_sha256",
164
+ "soft_sha512",
165
+ ]
166
+
167
+
168
+ def generate_api_files(app):
169
+ output_dir = os.path.join(app.srcdir, "_api")
170
+ if not os.path.exists(output_dir):
171
+ os.makedirs(output_dir, exist_ok=True)
172
+ for module in ["bsp", "crypto", "drv"]:
173
+ module_dir = os.path.join(app.srcdir, f"../../{module}/")
174
+ submodules = [os.path.basename(project).split(".")[0] for project in glob.glob(f"{module_dir}/*.h")]
175
+ submodules = [module for module in submodules if module not in EXCLUDE_MODULES]
176
+ for submodule in submodules:
177
+ with open(os.path.join(output_dir, f"{module}_{submodule}.rst"), "w") as f:
178
+ f.write(
179
+ API_INCLUDE_TEMPLATE.format(
180
+ title=f"{submodule.capitalize()}",
181
+ module=f"{module}_{submodule}",
182
+ header=f"{module}/{submodule}.h"
183
+ )
184
+ )
185
+
186
+
187
+ def setup(app):
188
+ """Add hook for building doxygen documentation."""
189
+ app.connect("builder-inited", run_doxygen)
190
+ app.connect("builder-inited", generate_api_files)
191
+ app.connect("builder-inited", generate_projects_readme)
@@ -1,5 +1,7 @@
1
1
  [build-system]
2
- requires = ["hatchling"]
2
+ requires = [
3
+ "hatchling>=1.4.1",
4
+ ]
3
5
  build-backend = "hatchling.build"
4
6
 
5
7
  [tool.hatch.build]
@@ -11,24 +13,30 @@ exclude = [
11
13
  "sample/",
12
14
  ]
13
15
 
16
+ [tool.hatch.version]
17
+ path = "testbed/swarmit/__init__.py"
18
+
19
+ [tool.hatch.metadata]
20
+ allow-direct-references = true
21
+
14
22
  [project]
15
23
  name = "swarmit"
16
- version = "0.2.0"
24
+ dynamic = ["version"]
17
25
  authors = [
18
26
  { name="Alexandre Abadie", email="alexandre.abadie@inria.fr" },
19
27
  ]
20
28
  dependencies = [
21
29
  "click == 8.1.7",
22
30
  "cryptography == 43.0.1",
23
- "pydotbot == 0.22.0",
24
- "pyserial == 3.5",
25
- "rich == 13.8.1",
31
+ "pydotbot >= 0.24.1",
32
+ "rich == 14.0.0",
26
33
  "structlog == 24.4.0",
27
34
  "tqdm == 4.66.5",
35
+ "marilib-pkg >= 0.6.0",
28
36
  ]
29
37
  description = "Run Your Own Robot Swarm Testbed."
30
38
  readme = "README.md"
31
- license-file = ["LICENSE"]
39
+ license = { text="BSD" }
32
40
  requires-python = ">=3.7"
33
41
  classifiers = [
34
42
  "Programming Language :: Python :: 3",
@@ -46,10 +54,15 @@ classifiers = [
46
54
  swarmit = "testbed.cli.main:main"
47
55
 
48
56
  [tool.ruff]
49
- select = ["E", "F"]
57
+ lint.select = ["E", "F"]
50
58
  line-length = 88
51
- ignore = ["E501"]
59
+ lint.ignore = ["E501", "E722"]
60
+ exclude = ["dotbot-firmware"]
52
61
 
53
62
  [tool.isort]
54
63
  multi_line_output = 3 # Use Vertical Hanging Indent
55
64
  profile = "black"
65
+
66
+ [tool.black]
67
+ line-length = 79
68
+ skip-string-normalization = true