No pose data plotted on AdvantageScope 3D FIELD tab

I’m connected live between AdvantageScope (2.3.0) running on a Windows 10 laptop and the roboRIO running the WPILib example Java AprilTag detector and pose estimator.

The pose data are correctly updating in real-time on the Line Graph tab but nothing appears but the predefined field on the 3D FIELD tab.

What have I done wrong? Thanks.

// We'll output to NT
NetworkTable tagsTable = NetworkTableInstance.getDefault().getTable("apriltags");
IntegerArrayPublisher pubTags = tagsTable.getIntegerArrayTopic("tags").publish();

tagsTable
            .getEntry("pose_" + detection.getId())
            .setDoubleArray(
                new double[] {
                  pose.getTranslation().getX(), pose.getTranslation().getY(), pose.getTranslation().getZ()
                  ,
                  pose.getRotation().getQuaternion().getX(), pose.getRotation().getQuaternion().getY(), pose.getRotation().getQuaternion().getZ()
                });


// put list of tags onto dashboard
pubTags.set(tags.stream().mapToLong(Long::longValue).toArray());


The tag rotation is a quaternion, which has four components: W, X, Y, and Z. This means the each pose should have 7 values in total, like this:

tagsTable
    .getEntry("pose_" + detection.getId())
    .setDoubleArray(
        new double[] {
            pose.getTranslation().getX(),
            pose.getTranslation().getY(),
            pose.getTranslation().getZ(),
            pose.getRotation().getQuaternion().getW(),
            pose.getRotation().getQuaternion().getX(),
            pose.getRotation().getQuaternion().getY(),
            pose.getRotation().getQuaternion().getZ()
        });

Thank you; I see the robot now. The original example put out radians and I did an incompetent, too simple conversion to quaternions.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.