|
Re: Updating Dashboard values from robot.
A wait time of 0 in a While loop has no effect. You have loops running as fast and as often as they can, which can (and often does) starve other important tasks of CPU cycles. That includes essential communication tasks which must run in order to keep the system watchdog from shutting all outputs off.
For code that reads joystick values, there's usually no reason to run loops any more quickly than every 20 milliseconds. That's how often the data is sent from the Driver Station.
But your program has a couple of structural problems that will cause things to get weird.
First, you absolutely should not have that While loop in your Teleop vi. Teleop itself gets called repeatedly, and needs to do its job and be done well before the next data packet arrives from the Driver Station. Remove the loop (and its associated wait).
Second, you really ought not to be messing with the Robot Main vi at all. There's no difference between adding a vi to its Teleop case and just putting that vi in Teleop itself.
Third, the Latch Launcher vi is a big While loop that never ends. That will stall Robot Main when it gets invoked, and everything will come to a halt. Take it out of Robot Main and put it in the Periodic Tasks vi, which is where such loops belong.
Finally, the Latch Launcher loop is also unthrottled. Since it's responding to joystick buttons, change its 0 ms wait to a 20 ms wait.
|