Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/UBC-Thunderbots/Software
Browse files Browse the repository at this point in the history
…into duplicate_power_kick
  • Loading branch information
DimitriK24 committed Oct 19, 2024
2 parents 9f250fa + 85cf8a9 commit 7eaf4ce
Show file tree
Hide file tree
Showing 160 changed files with 1,847 additions and 881 deletions.
46 changes: 28 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
# checks-out the repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Environment Setup
run: |
Expand All @@ -30,19 +30,24 @@ jobs:
-//software/simulated_tests/... \
-//software/ai/hl/... \
-//software/field_tests/... \
-//software/jetson_nano/... \
-//software/embedded/... \
- name: Jetson Nano Build Test
run: |
cd src
bazel build --cpu=jetson_nano //software/jetson_nano:thunderloop_main --copt=-O3
bazel build --cpu=jetson_nano //software/embedded:thunderloop_main --copt=-O3 --//software/embedded:host_platform=NANO
- name: Raspberry Pi Build Test
run: |
cd src
bazel build --cpu=jetson_nano //software/embedded:thunderloop_main --copt=-O3 --//software/embedded:host_platform=PI
software-tests:
name: Software Tests
runs-on: ubuntu-20.04
steps:
# checks-out the repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Environment Setup
run: |
Expand All @@ -58,12 +63,12 @@ jobs:
-//software/field_tests/... \
-//software/ai/navigator/...
jetson-nano-tests:
name: Jetson Nano Software Tests
robot-tests:
name: Robot Software Tests
runs-on: ubuntu-20.04
steps:
# checks-out the repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Environment Setup
run: |
Expand All @@ -85,14 +90,19 @@ jobs:
- name: Jetson Nano Build
run: |
cd src
bazel build --cpu=jetson_nano //software/jetson_nano:thunderloop_main --copt=-O3
bazel build --cpu=jetson_nano //software/embedded:thunderloop_main --copt=-O3 --//software/embedded:host_platform=NANO
- name: Raspberry Pi Build
run: |
cd src
bazel build --cpu=jetson_nano //software/embedded:thunderloop_main --copt=-O3 --//software/embedded:host_platform=PI
simulated-gameplay-tests:
name: Simulated Gameplay Tests
runs-on: ubuntu-20.04
steps:
# checks-out the repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Environment Setup
run: |
Expand All @@ -110,27 +120,27 @@ jobs:
- name: Upload simulated test proto logs
# Ensure that simulated test logs get uploaded
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: blue-ai-proto-logs
name: blue-sim-test-proto-logs
path: |
/tmp/tbots/blue/logs
/tmp/tbots/blue/test/*/proto_*
- name: Upload simulated test proto logs
# Ensure that simulated test logs get uploaded
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: yellow-ai-proto-logs
name: yellow-sim-test-proto-logs
path: |
/tmp/tbots/yellow/logs
/tmp/tbots/yellow/test/*/proto_*
autorefd-game:
name: AutoRef'd Game (3 Minutes)
runs-on: ubuntu-20.04
steps:
# checks-out the repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Environment Setup
run: |
Expand All @@ -144,7 +154,7 @@ jobs:
- name: Upload AI vs AI logs
# Ensure that simulated test logs get uploaded
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: blue-ai-vs-ai-proto-logs
path: |
Expand All @@ -153,7 +163,7 @@ jobs:
- name: Upload AI vs AI logs
# Ensure that simulated test logs get uploaded
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: yellow-ai-vs-ai-proto-logs
path: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
if: github.event.pull_request.draft == false
steps:
# checks-out the repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Environment Setup
run: |
Expand Down
30 changes: 15 additions & 15 deletions docs/fsm-diagrams.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,21 @@ Terminate:::terminate --> Terminate:::terminate
```

## [HaltFSM](/src/software/ai/hl/stp/tactic/halt/halt_fsm.h)

```mermaid
stateDiagram-v2
classDef terminate fill:white,color:black,font-weight:bold
direction LR
[*] --> StopState
StopState --> StopState : [!stopDone]\n<i>updateStop</i>
StopState --> Terminate:::terminate : [stopDone]\n<i>updateStop</i>
Terminate:::terminate --> StopState : [!stopDone]\n<i>updateStop</i>
Terminate:::terminate --> Terminate:::terminate : [stopDone]\n<i>updateStop</i>
```

## [KickFSM](/src/software/ai/hl/stp/tactic/kick/kick_fsm.h)

```mermaid
Expand Down Expand Up @@ -441,18 +456,3 @@ Terminate:::terminate --> Terminate:::terminate : <i>SET_STOP_PRIMITIVE_ACTION</
```

## [StopFSM](/src/software/ai/hl/stp/tactic/stop/stop_fsm.h)

```mermaid
stateDiagram-v2
classDef terminate fill:white,color:black,font-weight:bold
direction LR
[*] --> StopState
StopState --> StopState : [!stopDone]\n<i>updateStop</i>
StopState --> Terminate:::terminate : [stopDone]\n<i>updateStop</i>
Terminate:::terminate --> StopState : [!stopDone]\n<i>updateStop</i>
Terminate:::terminate --> Terminate:::terminate : [stopDone]\n<i>updateStop</i>
```

33 changes: 19 additions & 14 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
Table of Contents
=================
<!--
NOTE: when creating or re-creating a table of contents like this, you can
save a LOT of time by using this tool:
https://github.com/ekalinin/github-markdown-toc
-->
Table of Contents
=================

* [Software Setup](#software-setup)
* [Introduction](#introduction)
Expand All @@ -30,8 +25,8 @@ Table of Contents
* [Profiling](#profiling)
* [Callgrind](#callgrind)
* [Tracy](#tracy)
* [Building for Jetson Nano](#building-for-jetson-nano)
* [Deploying to Jetson Nano](#deploying-to-jetson-nano)
* [Building for the robot](#building-for-the-robot)
* [Deploying Robot Software to the robot](#deploying-robot-software-to-the-robot)
* [Setting up Virtual Robocup 2021](#setting-up-virtual-robocup-2021)
* [Setting up the SSL Simulation Environment](#setting-up-the-ssl-simulation-environment)
* [Pushing a Dockerfile to dockerhub](#pushing-a-dockerfile-to-dockerhub)
Expand All @@ -49,6 +44,14 @@ Table of Contents
* [Example Workflow](#example-workflow)
* [Testing](#testing)

<!--
Created by https://github.com/ekalinin/github-markdown-toc
NOTE: when creating or re-creating a table of contents like this, you can
save a LOT of time by using this tool:
https://github.com/ekalinin/github-markdown-toc
-->

# Software Setup

## Introduction
Expand Down Expand Up @@ -339,17 +342,19 @@ Tracy also samples call stacks. If the profiled binary is run with root permissi

./tbots.py run thunderscope_main --tracy --sudo

## Building for Jetson Nano
## Building for the robot

To build for the Jetson Nano, build the target with the `--cpu=jetson_nano` flag and the toolchain will automatically build using the ARM toolchain for Jetson Nano. For example, `bazel build --cpu=jetson_nano //software/geom/...`.
To build for the robot computer, build the target with the `--cpu=jetson_nano` flag and the toolchain will automatically build using the ARM toolchain. For example, `bazel build --cpu=jetson_nano //software/geom/...`.

## Deploying to Jetson Nano
## Deploying Robot Software to the robot

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

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

`bazel run //software/jetson_nano/ansible:run_ansible --cpu=jetson_nano -- --playbook deploy_nano.yml --hosts <robot_ip> --ssh_pass <jetson_nano_password>`
`bazel run //software/embedded/ansible:run_ansible --cpu=jetson_nano --//software/embedded:host_platform=<platform> -- --playbook deploy_robot_software.yml --hosts <robot_ip> --ssh_pass <robot_password>`

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.

## Setting up Virtual Robocup 2021

Expand Down
16 changes: 4 additions & 12 deletions docs/robot-software-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

## Ansible

[Ansible](https://www.ansible.com/overview/how-ansible-works) allows us to run actions on multiple robots at once. Actions are communicated through YAML files called playbooks. Playbooks contain a series of tasks (ex move a file, run this script, output this command) and logic dictating dependencies between tasks. When playbooks are run, Ansible establishes an SSH connection between the user's computer and target Jetson Nanos, allowing it to run the tasks in the playbook. Output from each task, and any other requested output, is displayed on the console
[Ansible](https://www.ansible.com/overview/how-ansible-works) allows us to run actions on multiple robots at once. Actions are communicated through YAML files called playbooks. Playbooks contain a series of tasks (eg. move a file, run this script, output this command) and logic dictating dependencies between tasks. When playbooks are run, Ansible establishes an SSH connection between the user's computer and robot, allowing it to run the tasks in the playbook. Output from each task, and any other requested output, is displayed on the console

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

Example command: `bazel run //software/jetson_nano/ansible:run_ansible --cpu=jetson_nano -- --playbook deploy_nano.yml --hosts <robot_ip> --ssh_pass <jetson_nano_password>`
Example command: `bazel run //software/embedded/ansible:run_ansible --cpu=jetson_nano --//software/embedded:host_platform=<platform> -- --playbook deploy_robot_software.yml --hosts <robot_ip> --ssh_pass <robot_password>`

More commands available [here](useful-robot-commands.md#off-robot-commands)

Expand All @@ -36,14 +36,6 @@ To learn more about how it works, [see the RFC](https://docs.google.com/document

# Thunderloop

Thunderloop is software that runs in a loop. It continuously polls services (unrelated from Systemd) sending relevant control proto (`PowerControl`, `MotorControl`) and receiving back status proto. Currently we have a [Network](https://github.com/UBC-Thunderbots/Software/blob/master/src/software/jetson_nano/services/network/network.cpp), [Power](https://github.com/UBC-Thunderbots/Software/blob/master/src/software/jetson_nano/services/power.cpp) and [Motor service](https://github.com/UBC-Thunderbots/Software/blob/master/src/software/jetson_nano/services/motor.cpp). Thunderloop also receives `World` and `PrimitiveSet` Proto from AI and sends back Robot Status.
Thunderloop is software that runs in a loop. It continuously polls services (unrelated from Systemd), sending relevant control protos (`PowerControl`, `MotorControl`) and receiving back status protos from the power and motor boards. Currently we have a [Network](https://github.com/UBC-Thunderbots/Software/blob/master/src/software/embedded/services/network/network.cpp), [Power](https://github.com/UBC-Thunderbots/Software/blob/master/src/software/embedded/services/power.cpp) and [Motor](https://github.com/UBC-Thunderbots/Software/blob/master/src/software/embedded/services/motor.cpp) services. Thunderloop also receives `World` and `PrimitiveSet` protos from AI and sends back `Robot Status` protos.

Motor and Power service both interface with their respective electrical boards over different communication interfaces, namely SPI and UART respectively.

# Announcements

Broadcasts packets for what robot IDs are connected to wifi and what IPs they have. Combined with `robot_broadcast_receiver.py` allows us to see all robots on the network.

# Display

Displays information about the robot for us. Uses redis to receive info from other processes. Can also change values with physical buttons.
Motor and Power services both interface with their respective electrical boards over different communication interfaces, namely SPI and UART respectively.
Loading

0 comments on commit 7eaf4ce

Please sign in to comment.