Skip to content

Phase out NUgus and introduce Booster K1 to the codebase - #1828

Open
ZeoNyph wants to merge 359 commits into
mainfrom
main
Open

ZeoNyph wants to merge 359 commits into
mainfrom
main

Conversation

@ZeoNyph

@ZeoNyph ZeoNyph commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

We all knew this day was coming! This PR is the culmination of months of work and phases out the NUgus for the K1.

There are a lot of changes:

  • Compilation toolchain: This is one of the bigger changes, and took me the longest time to actually get ready, as the compilation toolchain was reworked to allow for cross-compilation across processor architectures (x86 to ARM). I also had to change the base to Ubuntu 22.04 (goodbye Arch my beloved ;-;) to match the distro used by the K1s, and remove/add dependencies where needed. Have a look at the stuff in /docker to see the shennanigans I had to get into.
  • Booster SDK integration: I had to add the Booster SDK to the Docker image (and update the version constantly as Booster loves to add new and useful features every major update lol), and also write a new Booster HardwareIO module so that we can integrate it with the higher-level modules. I tried to make it so that the Booster module would be the only module that directly uses the SDK, but alas, K1Camera and K1Sensor failed to adhere to that. Speaking of...
  • New K1-specific modules: there are now K1-specific modules for the camera and sensor data, as the NUgus RawSensors module had a lot of bespoke logic that was made with the NUgus in mind, and the camera relies on DDS messaging as opposed to the previous USB stream with the Aravis library. @Tom0Brien helped out a lot here when it came to rewriting the sensors module, so thank you Tom!
  • TensorRT as main vision inference library: Given that we are moving to a platform that runs on an NVIDIA Jetson Orin NX, OpenVINO can no longer cut it as the main execution provider for ONNX inference (given that it doesn't work at all on the Jetson). As a result, I had to make a TensorRT execution provider for YOLO so we could get it running on the Jetson.
  • Behaviour changes: a lot happened here, primarily as a result of the collaboration with UNSW and RMIT, and so @sebastianbrooker2 refactored the Support module to rely on a newly-made formation.yaml file made from the formation rules used by the other teams. There were changes here that I'm not fully across, so let me know if I missed anything here.
  • Visual Mesh disabled: unfortunately, for now we've had to disable Visual Mesh, as OpenCL does not work on the Jetson, and CPU inference was too slow for gameplay (1 fps was what we saw).
  • SystemConfiguration and RoboCupConfiguration changes: these had to be changed in order to account for the fact that we do not setup the K1s from scratch (meaning we don't have a fresh OS install and install scripts like we do for the NUgus). This primarily applies to SystemConfiguration, but RobocupConfiguration has changes made as part of the work done at Incheon and Beijing (NetworkManager instead of systemd-network, ability to restart Booster's daemon, ability to use DHCP, and more)

There were a lot of changes done, and I don't fully recall all of them, so I'll add them in as I remember.

Reviewers, Note

I will need to do a full pass of NUbook documentation and make a PR for that as well (including archiving NUgus and Darwin documentation). There's also a fair bit of work left on the K1 repo in terms of outstanding PRs and changes (need to bring in changes from Beijing into main, and also look into things such as switching to ONNXRuntime instead of maintaining a bespoke TensorRT implementation).

There's also ongoing work with the NUgus (@vincenttumminello is working on RL with the NUgus as part of his FYP), as well as other outstanding PRs on this end of the codebase.

Once both ends have merged/closed their relevant PRs, we can tag the most recent NUgus commit and begin the merge.

Things left to do

  • Write NUbook documentation
  • Cleanup K1 repo (outstanding PRs)
  • Ensure all NUgus work is complete
  • Other miscellaneous items I have missed

Tom0Brien and others added 30 commits June 22, 2026 21:22
@ZeoNyph ZeoNyph self-assigned this Sep 7, 2026
@ZeoNyph ZeoNyph added -Enhancement Enhancement of existing features !!-High-Priority Needs to be done soon L-TypeScript Uses or involves TypeScript or JavaScript P-NUsight2 Project: NUsight2 G-DevOps-QA DevOps and QA Group G-Motion Motion Group G-DevTools DevTools Group G-Localisation-Odometry Localisation and Odometry Group G-Vision Vision Group G-Hardware Hardware Group G-Behaviour Behaviour Group L-Python Uses or involves Python L-C++ Uses or involves C++ L-CMake Uses or involves CMake L-Protobuf Uses or involves Protobuf -New-Feature Something which we don't have or can't do L-Shell-Script Uses or involves linux shell scripts L-Docker Uses or involves Docker labels Sep 7, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

remove

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

remove

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

remove "K1" from the start of the skill names

Comment thread mjmodel.mjb

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

don't thing this should be here

Comment thread mjmodel.xml

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

don't think this should be here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can probably remove tinyrobotics as a dep now I think

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can be renamed to just Camera

@Tom0Brien

Copy link
Copy Markdown
Member

Should try get CI working

@ysims ysims left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Partial review.

strategy:
matrix:
platform: ["generic", "nuc12wshi7"]
platform: ["generic_k1", "orinnx"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
platform: ["generic_k1", "orinnx"]
platform: ["generic", "orinnx"]

this could still be called generic, right?

@ZeoNyph ZeoNyph Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes it can; I changed it so that if I ever got Actions running on the K1 repo it wouldn't interfere with the NUgus generic image, but it can be changed back for the merge in

Comment on lines +132 to +133
build-args: |
platform=generic

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🧐

Comment on lines +76 to +77
build-args: |
platform=${{ matrix.platform == 'generic_k1' && 'generic' || matrix.platform }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🧐

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

new toolchain uses the platform argument to determine whether to setup stuff for cross-compilation (ARM sysroot, apt repository mirrorlist, etc.), hence the build arg

Comment on lines +136 to +137
build-args: |
platform=generic

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🧐

include(ToolchainLibraryFinder)
ToolchainLibraryFinder(
NAME zlib
NAME ZLIB

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why's the name caps now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

zlib wouldn't work if it wasn't all caps for some reason; will need to double check

Comment thread module/input/K1Camera/src/K1Camera.cpp Outdated
Comment on lines +66 to +67
// Must match the writer-side layout in NUbridge exactly (binary compatibility).
struct SharedImageHeader {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Pull all of this out into a folder similar to what is done for the sensor filter - try to just have the Reactor constructor in here.

@ZeoNyph ZeoNyph Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

K1Camera got a refactor in the beijing-masters-2026 branch to no longer need a shared memory ROS2 bridge; will need to get that in ASAP since it changes a lot of the code you commented on

});

on<Trigger<Sensors>>().then("Buffer Hcw", [this](const Sensors& sensors) {
std::lock_guard<std::mutex> lock(sensors_mutex);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this trying to stop this reaction running more than once at a time? Use Single instead, or look at Sync.

Comment thread module/input/K1Camera/src/K1Camera.cpp Outdated
std::lock_guard<std::mutex> lock(sensors_mutex);
auto now = NUClear::clock::now();
Hcws.resize(std::distance(Hcws.begin(), std::remove_if(Hcws.begin(), Hcws.end(), [now](const auto& v) {
return v.first < (now - std::chrono::milliseconds(500));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

magic number?

Comment thread module/input/K1Camera/src/K1Camera.hpp Outdated
Comment on lines +54 to +60
std::mutex cameras_mutex;
std::mutex sensors_mutex;
std::vector<std::unique_ptr<CameraContext>> cameras;
std::vector<std::pair<NUClear::clock::time_point, Eigen::Isometry3d>> Hcws;

void camera_thread(CameraContext& ctx);
void stop_cameras();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

documentation directives

head_pose:
- segment: _head_pose

# Deadband (metres for x/y, radians for theta) below which normalized odometry components are

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
# Deadband (metres for x/y, radians for theta) below which normalized odometry components are
# Deadband (metres for x/y, radians for theta) below which normalised odometry components are

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

-Enhancement Enhancement of existing features !!-High-Priority Needs to be done soon -New-Feature Something which we don't have or can't do G-Behaviour Behaviour Group G-DevOps-QA DevOps and QA Group G-DevTools DevTools Group G-Hardware Hardware Group G-Localisation-Odometry Localisation and Odometry Group G-Motion Motion Group G-Vision Vision Group L-C++ Uses or involves C++ L-CMake Uses or involves CMake L-Docker Uses or involves Docker L-Protobuf Uses or involves Protobuf L-Python Uses or involves Python L-Shell-Script Uses or involves linux shell scripts L-TypeScript Uses or involves TypeScript or JavaScript P-NUsight2 Project: NUsight2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants