Repository navigation
Add refereed multi-robot matches - #38
Merged
Merged
Conversation
Merging main (e4acc8b) spliced a second, older copy of the file into the middle of publish(), nesting function definitions inside it, so the sdkbridge module no longer compiled. Restore the pre-merge contents (rt/odom included) in main's formatting. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DyRrq9GsES4TwVCpGM4rLF
The scene keeps the ball body at the world origin and its sphere geom 1.38 m away, so zero-padded inherited keyframes still put the ball on its spot. MuJoCo integrates a free body's origin linearly and its rotation separately, so a spinning ball's centre drifts ~0.5 (w dt)^2 |offset| per step: a ball rolled at 3 m/s sank into the floor within 50 ms and the contact launched it to 68 m/s. Kicked balls in NUSim hit the same failure. SimCore now loads every scene through mjSpec (robots == 1 attaches no copies) and moves the ball body's origin onto its sphere before compiling, so the collision bounding volumes stay consistent, then shifts each keyframe's ball position by the rotated offset so every keyframe still rests the ball exactly where it did. The supervisor test loads the scene the same way and checks that no keyframe moved the ball. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DyRrq9GsES4TwVCpGM4rLF
NUSim-only test surface (PROTOCOL.md §6), all nav_msgs/Odometry so no new IDL on either side: - rt/nusim/gt/ball, rt/nusim/gt/robot: world-frame pose and twist at the 50 Hz state cadence, stamped with the wall clock of the physics snapshot, for validating NUbots estimators against the simulator. - rt/nusim/ball_command: place the ball and set its velocity in the world or the robot's yaw frame, optionally with the spin for rolling without slipping. The Supervisor applies it under the sim mutex, whether or not GameController placement is enabled. The ball's centre velocity is computed from qpos/qvel through the geom offset (freebody::geom_centre_state), so it stays exact however the body is laid out. The supervisor test covers placement, the robot frame, rolling spin, agreement with mj_objectVelocity, and that a rolled ball keeps its speed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DyRrq9GsES4TwVCpGM4rLF
The real K1 head camera ("Left Camera") is 544x448, rectilinear, with a
normalised focal length of 0.3725: 106.6 deg horizontal, 95.7 deg vertical and
120.2 deg diagonal field of view. NUSim rendered 640x480 at fovy 70 (about
86 deg horizontal), so the robot saw a narrower, differently framed image than
on hardware, which biases anything validated through the vision chain (ball
detection range, how long a ball stays in view). Set the MJCF camera's fovy to
95.7 and the render size to 544x448; the camera now reports focal_length_norm
0.3727 and a 120.2 deg diagonal.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DyRrq9GsES4TwVCpGM4rLF
Every visual mesh was near-white (0.92), so when the head looked down to the side the robot's own white hand and forearm filled the corner of the image and YOLO took it for a ball: 55% of detections in the ball-localisation benchmark were this self-detection, and the ball filter locked onto it. The real K1's arms, legs, feet and head are black; only the chest is light. Colour the arm, leg, foot and Head_1 meshes dark (as Head_2 already was) and keep the trunk light. False positives in the benchmark drop to 4.7%. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DyRrq9GsES4TwVCpGM4rLF
…-shooter' # Conflicts: # mujoco/module/SdkBridge/CMakeLists.txt
Keep the default network and shared-memory transport unchanged. Exercise the loopback option alongside the existing modes in the DDS transport test. Validation: all 12 native NUSim CTests passed.
SdkBridge now loads the odometry error model on startup, so the test's isolated config directory needs it too. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
rt/nusim/gt/robot in each robot domain must carry only that robot's pose (the robots spawn ~3 m apart, so a leaked sample lands on the wrong side), and the shared ball reaches every domain. test_ground_truth now asserts the ball body origin is on its sphere, as Tum's re-origination guarantees. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Run a game inside the sim: sim/match embeds the GameController and its automatic referee, and ./b match starts a hidden NUbots process for each robot, with no NUbots_K1 changes. Each container gets a FastDDS portBase for the robot's domain, its own camera segment and the sim's field. MatchCameras renders a head camera per robot on the GPU, through EGL's device platform, as EGL_DEFAULT_DISPLAY falls back to the CPU on Wayland. The window gains a panel with the score and buttons, robot labels and a message box. Under --game, odometry starts from each robot's start pose, as NUbots otherwise reverses a robot that starts facing -x. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013cqGHWCjYQTmXB156komSD
Explain where this branch comes from (rUNSWift's multi-robot work), which repositories a match needs, and how to set up and run ./b match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sebastianbrooker2
approved these changes
Nov 14, 2026
sebastianbrooker2
left a comment
Member
There was a problem hiding this comment.
approved as its a prerequisuite for my pr
The rUNSWift branch carried an early copy of NUbots#18 (ball ground truth and ball commands). Conflicts keep rUNSWift's per-robot versions and take main's formatting, comments and BallCommandReader teardown fix. NUbots#37's place_ball() replaces the old centre-mark placement. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since NUbots#37 the scene ball sits on its geom at the rest point and the keyframes zero-pad it, with SimCore::place_ball putting it back. The old test still expected the geom offset and failed on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #10.
./b match --game Nruns an N-a-side match (1 to 3) with stock NUbots players, an embedded GameController and an automatic referee. Seemujoco/module/MatchReferee/README.mdand the "Refereed matches" section of the root README.Built on the multi-robot work by Oliver Obst and Zijie Li (rUNSWift), from
UNSWComputing/NUSimbranchfeature/multi-robot-ground-truth, which isn't on main yet. Thanks to both of them.A follow-up PR will change a lot of this code, so detailed review can wait for that one.
test_supervisorfails here the same way it does on main since #37.🤖 Generated with Claude Code