Fix PoseObservation serialization for AdvantageKit replay#662
Fix PoseObservation serialization for AdvantageKit replay#662aschokking wants to merge 2 commits intomainfrom
Conversation
Matrix<N3, N1> has no static struct field, so AdvantageKit's RecordStruct silently drops the estimatedStdDevs field during logging, causing data loss and replay crashes. Replace it with three separate doubles (stdDev0, stdDev1, stdDev2) in the PoseObservation record, which RecordStruct can serialize natively. IO implementations and tests unpack/repack at the record boundary; the rest of the codebase continues using Matrix<N3, N1>. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| VecBuilder.fill(0.02, 0.02, 0.6), // This is from LinearStdDevBaseline, and AngularStdDevBaseline from the old way. | ||
| 0.02, 0.02, 0.6, // This is from LinearStdDevBaseline, and AngularStdDevBaseline from the old way. | ||
| PoseObservationType.PHOTONVISION)); // Observation type | ||
|
|
There was a problem hiding this comment.
It might be better to just delete this class rather than maintain it.
I think with several matches under it's belt now. AprilTagVisionIOPhotonVisionEstimator is now the king, all hail the new king.
There was a problem hiding this comment.
@rokadias That's totally up to vision team, do you want to have someone do the cleanup of what you don't want to keep?
There was a problem hiding this comment.
This is a single ⭐ piece of feedback. I think if you git rm the file and the import that's not used in RobotModule.
I'm also speaking on behalf of the vision team. So yeah if you don't, I'll make a separate PR to do so.
That would be better for maintenance than the adjustment you're making so we don't have to maintain it going forward.
rokadias
left a comment
There was a problem hiding this comment.
Looks like I forgot to approve.
Why are we doing this?
Whats changing?
Claude:
PoseObservation contained a Matrix<N3, N1> estimatedStdDevs field. AdvantageKit's RecordStruct serializes records by
reflecting on each component type and looking for a static struct field. Matrix<N3, N1> doesn't have one, so AKit
silently drops estimatedStdDevs during logging and throws errors during replay deserialization.
Fix
Replace Matrix<N3, N1> estimatedStdDevs in the PoseObservation record with three separate double fields (stdDev0,
stdDev1, stdDev2), which RecordStruct can serialize natively.
The change is kept as narrow as possible:
only at the new PoseObservation(...) call site
VisionPoseObservation
Questions/notes for reviewers
How this was tested