April Tag Getting Z Position

The Z value of the April tag is not updating. The camera is a separate subsystem, and we have a accessor method to return the Z value. However, when we try to reference it in an autonomous command, the Z value resets to 0 the moment our robot finishes, even though the Z value isn’t 0 in the camera. In the command file, we create a static variable (czp) and assign it to the accessor method. The camera is instantiated in the main robot file with all of the instance variables in the camera subsystem being static.Autonomous + Camera Subsystem

What does your camera setup look like? Is it just a webcam plugged into the rio or is there a coprocessor somewhere? Also are you seeing any other values from the camera?

The data type of czp needs to be AtomicDouble. That might be your only problem but in any case it’s needed to continue debugging.
edit: you can synchronize your methods as another way to access the variable.

It is a webcam plugged directly into the rio

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