I’m experimenting with publishing AprilTag data to AdvantageScope. I can publish the Pose3d objects, and they appear, but I can’t figure out how to publish the AprilTag objects (fiducial ID and Pose3d). The documentation says AprilTag is supported, but it doesn’t provide any details for how to do it.
This works for the Pose3d, but how do I set up the table to publish AprilTag objects instead of Pose3d objects?
private StructArrayPublisher<Pose3d> arrayPublisher = NetworkTableInstance.getDefault()
.getStructArrayTopic("AprilTags", Pose3d.struct).publish();
public void periodic() {
...
var result = simulatedCamera.getLatestResult();
if (result.hasTargets()) {
var tagsToPublish = result.targets.stream().map(target -> {
return getTargetPose(robotPose, target);
}).toArray(Pose3d[]::new);
arrayPublisher.accept(tagsToPublish);
}
...
}
Whoops, you’re right, we haven’t implemented that in WPILib yet. You could implement your own (either struct or protobuf) pretty easily, but I’m not sure what AdvantageScope is expecting here. @jonahb55 ?
Thanks. That’s what didn’t make sense to me. It says it’s “supported”, but it seems like they need to document what it expects since it doesn’t work out of the box.