To speed up our shooter aiming, we are incorporating an encoder on the tilt axle to automatically find the angle of the mechanism (and through logic adjust the shooter up or down as necessary). We have successfully found the output, and “transformed” it mathematically into an angular reading, but we can’t access the value in our teleop program (where we need it) only in the periodic tasks program. Help!
What’s keeping you from reading the encoder output in Teleop?
I’m not the programmer - but I think if they knew that, they would have solved it. We have the encoder (AS 5030) plugged in to the first input of the analog breakout…we can read it on the dashboard, and access it in periodic tasks, but not teleop (and I assume not in autonomous, where we will also need it).
I suspect that the periodic is not only reading the encoder, but controlling the elevation. One approach is to share the calculated value, via a global variable. The RobotGlobal is a reasonable place to put a named numeric for this purpose.
An alternative is to call a shared subVI that reads the encoder refnum by name, reads the raw value, and calculates the angle. The subVI would be shared by Periodic, auto, tele, or wherever.
Greg McKaskle
Thanks - Programmers are experimenting and believe this (global variable) is the answer. You’re a life saver!!!