Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/actions/environment-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ runs:
shell: bash
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like protobuf now depends on rules_android, which needs the Android SDK

sudo rm -rf /opt/ghc

- name: Run setup_software.sh
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
- name: Raspberry Pi Build Test
run: |
cd src
bazel build //software/embedded:thunderloop_main --copt=-O3 --platforms=//toolchains/cc:robot
bazel build //software/embedded:thunderloop_main --copt=-O3 --config=robot

- name: Motor Firmware build Test
run: |
Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:
- name: Raspberry Pi Build
run: |
cd src
bazel build //software/embedded:thunderloop_main --copt=-O3 --platforms=//toolchains/cc:robot
bazel build //software/embedded:thunderloop_main --copt=-O3 --config=robot


simulated-gameplay-tests:
Expand All @@ -155,11 +155,11 @@ jobs:
# //software/gameplay_tests/... \
run: |
cd src
bazel test //software/gameplay_tests:requirements_test
bazel test //software/gameplay_tests:requirements.test
bazel test --copt=-O3 --flaky_test_attempts=3 --show_timestamps \
--test_arg="--ci_mode" \
-- //software:unix_full_system \
-//software/gameplay_tests:requirements_test \
-//software/gameplay_tests:requirements.test \
//software/ai/hl/... \
//software/ai/navigator/...

Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ Tracy also samples call stacks. If the profiled binary is run with root permissi

## Building for the robot

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/...`.
To build for the robot computer, build the target with the `--config=robot` flag and the toolchain will automatically build using the ARM toolchain. For example, `bazel build --config=robot //software/geom/...`.

## Deploying Robot Software to the robot

Expand All @@ -353,7 +353,7 @@ We use Ansible to automatically update software running on the robot. [More info
To update binaries on a working robot, you can run:

```bash
bazel run //software/embedded/ansible:run_ansible --platforms=//toolchains/cc:robot -- --playbook deploy_robot_software.yml --hosts <robot_ip> --ssh_pass <robot_password>
bazel run //software/embedded/ansible:run_ansible --config=robot -- --playbook deploy_robot_software.yml --hosts <robot_ip> --ssh_pass <robot_password>
```

Where `<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.
Expand Down
2 changes: 1 addition & 1 deletion docs/robot-software-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

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/embedded/ansible:run_ansible --platforms=//toolchains/cc:robot -- --playbook deploy_robot_software.yml --hosts <robot_ip> --ssh_pass <robot_password>`
Example command: `bazel run //software/embedded/ansible:run_ansible --config=robot -- --playbook deploy_robot_software.yml --hosts <robot_ip> --ssh_pass <robot_password>`
* <robot_ip>: IP address of the robot
* <robot_password>: Password of the robot

Expand Down
2 changes: 1 addition & 1 deletion docs/setup-pi.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ ping -c 3 8.8.8.8
3. Exit the SSH connection to the Raspberry Pi with the `exit` command.
4. Change directory to `Software/src` and run the bazel ansible command:
```bash
bazel run //software/embedded/ansible:run_ansible --platforms=//toolchains/cc:robot -- --playbook setup_pi.yml --hosts <robot_name>.local --ssh_pass <robot_password>
bazel run //software/embedded/ansible:run_ansible --config=robot -- --playbook setup_pi.yml --hosts <robot_name>.local --ssh_pass <robot_password>
```
* Ensure you configure `<robot_name>` and `<password>` in the command above. Copy/pasting the above won't work.
* This may take a while.
Expand Down
10 changes: 5 additions & 5 deletions docs/useful-robot-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Individual miscellaneous tasks (ex reboot, shutdown, rtt test) can be run throug
To view a list of supported arguments, run:

```bash
bazel run //software/embedded/ansible:run_ansible --platforms=//toolchains/cc:robot -h
bazel run //software/embedded/ansible:run_ansible --config=robot -h
```

If desired, the `-ho`, `--hosts` argument can be replaced with `-p`, `--port`, defining a port to listen to for Announcements from hosts.
Expand All @@ -77,7 +77,7 @@ This will stop the current Systemd services, replace and restart them. Binaries
<b>This will trigger motor calibration meaning the wheels may spin. Please elevate the robot so the wheels are not touching the ground for proper calibration.</b>

```bash
bazel run //software/embedded/ansible:run_ansible --platforms=//toolchains/cc:robot --//software/embedded:motor_board=<motor_board> -- --playbook deploy_robot_software.yml --hosts <robot_ip> --ssh_pass <robot_password>
bazel run //software/embedded/ansible:run_ansible --config=robot --//software/embedded:motor_board=<motor_board> -- --playbook deploy_robot_software.yml --hosts <robot_ip> --ssh_pass <robot_password>
```

* <motor_board> is the type of motor driver board on the robot (either `STSPIN` or `TRINAMIC`)
Expand All @@ -103,7 +103,7 @@ This will flash powerloop, the current firmware in `software/power/`, onto the p
Looking from the back of the robot the reset and boot buttons are on right side of the battery holder on the lowest board with the reset being on the left and the boot on the right. <b>Warning it may kick/chip when pressed.</b>

```bash
bazel run //software/embedded/ansible:run_ansible --platforms=//toolchains/cc:robot -- --playbook deploy_powerboard.yml --hosts <robot_ip> --ssh_pass <robot_password>
bazel run //software/embedded/ansible:run_ansible --config=robot -- --playbook deploy_powerboard.yml --hosts <robot_ip> --ssh_pass <robot_password>
```

## Flashing the Motor Driver Boards from Raspberry Pi
Expand All @@ -122,7 +122,7 @@ This section refers to setting up the computer on the robot for the first time.
### Raspberry Pi

```bash
bazel run //software/embedded/ansible:run_ansible --platforms=//toolchains/cc:robot -- --playbook setup_pi.yml --hosts <robot_ip> --ssh_pass <robot_password>
bazel run //software/embedded/ansible:run_ansible --config=robot -- --playbook setup_pi.yml --hosts <robot_ip> --ssh_pass <robot_password>
```

## Robot Diagnostics
Expand Down Expand Up @@ -155,7 +155,7 @@ Deploys the STSPIN Motor Controller Test binary onto a robot through Ansible.
From Software/src:

```bash
bazel run //software/embedded/ansible:run_ansible --platforms=//toolchains/cc:robot --//software/embedded:motor_board=STSPIN -- --playbook deploy_stspin_motor_controller_test.yml --hosts <robot_name> --ssh_pass <robot_password>
bazel run //software/embedded/ansible:run_ansible --config=robot --//software/embedded:motor_board=STSPIN -- --playbook deploy_stspin_motor_controller_test.yml --hosts <robot_name> --ssh_pass <robot_password>
```

* replace the \<robot_ip\> with the actual ip address of the Raspberry Pi for the ssh connection.
Expand Down
2 changes: 1 addition & 1 deletion docs/wifi-communication-readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ You must know:
- The WiFi interface of the robot. We will refer to this interface as `{robot_wifi_interface}`. This interface is typically found by running `ifconfig` or `ip a` on the robot.
- The network interface of the host computer. We will refer to this interface as `{host_interface}`. This interface is typically found by running `ifconfig` or `ip a` on the host computer.

1. Build the latency tester secondary node: `./tbots.py build latency_tester_secondary_node --platforms=//toolchains/cc:robot`
1. Build the latency tester secondary node: `./tbots.py build latency_tester_secondary_node --config=robot`
2. Copy the binary to the robot: `scp bazel-bin/software/networking/benchmarking_utils/latency_tester_secondary_node robot@{robot_ip}:/home/robot/latency_tester_secondary_node`
3. SSH into the robot: `ssh robot@{robot_ip}`
4. There are two test modes: multicast or unicast
Expand Down
15 changes: 13 additions & 2 deletions src/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,14 @@ common --features=external_include_paths
# See https://docs.bazel.build/versions/master/remote-caching.html#disk-cache
build --disk_cache=~/.cache/thunderbots_bazel_disk_cache

build --experimental_remote_merkle_tree_cache # partial repo caching optimization

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that this option is no longer supported

common --incompatible_enable_proto_toolchain_resolution # protoc caching
common --@protobuf//bazel/toolchains:prefer_prebuilt_protoc

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that the prebuilt binaries will actually work in the nanopb pipeline for compiling the onboard protobufs. This will need to be tested with a real robot to verify, but for some context, this feature is simply the now upstream variant of the alex eagle toolchains protobuf repo. During the Bazel 8 migration, I had attempted to use this optimization (622a89a), but to no avail.

Here is the thread I inquired upon the issue with, but to no response aspect-archives/toolchains_protoc#21

I can't quite recall what exactly didn't work, so it is probably a good idea to test on-robot.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I've got the nanopb pipeline using prebuilt protoc now. bazel cquery deps(//proto:tbots_nanopb_proto) shows the prebuilt binary (@@protobuf++protoc+prebuilt_protoc.linux_x86_64//:bin/protoc) in the build graph instead of @protobuf//:protoc which builds from source.

common --incompatible_default_to_explicit_init_py

# Cross-compilation config for targeting the robot (aarch64)
build:robot --platforms=//toolchains/cc:robot
build:robot --copt=-I/opt/tbotspython/cross_compile_headers/include
build:robot --copt=-Wno-attributes

# Ensure that we don't accidentally build gRPC
common --per_file_copt=external/.*grpc.*@--GRPC_WAS_NOT_SUPPOSED_TO_BE_BUILT
Expand All @@ -54,6 +60,11 @@ common --host_per_file_copt=external/.*grpc.*@--GRPC_WAS_NOT_SUPPOSED_TO_BE_BUIL
################# Build Configurations #################
# Lock C++ version
build --cxxopt="-std=c++2a"
# Suppress deprecation warnings in external deps (protobuf 35.1 uses its own
# deprecated FieldOptions::weak() internally; abseil has false-positive
# -Wmaybe-uninitialized). Our code still gets -Werror via build:linux below.
build --per_file_copt=external/.*@-Wno-deprecated-declarations,-Wno-deprecated,-Wno-maybe-uninitialized
build --cxxopt=-Wno-class-memaccess
# Warn variable length arrays only when compiling cpp
build --per_file_copt=.*\.cpp@-Wvla

Expand All @@ -69,7 +80,7 @@ build --incompatible_remove_legacy_whole_archive=False

# Escalate Warnings to fail Compile for Thunderbots code
build --features=external_include_paths
build:linux --per_file_copt=proto/.*,proto/message_translation/.*,proto/primitive/.*,software/.*,shared/.*,-external/.*@-Wall,-Wextra,-Wno-unused-parameter,-Wno-deprecated,-Werror,-Wno-deprecated-declarations
build:linux --per_file_copt=proto/.*,proto/message_translation/.*,proto/primitive/.*,software/.*,shared/.*,-external/.*@-Wall,-Wextra,-Wno-unused-parameter,-Wno-deprecated,-Wno-sign-compare,-Werror,-Wno-deprecated-declarations,-Wno-unused-result,-Wno-missing-field-initializers
# TODO: #3492
# build --per_file_copt=software/.*,shared/.*,-external/.*@-Wconversion

Expand Down
2 changes: 1 addition & 1 deletion src/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.2.1
9.1.1
1 change: 0 additions & 1 deletion src/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands")
load("@rules_python//python:defs.bzl", "py_runtime", "py_runtime_pair")

# Generates compile_commands.json
refresh_compile_commands(
Expand Down
60 changes: 48 additions & 12 deletions src/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ module(
##############################################################
# Import Dependencies available in the Bazel Central Registry
##############################################################
bazel_dep(name = "googletest", version = "1.15.2")
bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "pybind11_bazel", version = "2.13.6")
bazel_dep(name = "bazel_skylib", version = "1.8.1")
bazel_dep(name = "googletest", version = "1.16.0.bcr.2")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "pybind11_bazel", version = "3.0.1")
bazel_dep(name = "bazel_skylib", version = "1.9.0")
bazel_dep(name = "rules_cc", version = "0.2.19")
bazel_dep(name = "rules_shell", version = "0.6.1")
bazel_dep(name = "rules_pkg", version = "1.1.0")
bazel_dep(name = "rules_foreign_cc", version = "0.14.0")
bazel_dep(name = "rules_python", version = "1.4.1")
bazel_dep(name = "rules_python", version = "2.2.0")
bazel_dep(name = "eigen", version = "3.4.0.bcr.3")
bazel_dep(name = "zlib", version = "1.3.1.bcr.6")
bazel_dep(name = "nanopb", version = "0.4.9.1.bcr.2")
bazel_dep(name = "protobuf", version = "31.1")
bazel_dep(name = "zlib", version = "1.3.1.bcr.7")
bazel_dep(name = "nanopb", version = "0.4.9.1.bcr.3")
bazel_dep(name = "protobuf", version = "35.1")
bazel_dep(name = "rules_proto", version = "7.1.0")
bazel_dep(name = "yaml-cpp", version = "0.8.0")
bazel_dep(name = "buildifier_prebuilt", version = "8.0.3")
Expand Down Expand Up @@ -47,6 +49,10 @@ pip.parse(
python_interpreter = "/opt/tbotspython/bin/python",
python_version = "3.12",
requirements_lock = "//software/embedded/ansible:requirements_lock.txt",
target_platforms = [
"linux_x86_64",
"linux_aarch64",
],
)
use_repo(pip, "ansible_deps")
pip.parse(
Expand All @@ -61,6 +67,10 @@ pip.parse(
python_interpreter = "/opt/tbotspython/bin/python",
python_version = "3.12",
requirements_lock = "//software/embedded/robot_diagnostics_cli:requirements_lock.txt",
target_platforms = [
"linux_x86_64",
"linux_aarch64",
],
)
use_repo(pip, "robot_diagnostics_cli_deps")
pip.parse(
Expand Down Expand Up @@ -125,10 +135,9 @@ http_archive(
bazel_dep(name = "rules_boost", repo_name = "com_github_nelhage_rules_boost")
archive_override(
module_name = "rules_boost",
# Made with: shasum -a 256 rules_boost-2a003f812e9a13b970e4100d96856b09ee13a582.tar.gz
sha256 = "f3125bbcb4adb5863980562d6092f2c07571cc9b2d4510e3b7f829fd43b44607",
strip_prefix = "rules_boost-2a003f812e9a13b970e4100d96856b09ee13a582",
url = "https://github.com/nelhage/rules_boost/archive/2a003f812e9a13b970e4100d96856b09ee13a582.tar.gz",
sha256 = "722178ab4687ebf48c66229a0fe774759bd836257bcede2ed972b0e32ce92c33",
strip_prefix = "rules_boost-2811ec9f1e42f784439a7bbecf68b1c8b5f8b0ae",
url = "https://github.com/nelhage/rules_boost/archive/2811ec9f1e42f784439a7bbecf68b1c8b5f8b0ae.tar.gz",
)

non_module_boost_repositories = use_extension("@com_github_nelhage_rules_boost//:boost/repositories.bzl", "non_module_dependencies")
Expand All @@ -141,6 +150,11 @@ use_repo(
bazel_dep(name = "hedron_compile_commands", dev_dependency = True)
archive_override(
module_name = "hedron_compile_commands",
patches = [
"//starlark/patches/hedron_compile_commands:add_rules_python_dep.patch",
"//starlark/patches/hedron_compile_commands:fix_py_binary.patch",
"//starlark/patches/hedron_compile_commands:fix_cc_binary.patch",
],
sha256 = "ba3feefdf57b6d4c749e3c4abfa86f3673e7db364cb13acfc3496dce6ea801a3",
strip_prefix = "bazel-compile-commands-extractor-f5fbd4cee671d8d908f37c83abaf70fba5928fc7",
url = "https://github.com/mikael-s-persson/bazel-compile-commands-extractor/archive/f5fbd4cee671d8d908f37c83abaf70fba5928fc7.tar.gz",
Expand All @@ -149,6 +163,7 @@ archive_override(
bazel_dep(name = "platformio_rules", repo_name = "platformio_rules")
archive_override(
module_name = "platformio_rules",
patches = ["//starlark/patches/platformio_rules:add_py_binary_load.patch"],
sha256 = "a80357230e27b8b57b8deffaa82684d3ee88b2284e4a767a9d8a692e9034e125",
strip_prefix = "platformio_rules-3cd18c7c7bb2482fe3cbb58898245dd675421234",
url = "https://github.com/mum4k/platformio_rules/archive/3cd18c7c7bb2482fe3cbb58898245dd675421234.tar.gz",
Expand Down Expand Up @@ -314,3 +329,24 @@ new_local_repository(
##############################################
# Workarounds and Fixes Below (hacks)
##############################################

# Bazel 9 compatibility: register rules_cc compatibility proxy for
# transitive dependencies that haven't been updated.
cc_compat = use_extension("@rules_cc//cc:extensions.bzl", "compatibility_proxy")
use_repo(cc_compat, "cc_compatibility_proxy")

# googletest 1.16.0.bcr.2 needs compat proxy registration for Bazel 9.
single_version_override(
module_name = "googletest",
patches = ["//starlark/patches/googletest:add_compat_proxy.patch"],
version = "1.16.0.bcr.2",
)

# pybind11_protobuf needs Bazel 9 compat and protobuf 35 API fixes.
single_version_override(
module_name = "pybind11_protobuf",
patches = [
"//starlark/patches/pybind11_protobuf:add_compat_proxy.patch",
"//starlark/patches/pybind11_protobuf:protobuf35_compat.patch",
],
)
Loading
Loading