I’m having difficulty with having my sensors read to my front panel. I know that the sensors function because they work in the front panel of the example VIs for digital inputs. I’ve managed to find an error message that tells me that the refnum I’m calling for my “get” statement does not exist. I had thought that I had created the refnum because I followed these instructions:
In the Project Explorer window of the FRC robot project, within the
Team Code folder under the RT CompactRIO Target, double-click
the Begin.vi item to open the Begin VI.
Select Window»Show Block Diagram or press the <Ctrl-E> keys to
view the block diagram.
Notice that references have already been set for Camera, Watchdog,
Left and Right Motors, and Joystick 1.
Add a Gyro Open VI to the block diagram below the Joystick 1 reference.
Right-click the Analog Input terminal of the Gyro Open VI and select
Create»Constant from the shortcut menu.
Add a Gyro RefNum Registry Set VI to the block diagram to the right
of the Gyro Open VI.
Right-click the refnum name input of the Gyro RefNum Registry Set
VI and select Create»Constant from the shortcut menu.
Type the name you want to assign to this reference, such as Gyro 1.
Wire the GyroDevRef output of the Gyro Open VI to the GyroDevRef
input of Gyro RefNum Registry Set VI.
Wire the error out output of the Gyro Open VI to the error in input
of the Gyro RefNum Registry Set VI.
Is there some other step or setting for creating a refnum?
Because the image in the post is clipped, I can’t see what the switch statement has wired to it, but the sensor read and the indicator update are conditional. Is it possible that the code in that case of the switch isn’t running because of the logic wired to it?
The case statement is definitely active. Other things in the case statement function correctly. I know that the error stems from a bad refnum because I created an indicator on the refnum call function and it told me that the refnum I was calling does not exist. I even went as far as to create a constant on the case structure for the case in which I have the sensor code because I was running low on new ideas.
Because the RefNum Get is outside the case structure, it seems it should be getting called - and the error makes me think it is. One thing to try might be to actually make a copy of the “Sensor” text constant wired to the RefNum Set, and wire that into the RefNum Get. This would be just to make sure the names are identical and there isn’t some hidden or nonprintable text.
It would be really helpful if the error message included the name of the refnum it couldn’t get. I can imagine helping a team at a regional having this problem where the main indication is an error on the diagnostics tab, and not really knowing where to start looking, especially if there are a lot of refnums.
This is your problem. The program you run is Robot Main and it calls all the other sub VI’s as they are needed or to run them.
Also your indicator is going to appear in the teleop front pannel not the driver station or robot main front pannels. You can have these front pannels open when the program is running though without any problems