Skip to content

Commit be74d55

Browse files
committed
Merge branch 'master' of https://github.com/UBC-Thunderbots/Software into update_docs
2 parents f127f5c + 8c508a4 commit be74d55

File tree

172 files changed

+4772
-1174
lines changed

Some content is hidden

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

172 files changed

+4772
-1174
lines changed

.github/workflows/main.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
multiplatform-build:
1515
strategy:
1616
matrix:
17-
platform: [ ubuntu-22.04, ubuntu-24.04 ]
17+
platform: [ ubuntu-24.04 ]
1818

1919
name: Ubuntu Alternate Builds
2020
runs-on: ${{ matrix.platform }}
@@ -50,7 +50,7 @@ jobs:
5050
5151
software-tests:
5252
name: Software Tests
53-
runs-on: ubuntu-20.04
53+
runs-on: ubuntu-22.04
5454
steps:
5555
# checks-out the repository under $GITHUB_WORKSPACE
5656
- uses: actions/checkout@v4
@@ -72,7 +72,7 @@ jobs:
7272
7373
robot-tests:
7474
name: Robot Software Tests
75-
runs-on: ubuntu-20.04
75+
runs-on: ubuntu-22.04
7676
steps:
7777
# checks-out the repository under $GITHUB_WORKSPACE
7878
- uses: actions/checkout@v4
@@ -108,7 +108,7 @@ jobs:
108108
109109
simulated-gameplay-tests:
110110
name: Simulated Gameplay Tests
111-
runs-on: ubuntu-20.04
111+
runs-on: ubuntu-22.04
112112
steps:
113113
# checks-out the repository under $GITHUB_WORKSPACE
114114
- uses: actions/checkout@v4
@@ -146,7 +146,7 @@ jobs:
146146
147147
autorefd-game:
148148
name: AutoRef'd Game (3 Minutes)
149-
runs-on: ubuntu-20.04
149+
runs-on: ubuntu-22.04
150150
steps:
151151
# checks-out the repository under $GITHUB_WORKSPACE
152152
- uses: actions/checkout@v4

.github/workflows/pre-commit.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ concurrency:
1414
jobs:
1515
formatting-check:
1616
name: Formatting and FSM diagram generation with pre-commit-ci-lite
17-
runs-on: ubuntu-20.04
17+
runs-on: ubuntu-22.04
1818
if: github.event.pull_request.draft == false
1919
steps:
2020
# checks-out the repository under $GITHUB_WORKSPACE
@@ -27,9 +27,9 @@ jobs:
2727
- name: Install pip
2828
run: curl -sS https://bootstrap.pypa.io/get-pip.py | python
2929

30-
- uses: pre-commit/[email protected].0
30+
- uses: pre-commit/[email protected].1
3131

32-
- uses: pre-commit-ci/lite-action@v1.0.1
32+
- uses: pre-commit-ci/lite-action@v1.1.0
3333
name: Run pre-commit-ci-lite
3434
if: always()
3535

docs/fsm-diagrams.md

+13
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,19 @@ ChipState --> Terminate:::terminate : [chipDone]
130130
131131
```
132132

133+
## [HaltPlayFSM](/src/software/ai/hl/stp/play/halt_play/halt_play_fsm.h)
134+
135+
```mermaid
136+
137+
stateDiagram-v2
138+
classDef terminate fill:white,color:black,font-weight:bold
139+
direction LR
140+
[*] --> HaltState
141+
HaltState --> HaltState : <i>updateStop</i>
142+
Terminate:::terminate --> Terminate:::terminate : <i>updateStop</i>
143+
144+
```
145+
133146
## [OffensePlayFSM](/src/software/ai/hl/stp/play/offense/offense_play_fsm.h)
134147

135148
```mermaid

docs/getting-started-wsl.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ If you are not using Windows 11 or the latest version of Windows 10 and would pr
4242
3. Now, let's install Ubuntu.
4343
- Download the WSL2 kernel from [here](https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel).
4444
- Open a PowerShell window and run command `wsl --set-default-version 2` to use WSL2 by default.
45-
- Install Ubuntu 20.04 LTS, Ubuntu 22.04 LTS or Ubuntu 24.04 LTS from the Microsoft Store.
45+
- Install Ubuntu 22.04 LTS or Ubuntu 24.04 LTS from the Microsoft Store.
4646
- Open the Ubuntu app in the Start menu. It will open a command prompt and ask you to create a new UNIX username and password for your WSL2 Ubuntu installation.
4747
4848
### X Server Setup

docs/getting-started.md

+43-18
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ These instructions assume you have a basic understanding of Linux and the comman
6666

6767
We currently only support Linux, specifically Ubuntu.
6868

69-
If you have a X86_64 machine, we support Ubuntu 20.04 LTS, Ubuntu 22.04 LTS and Ubuntu 24.04 LTS.
69+
If you have a X86_64 machine, we support Ubuntu 22.04 LTS and Ubuntu 24.04 LTS.
7070

7171
If you have a ARM64 (also known as AARCH64) machine, we support Ubuntu 24.04 LTS.
7272

7373
You are welcome to use a different version or distribution of Linux, but may need to make some tweaks in order for things to work.
7474

75-
You can use Ubuntu 20.04 LTS, Ubuntu 22.04 LTS or Ubuntu 24.04 LTS inside Windows through Windows Subsystem for Linux, by following [this guide](./getting-started-wsl.md). **Running and developing Thunderbots on Windows is experimental and not officially supported.**
75+
You can use Ubuntu 22.04 LTS or Ubuntu 24.04 LTS inside Windows through Windows Subsystem for Linux, by following [this guide](./getting-started-wsl.md). **Running and developing Thunderbots on Windows is experimental and not officially supported.**
7676

7777
### Getting the Code
7878

@@ -231,13 +231,11 @@ Now that you're setup, if you can run it on the command line, you can run it in
231231

232232
- If we want to run it with real robots:
233233
- Open your terminal, `cd` into `Software/src` and run `ifconfig`.
234-
- Pick the network interface you would like to use:
235-
1. If you are running things locally, you can pick any interface that is not `lo`
236-
2. If you would like to communicate with robots on the network, make sure to select the interface that is connected to the same network as the robots.
234+
- Pick the network interface you would like to use. If you would like to communicate with robots on the network, make sure to select the interface that is connected to the same network as the robots.
237235
- For example, on a sample machine, the output may look like this:
238236

239237
```
240-
enp0s5: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
238+
wlp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
241239
...
242240
[omitted]
243241
...
@@ -248,22 +246,30 @@ Now that you're setup, if you can run it on the command line, you can run it in
248246
...
249247
```
250248

251-
- An appropriate interface we could choose is `enp0s5`
249+
- An appropriate interface we could choose is `wlp3s0`
250+
- Hint: If you are using a wired connection, the interface will likely start with `e-`. If you are using a WiFi connection, the interface will likely start with `w-`.
252251
- If we are running the AI as "blue": `./tbots.py run thunderscope_main --interface=[interface_here] --run_blue`
253252
- If we are running the AI as "yellow": `./tbots.py run thunderscope_main --interface=[interface_here] --run_yellow`
254253
- `[interface_here]` corresponds to the `ifconfig` interfaces seen in the previous step
255-
- For instance, a call to run the AI as blue on wifi could be: `./tbots.py run thunderscope_main --interface=enp0s5 --run_blue`
254+
- For instance, a call to run the AI as blue on WiFi could be: `./tbots.py run thunderscope_main --interface=wlp3s0 --run_blue`. This will start Thunderscope and set up communication with robots over the wifi interface. It will also listen for referee and vision messages on the same interface.
255+
- **Note: You do not need to include the `--interface=[interface_here]` argument!** You can run Thunderscope without it and use the dynamic configuration widget to set the interfaces for communication to send and receive robot, vision and referee messages.
256+
- If you choose to include `--interface=[interface_here]` argument, Thunderscope will listen for and send robot messages on this port as well as receive vision and referee messages.
257+
- Using the dynamic configuration widget is recommended at Robocup. To reduce latencies, it is recommended to connect the robot router to the AI computer via ethernet and use a separate ethernet connection to receive vision and referee messages. In this configuration, Thunderscope will need to bind to two different interfaces, each likely starting with a "e-".
258+
- If you have specified `--run_blue` or `--run_yellow`, navigate to the "Parameters" widget. In "ai_config" > "ai_control_config" > "network_config", you can set the appropriate interface using the dropdowns for robot, vision and referee message communication.
256259
- This command will set up robot communication and the Unix full system binary context manager. The Unix full system context manager hooks up our AI, Backend and SensorFusion
257260
2. Run AI along with Robot Diagnostics:
258261
- The Mechanical and Electrical sub-teams use Robot Diagnostics to test specific parts of the Robot.
259262
- If we want to run with one AI and Diagnostics
260-
- `./tbots.py run thunderscope_main [--run_blue | --run_yellow] --run_diagnostics` will start Thunderscope
263+
- `./tbots.py run thunderscope_main [--run_blue | --run_yellow] --run_diagnostics --interface=[interface_here]` will start Thunderscope
261264
- `[--run_blue | --run_yellow]` indicate which FullSystem to run
262265
- `--run_diagnostics` indicates if diagnostics should be loaded as well
263266
- Initially, the robots are all connected to the AI and only receive input from it
264267
- To change the input source for the robot, use the drop-down menu of that robot to change it between None, AI, and Manual
265268
- None means the robots are receiving no commands
266269
- More info about Manual control below
270+
- `--interface=[interface_here]` corresponds to the `ifconfig` interfaces seen in the previous step
271+
- For instance, a call to run the AI as blue on WiFi could be: `./tbots.py run thunderscope_main --interface=wlp3s0 --run_blue --run_diagnostics`
272+
- The `--interface` flag is optional. If you do not include it, you can set the interface in the dynamic configuration widget. See above for how to set the interface in the dynamic configuration widget.
267273
3. Run only Diagnostics
268274
- To run just Diagnostics
269275
- `./tbots.py run thunderscope --run_diagnostics --interface <network_interface>`
@@ -363,6 +369,34 @@ To update binaries on a working robot, you can run:
363369

364370
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.
365371

372+
## Testing Robot Software locally
373+
374+
It is possible to run Thunderloop without having a fully-working robot. Using this mode is useful when testing features that don't require the power board or motors.
375+
376+
1. To run Thunderloop locally on your computer
377+
1. First, you must ensure that `redis` is installed. Installation instructions can be found [here](https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-linux/). The result of these installation directions will likely enable `redis-server` as a service that starts on boot. You may want to run `sudo systemctl disable redis-server` to prevent this.
378+
2. Next, run the command `redis-server` in a terminal.
379+
3. Set up the following required REDIS constants by running the following commands in the terminal:
380+
- `redis-cli set /robot_id "{robot_id}"` where `{robot_id}` is the robot's ID (e.g. `1`, `2`, etc.)
381+
- `redis-cli set /network_interface "{network_interface}"` where `{network_interface}` is one of the interfaces listed by `ip a`.
382+
- `redis-cli set /channel_id "{channel_id}"` where `{channel_id}` is the channel id of the robot (e.g. `1`, `2`, etc.)
383+
- `redis-cli set /kick_coeff "{kick_coeff}"` where `{kick_coeff}` is a calibrated kicking parameter. When running locally, this parameter doesn't matter so `0` is fine.
384+
- `redis-cli set /kick_constant "{kick_constant}"` where `{kick_constant}` is a calibrated kicking parameter. When running locally, this parameter doesn't matter so `0` is fine.
385+
- `redis-cli set /chip_pulse_width "{chip_pulse_width}"` where `{chip_pulse_width}` is a calibrated kicking parameter. When running locally, this parameter doesn't matter so `0` is fine.
386+
4. Now, run Thunderloop with the following command:
387+
- `bazel run //software/embedded:thunderloop_main --//software/embedded:host_platform=LIMITED`
388+
389+
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).
390+
1. First, build the Thunderloop binary:
391+
- `bazel build //software/embedded:thunderloop_main --//software/embedded:host_platform=LIMITED --platforms=//cc_toolchain:robot`
392+
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).
393+
3. Copy the binary to the robot:
394+
- `scp bazel-bin/software/embedded/thunderloop_main robot@<robot_ip>:/home/robot/thunderloop_main`
395+
4. SSH into the robot using the following command:
396+
- `ssh robot@<robot_ip>`
397+
5. Run the Thunderloop binary on the robot:
398+
- `sudo ./thunderloop_main`
399+
366400
## Setting up Virtual Robocup 2021
367401

368402
### Setting up the SSL Simulation Environment
@@ -371,15 +405,6 @@ Where `<platform>` is the robot platform you are deploying to (`PI` or `NANO`),
371405
2. Clone it.
372406
3. Follow these [instructions](https://github.com/RoboCup-SSL/ssl-simulation-setup/blob/master/Readme.md) to set up and run the repository.
373407

374-
### Pushing a Dockerfile to dockerhub
375-
376-
After editing the dockerfile, build the image and push it to dockerhub with the following steps
377-
378-
1. To build the image, make sure that you are in the same directory as your image, and then run `docker build -t ubcthunderbots/<image name>[:tag] .` Make sure that your chosen image name matches a repository in dockerhub. Here's an example with the Robocup 2021 setup image: `docker build -t ubcthunderbots/tbots-software-env:0.0.1`
379-
2. Now, push your image to dockerhub. Get the credentials for the Thunderbots dockerhub account from a software lead.
380-
1. Log into the docker account with `docker login`. You will be prompted for a username and password
381-
2. Now, push this image by its name: `docker push ubcthunderbots/<image name>[:tag]`
382-
383408
# Workflow
384409

385410
## Issue and Project Tracking

docs/useful-robot-commands.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,13 @@ flowchart TD
8080

8181
## Wifi Disclaimer
8282

83-
To use most of these commands you will either need to be on the tbots wifi network (no internet access) or on a wifi with internet access (shawopen, ubc wifi) and connected to the Jetson Nano through ethernet tethering.
83+
To use most of these commands you will either need to be on the tbots wifi network (no internet access) or on a WiFi with internet access (`ubcvisitor`) and connected to the robot through ethernet tethering. Note that ethernet tethering doesn't work on `ubcsecure` or `eduroam`.
8484

85-
The IP address of the robots on the tbots network is `192.168.0.20<robot_id>` so for robot id `1` the IP is `192.168.0.201`. If you are using ethernet tethering you will need to use a network utility (tshark, wireshark, arp) to determine the IP address.
85+
On the tbots network:
86+
- Jetson Nano robots will have an IP address of `192.168.0.20<robot_id>` so for robot id `1` the IP is `192.168.0.201`.
87+
- Raspberry Pi robots will have an IP address of `192.168.6.20<robot_id>` so for robot id `1` the IP is `192.168.6.201`. Occasionally, these robots may have an IP address of `192.168.5.20<robot_id>`.
88+
89+
If you are not using the tbots network you will need to use a network utility (`tshark`, `wireshark`, `arp`) to determine the IP address.
8690

8791
## Miscellaneous Ansible Tasks & Options
8892

0 commit comments

Comments
 (0)