Skip to content

Commit 7e66688

Browse files
committed
Merge branch 'master' of github.com:UBC-Thunderbots/Software
2 parents d251d7f + 97dd982 commit 7e66688

487 files changed

Lines changed: 5688 additions & 4451 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# These owners will be the default owners for everything in the repo.
2-
* @itsarune @williamckha @sauravbanna
2+
* @williamckha @sauravbanna @Andrewyx
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Environment Setup
2+
runs:
3+
using: "composite"
4+
steps:
5+
# Remove unused packages in the CI runner to free up disk space
6+
# https://github.com/actions/runner-images/issues/2840
7+
- name: Free disk space
8+
shell: bash
9+
run: |
10+
sudo rm -rf /usr/share/dotnet
11+
sudo rm -rf /usr/local/lib/android
12+
sudo rm -rf /opt/ghc
13+
14+
- name: Run setup_software.sh
15+
shell: bash
16+
run: |
17+
"${GITHUB_WORKSPACE}"/environment_setup/setup_software.sh

.github/workflows/main.yml

Lines changed: 18 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,72 +14,60 @@ jobs:
1414
multiplatform-build:
1515
strategy:
1616
matrix:
17-
platform: [ ubuntu-24.04 ]
17+
platform: [ ubuntu-24.04-arm ]
1818

1919
name: Ubuntu Alternate Builds
2020
runs-on: ${{ matrix.platform }}
2121
steps:
22-
# checks-out the repository under $GITHUB_WORKSPACE
2322
- uses: actions/checkout@v4
24-
25-
- name: Environment Setup
26-
run: |
27-
"${GITHUB_WORKSPACE}"/environment_setup/setup_software.sh
23+
- uses: ./.github/actions/environment-setup
2824

2925
- name: Software Build Test
3026
run: |
3127
cd src
32-
bazel build --show_timestamps --copt=-O3 \
28+
bazel build --show_timestamps --copt=-O3 --verbose_failures \
3329
-- //... -//software:unix_full_system \
3430
-//software/simulated_tests/... \
3531
-//software/ai/hl/... \
3632
-//software/field_tests/... \
3733
-//software/embedded/... \
38-
-//cc_toolchain/...
34+
-//toolchains/cc/...
3935
4036
- name: Jetson Nano Build Test
4137
run: |
4238
cd src
43-
bazel build //software/embedded:thunderloop_main --copt=-O3 --//software/embedded:host_platform=NANO --platforms=//cc_toolchain:robot
39+
bazel build //software/embedded:thunderloop_main --copt=-O3 --//software/embedded:host_platform=NANO --platforms=//toolchains/cc:robot
4440
4541
- name: Raspberry Pi Build Test
4642
run: |
4743
cd src
48-
bazel build //software/embedded:thunderloop_main --copt=-O3 --//software/embedded:host_platform=PI --platforms=//cc_toolchain:robot
44+
bazel build //software/embedded:thunderloop_main --copt=-O3 --//software/embedded:host_platform=PI --platforms=//toolchains/cc:robot
4945
5046
5147
software-tests:
5248
name: Software Tests
53-
runs-on: ubuntu-22.04
49+
runs-on: ubuntu-24.04
5450
steps:
55-
# checks-out the repository under $GITHUB_WORKSPACE
5651
- uses: actions/checkout@v4
57-
58-
- name: Environment Setup
59-
run: |
60-
"${GITHUB_WORKSPACE}"/environment_setup/setup_software.sh
52+
- uses: ./.github/actions/environment-setup
6153

6254
- name: Software Test
6355
run: |
6456
cd src
65-
bazel test --copt=-O3 --show_timestamps \
57+
bazel test --copt=-O3 --show_timestamps --verbose_failures \
6658
-- //... -//software:unix_full_system \
6759
-//software/simulated_tests/... \
6860
-//software/ai/hl/... \
6961
-//software/field_tests/... \
7062
-//software/ai/navigator/... \
71-
-//cc_toolchain/...
63+
-//toolchains/cc/...
7264
7365
robot-tests:
7466
name: Robot Software Tests
75-
runs-on: ubuntu-22.04
67+
runs-on: ubuntu-24.04
7668
steps:
77-
# checks-out the repository under $GITHUB_WORKSPACE
7869
- uses: actions/checkout@v4
79-
80-
- name: Environment Setup
81-
run: |
82-
"${GITHUB_WORKSPACE}"/environment_setup/setup_software.sh
70+
- uses: ./.github/actions/environment-setup
8371

8472
- name: Install and start redis server
8573
run: |
@@ -97,25 +85,21 @@ jobs:
9785
- name: Jetson Nano Build
9886
run: |
9987
cd src
100-
bazel build //software/embedded:thunderloop_main --copt=-O3 --//software/embedded:host_platform=NANO --platforms=//cc_toolchain:robot
88+
bazel build //software/embedded:thunderloop_main --copt=-O3 --//software/embedded:host_platform=NANO --platforms=//toolchains/cc:robot
10189
10290
10391
- name: Raspberry Pi Build
10492
run: |
10593
cd src
106-
bazel build //software/embedded:thunderloop_main --copt=-O3 --//software/embedded:host_platform=PI --platforms=//cc_toolchain:robot
94+
bazel build //software/embedded:thunderloop_main --copt=-O3 --//software/embedded:host_platform=PI --platforms=//toolchains/cc:robot
10795
10896
10997
simulated-gameplay-tests:
11098
name: Simulated Gameplay Tests
111-
runs-on: ubuntu-22.04
99+
runs-on: ubuntu-24.04
112100
steps:
113-
# checks-out the repository under $GITHUB_WORKSPACE
114101
- uses: actions/checkout@v4
115-
116-
- name: Environment Setup
117-
run: |
118-
"${GITHUB_WORKSPACE}"/environment_setup/setup_software.sh
102+
- uses: ./.github/actions/environment-setup
119103

120104
- name: Simulated Test Run
121105
run: |
@@ -146,14 +130,10 @@ jobs:
146130
147131
autorefd-game:
148132
name: AutoRef'd Game (3 Minutes)
149-
runs-on: ubuntu-22.04
133+
runs-on: ubuntu-24.04
150134
steps:
151-
# checks-out the repository under $GITHUB_WORKSPACE
152135
- uses: actions/checkout@v4
153-
154-
- name: Environment Setup
155-
run: |
156-
"${GITHUB_WORKSPACE}"/environment_setup/setup_software.sh
136+
- uses: ./.github/actions/environment-setup
157137

158138
- name: AI vs AI (3 minutes)
159139
run: |

.github/workflows/pre-commit.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@ concurrency:
1414
jobs:
1515
formatting-check:
1616
name: Formatting and FSM diagram generation with pre-commit-ci-lite
17-
runs-on: ubuntu-22.04
17+
runs-on: ubuntu-24.04
1818
if: github.event.pull_request.draft == false
1919
steps:
20-
# checks-out the repository under $GITHUB_WORKSPACE
2120
- uses: actions/checkout@v4
22-
23-
- name: Environment Setup
24-
run: |
25-
"${GITHUB_WORKSPACE}"/environment_setup/setup_software.sh
21+
- uses: ./.github/actions/environment-setup
2622

2723
- name: Install pip
2824
run: curl -sS https://bootstrap.pypa.io/get-pip.py | python

docs/code-style-guide.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ If you want to know more about our coding style you can take a look at our [clan
4444
* All variable names are `lowercase_with_underscores`
4545
```cpp
4646
// Incorrect
47-
float calculatedDistnace;
47+
float calculatedDistance;
4848

4949
// Correct
5050
float calculated_distance;
@@ -179,7 +179,7 @@ If you think some ASCII art will help explain something better, go for it! [asci
179179
180180
### Includes
181181
182-
* Use `#include` sparingly and only include the necessary sources to build the file. Do not include headers whos class or implementation is not used.
182+
* Use `#include` sparingly and only include the necessary sources to build the file. Do not include headers whose class or implementation is not used.
183183
* Often `.cpp` files include its corresponding header `.h` file, it means the `.cpp` file include everything included in the header. Do not have duplicate `#include`'s in both `.h` and `.cpp` files.
184184
* `#include`s are generally preferred written on the `.cpp` side; use minimum `#include` in the header file. Use _forward declarations_ in headers if necessary.
185185
* Specify full path of the include file on the file system, relative to the top-level project directory or _WORKSPACE_ file. Do not use relative paths.
@@ -273,22 +273,6 @@ private functions for a class/file that should not be exposed to users. impl can
273273
// Correct
274274
using PointsArray = std::vector<std::pair<int, int>>;
275275
```
276-
* Avoid initializing multiple variables on the same line.
277-
```cpp
278-
// Incorrect
279-
int x, y, z = 0;
280-
281-
// Correct
282-
int x;
283-
int y;
284-
int z = 0;
285-
286-
// However, the author may have intended the following
287-
// or a code reader may have assumed the following
288-
int x = 0;
289-
int y = 0;
290-
int z = 0;
291-
```
292276
* Avoid ternary operators. Clarity is more important than line count.
293277
```cpp
294278
// Incorrect

docs/coroutine_test_examples.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ int main(int argc, char** argv)
505505
//
506506
// The move constructor / assgnment is allowed.
507507
//
508-
// We can verify this with the code below, or by lookinAg at pull_coroutine.hpp
508+
// We can verify this with the code below, or by looking at pull_coroutine.hpp
509509
// https://www.boost.org/doc/libs/1_74_0/libs/coroutine2/doc/html/coroutine2/coroutine/asymmetric/pull_coro.html
510510

511511
auto data = std::make_shared<int>(99);

docs/getting-started.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,15 +357,17 @@ Tracy also samples call stacks. If the profiled binary is run with root permissi
357357

358358
## Building for the robot
359359

360-
To build for the robot computer, build the target with the `--platforms=//cc_toolchain:robot` flag and the toolchain will automatically build using the ARM toolchain. For example, `bazel build --platforms=//cc_toolchain:robot //software/geom/...`.
360+
To build for the robot computer, build the target with the `--platforms=//toolchains/cc:robot` flag and the toolchain will automatically build using the ARM toolchain. For example, `bazel build --platforms=//toolchains/cc:robot //software/geom/...`.
361361

362362
## Deploying Robot Software to the robot
363363

364364
We use Ansible to automatically update software running on the robot. [More info here.](useful-robot-commands.md#flashing-the-robots-compute-module)
365365

366366
To update binaries on a working robot, you can run:
367367

368-
`bazel run //software/embedded/ansible:run_ansible --platforms=//cc_toolchain:robot --//software/embedded:host_platform=<platform> -- --playbook deploy_robot_software.yml --hosts <robot_ip> --ssh_pass <robot_password>`
368+
```bash
369+
bazel run //software/embedded/ansible:run_ansible --platforms=//toolchains/cc:robot --//software/embedded:host_platform=<platform> -- --playbook deploy_robot_software.yml --hosts <robot_ip> --ssh_pass <robot_password>
370+
```
369371

370372
Where `<platform>` is the robot platform you are deploying to (`PI` or `NANO`), and `<robot_ip>` is the IP address of the robot you are deploying to. The `robot_password` is the password used to login to the `robot` user on the robot.
371373

@@ -388,7 +390,7 @@ It is possible to run Thunderloop without having a fully-working robot. Using th
388390

389391
2. If you have a robot PC that doesn't have proper communication with the power or motor board, you can still run Thunderloop in a limited capacity to test software features (eg. networking).
390392
1. First, build the Thunderloop binary:
391-
- `bazel build //software/embedded:thunderloop_main --//software/embedded:host_platform=LIMITED --platforms=//cc_toolchain:robot`
393+
- `bazel build //software/embedded:thunderloop_main --//software/embedded:host_platform=LIMITED --platforms=//toolchains/cc:robot`
392394
2. Find the `<robot_ip>` of the robot you want to run Thunderloop on. This guide may help you find the IP address of the robot: [Useful Robot Commands](useful-robot-commands.md#Wifi-Disclaimer).
393395
3. Copy the binary to the robot:
394396
- `scp bazel-bin/software/embedded/thunderloop_main robot@<robot_ip>:/home/robot/thunderloop_main`

docs/images/high_level_architecture.svg

Lines changed: 4 additions & 0 deletions
Loading

docs/robot-software-architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
For a more detailed look at how Ansible works, [see the RFC](https://docs.google.com/document/d/1hN3Us2Vjr8z6ihqUVp_3L7rrjKc-EZ-l2hZJc31gNOc/edit)
2828

29-
Example command: `bazel run //software/embedded/ansible:run_ansible --platforms=//cc_toolchain:robot --//software/embedded:host_platform=<platform> -- --playbook deploy_robot_software.yml --hosts <robot_ip> --ssh_pass <robot_password>`
29+
Example command: `bazel run //software/embedded/ansible:run_ansible --platforms=//toolchains/cc:robot --//software/embedded:host_platform=<platform> -- --playbook deploy_robot_software.yml --hosts <robot_ip> --ssh_pass <robot_password>`
3030
* <platform>: `PI` or `NANO` depending on the computer on the robot
3131
* <robot_ip>: IP address of the robot
3232
* <robot_password>: Password of the robot

docs/software-architecture-and-design.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@
7878

7979
# Architecture Overview
8080

81-
At a high-level, our system is split into several independent processes that [communicate with each other](#inter-process-communication). Our architecture is designed in this manner to promote decoupling of different features, making our system easier to expand, maintain, and test.
81+
![High-Level Architecture Diagram](images/high_level_architecture.svg)
82+
83+
At a high-level, our system is split into several independent processes that [communicate with each other](#inter-process-communication). Our architecture is designed in this manner to promote decoupling of different features, making our software easier to expand, maintain, and test.
8284

8385
- [**Fullsystem**](#fullsystem) is the program that processes data and makes decisions for a [team](#team) of [robots](#robot). It manages [**Sensor Fusion**](#sensor-fusion), which is responsible for processing and filtering raw data, and the [**AI**](#ai) that makes gameplay decisions.
8486

@@ -519,7 +521,7 @@ Once it is time to start the pass, the condition for the loop will become false
519521
Once we have entered the second stage, we know we don't have to look at the first stage again. Because the coroutine "remembers" where the execution is each time the function is called, we will resume inside the second stage and therefore never execute the first stage again! This makes it much easier to write and read this strategy code, because we can clearly see the 2 stages of the strategy, and we know they will be executed in order.
520522

521523
### Coroutine Best Practices
522-
Coroutines are a complex feature, and the boost coroutines we use don't always behave in was we expect. We have done extensive testing on how coroutines are safe (or not safe) to us, and derived some best practices from these examples. See [coroutine_test_exmaples.cpp](coroutine_test_examples.cpp) for the full code and more detailed explanantions.
524+
Coroutines are a complex feature, and the boost coroutines we use don't always behave in was we expect. We have done extensive testing on how coroutines are safe (or not safe) to us, and derived some best practices from these examples. See [coroutine_test_examples.cpp](coroutine_test_examples.cpp) for the full code and more detailed explanantions.
523525

524526
To summarize, the best practices are as follows:
525527
1. Avoid moving coroutines. If the absolutely must be moved, make sure they are not moved between the stack and heap.
@@ -550,7 +552,7 @@ Trajectories are generated by sampling intermediate *sub-destinations* around th
550552

551553
# Thunderscope
552554

553-
**Thunderscope** chiefly refers to the [GUI application](#thunderscope-gui) we use to visualize and interact with our robots and software. Some non-UI related functionality (namely, Robot Communication) is implemented as part of Thunderscope since it acts as a central point in our architecture, making it convenient for coordinating activities between different modules.
555+
**Thunderscope** refers to the [GUI application](#thunderscope-gui) we use to visualize and interact with our robots and software. Some non-UI related functionality (namely, Robot Communication) is implemented as part of Thunderscope since it acts as a central point in our architecture, making it convenient for coordinating activities between different modules.
554556

555557
[`thunderscope_main.py`](/src/software/thunderscope/thunderscope_main.py) serves as the main entry point ("launcher") for our entire system. You can run the script to start up the [Thunderscope GUI](#thunderscope-gui) and a number of other optional processes, such as a [Fullsystem](#fullsystem) for each [AI](#ai) team, the [Simulator](#simulator), and [SSL Gamecontroller](#ssl-gamecontroller).
556558

@@ -617,7 +619,7 @@ Our simulator is what we use for physics simulation to do testing when we don't
617619
* [SSL-Vision](#ssl-vision) by publishing new vision data
618620
* the robots by accepting new [Primitives](#primitives)
619621

620-
Using the current state of the simulated world, the simulator simulates the new [Primitives](#primitives) over some time step and publishes new SSL vision data based on the updated simulated world. Since the simulator interfaces with the our software over the network, it is essentially indistinguishible from robots receiving [Primitives](#primitives) and an [SSL-Vision](#ssl-vision) client publishing data over the network.
622+
Using the current state of the simulated world, the simulator simulates the new [Primitives](#primitives) over some time step and publishes new SSL vision data based on the updated simulated world. Since the simulator interfaces with the our software over the network, it is essentially indistinguishable from robots receiving [Primitives](#primitives) and an [SSL-Vision](#ssl-vision) client publishing data over the network.
621623

622624
The simulation can also be configured with "realism" parameters that control the amount of noise added to vision detections, simulate missed vision detections and packet loss, and add artificial vision/processing delay, all with some degree of randomness.
623625

@@ -650,7 +652,7 @@ A `Validation Function` comes in two types:
650652
2. Non-terminating: Some condition that must be met for the entire duration of the test, i.e. "for all time". (*Eg. The ball never leaves the field or all friendly robots follows SSL rules*).
651653

652654
Benefits of `Validation Functions`:
653-
1. They are reuseable. We can write a function that validates the ball never leaves the field, and use it for multiple tests.
655+
1. They are reusable. We can write a function that validates the ball never leaves the field, and use it for multiple tests.
654656
2. They can represent assertions for more complex behaviour. For example, we can build up simpler `Validation Functions` until we have a single `Validation` function for a specific [Tactic](#tactics).
655657
3. They let us validate independent sequences of behaviour. For example, we create a different `ValidationFunction` for each [Robot](#robot) in the test. This makes it easy to validate each [Robot](#robot) is doing the right thing, regardless if they are dependent or independent actions.
656658

0 commit comments

Comments
 (0)