Skip to content

Commit 69757aa

Browse files
authored
Add a mission report example (#104)
* Made an initial mission report example * Updated readme to document new example * Added rx error plot * Cleaned up mission report example and linted * Updated pipenv
1 parent c975a6c commit 69757aa

File tree

8 files changed

+493
-179
lines changed

8 files changed

+493
-179
lines changed

.devcontainer/Dockerfile

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,40 @@ RUN pip3 install \
4747
pre-commit \
4848
tox
4949

50+
# Install visualization tools
51+
RUN pip3 install \
52+
matplotlib \
53+
plotly \
54+
kaleido
55+
56+
# Configure a new non-root user
5057
ARG USERNAME=developer
5158
ARG USER_UID=1000
5259
ARG USER_GID=$USER_UID
5360

54-
# Add non-root user
5561
RUN groupadd --gid $USER_GID $USERNAME \
5662
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
5763
&& apt-get update \
5864
&& apt-get install -y sudo \
5965
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
6066
&& chmod 0440 /etc/sudoers.d/$USERNAME \
61-
&& rm -rf /var/lib/apt/lists/*
67+
&& rm -rf /var/lib/apt/lists/* \
68+
&& echo "source /usr/share/bash-completion/completions/git" >> /home/$USERNAME/.bashrc \
69+
&& echo "if [ -f /opt/ros/${ROS_DISTRO}/setup.bash ]; then source /opt/ros/${ROS_DISTRO}/setup.bash; fi" >> /home/$USERNAME/.bashrc
70+
71+
# Install packages needed for enabling OpenGL and X11
72+
RUN apt-get update && apt-get install -y -qq --no-install-recommends \
73+
libglvnd0 \
74+
libgl1 \
75+
libglx0 \
76+
libegl1 \
77+
libxext6 \
78+
libx11-6
79+
80+
# Configure environment variables needed
81+
ENV NVIDIA_VISIBLE_DEVICES all
82+
ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute
83+
ENV QT_X11_NO_MITSHM 1
6284

6385
# Add the .local/bin directory to the path
6486
ENV PATH "${PATH}:/home/$USERNAME/.local/bin"

.devcontainer/devcontainer.json

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"--cap-add=SYS_PTRACE",
1313
"--security-opt=seccomp:unconfined",
1414
"--security-opt=apparmor:unconfined",
15+
"--volume=/tmp/.X11-unix:/tmp/.X11-unix",
1516
"--volume=/dev:/dev",
1617
"--privileged"
1718
],
@@ -25,9 +26,7 @@
2526
"editor.formatOnSave": true,
2627
"editor.tabSize": 4,
2728
"editor.defaultFormatter": "esbenp.prettier-vscode",
28-
"editor.rulers": [
29-
88
30-
],
29+
"editor.rulers": [88],
3130
"rewrap.autoWrap.enabled": true,
3231
"rewrap.wrappingColumn": 80,
3332
"rewrap.wholeComment": true,
@@ -54,19 +53,15 @@
5453
"pymavswarm"
5554
],
5655
"[python]": {
57-
"editor.rulers": [
58-
88
59-
],
56+
"editor.rulers": [88],
6057
"editor.tabSize": 4,
6158
"editor.defaultFormatter": "ms-python.python",
6259
"editor.codeActionsOnSave": {
6360
"source.organizeImports": true
6461
}
6562
},
6663
"[markdown]": {
67-
"editor.rulers": [
68-
80
69-
],
64+
"editor.rulers": [80],
7065
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
7166
},
7267
"[dockerfile]": {

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,4 @@ dmypy.json
133133

134134
# pymavlink files
135135
logs/
136+
mission_report/

Pipfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ bandit = "*"
2020
coverage = "*"
2121
pre-commit = "*"
2222
tox = "*"
23+
matplotlib = "*"
24+
plotly = "*"
25+
kaleido = "*"
2326

2427
[requires]
2528
python_version = "3"

Pipfile.lock

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

examples/README.md

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,41 @@
33
Several examples have been implemented to demonstrate how to use and extend the
44
`pymavswarm` library. The implemented examples include:
55

6-
- `arming.py`: demonstrates how to arm and disarm swarm agents
6+
- `arming.py`: demonstrates how to arm and disarm swarm agents.
77
- `check_state.py`: demonstrates how to check the state of swarm agents; also
8-
demonstrates how to log data to a [`tlog`](https://ardupilot.org/copter/docs/common-mission-planner-telemetry-logs.html)
9-
file
10-
- `companion_computer.py`: demonstrates how to send commands from a companion
11-
computer
12-
- `custom_observer.py`: demonstrates how to implement a callback for an agent
13-
state change
8+
demonstrates how to log data to a log file.
9+
- `custom_observer.py`: demonstrates how to implement an observer for an agent
10+
state change event.
1411
- `goto.py`: demonstrates how to command an agent to fly to a specified location
1512
using a configuration file; an example configuration file is provided in
16-
`resources/goto.yaml`
17-
- `set_flight_mode.py`: demonstrates how to set the agents' flight mode
13+
`resources/goto.yaml`.
14+
- `mission_report.py`: demonstrates how to use the `parse_log_file` method to
15+
create a simple mission report.
16+
- `set_flight_mode.py`: demonstrates how to set the agents' flight mode.
1817
- `set_home_position.py`: demonstrates how to set the swarm agents' home
19-
position
20-
- `set_parameter.py`: demonstrates how to set an agent's parameter
18+
position.
19+
- `set_parameter.py`: demonstrates how to set an agent's parameter.
2120
- `subclass_mavswarm.py`: demonstrates how to extend the functionality of
22-
`MavSwarm`
23-
- `takeoff_sequence.py`: demonstrates how to execute a full takeoff sequence
21+
`MavSwarm` through subclassing.
22+
- `takeoff_sequence.py`: demonstrates how to execute a full takeoff sequence.
2423

2524
## Running the examples
2625

2726
Prior to running the examples, ensure that there is an active connection between
2827
a ground control station and the swarm agents. When these examples were first
2928
developed, the ground control station and the swarm agents utilized RFD900
30-
radios configured to use the multi-point radio setting. In the case of the
31-
`companion_computer.py` example, ensure that the script has been uploaded to the
32-
companion computer for execution.
29+
radios configured to use the multi-point radio setting.
3330

3431
Once the network has been configured, the examples may be run using the
3532
following command:
3633

3734
```bash
38-
python3 <example_script.py> ...
35+
python3 <example_script.py> <args>
3936
```
4037

4138
where `<example_script.py>` is replaced with the name of the example script to
42-
run and `...` is replaced with the example's required arguments. To see the
43-
required arguments, run the following command:
39+
run and `<args>` is replaced with the example's arguments. To see the
40+
arguments, run the following command:
4441

4542
```bash
4643
python3 <example_script.py> -h

examples/companion_computer.py

Lines changed: 0 additions & 127 deletions
This file was deleted.

0 commit comments

Comments
 (0)