This is the code I’m writing for the raspberry pi co-processor. Is the while loop on line 68 an effective choice? Or do I need to make a lambda expression for centerX?
You should set the entry directly from the visionThread
body (after calculating it), and then do a NetworkTableInstance.getDefault().flush()
call to immediately send that data to the Rio.
The while loop should just have a long sleep() call in it so it doesn’t consume CPU time.
2 Likes
So just to clarify, I have all the code that sets the network table value inside of the visionthread body, and I dont need a while loop? Or should the while loop just have a sleep command that loops forever?
The latter. You need a while loop or the program will exit, but you should have it just sleep effectively forever, like this:
Awesome, thanks!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.