Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Network Tables (http://www.chiefdelphi.com/forums/showthread.php?t=128328)

JamesTerm 03-04-2014 10:24

Re: Network Tables
 
Quote:

Originally Posted by apalrd (Post 1368582)
We run everything in a single task (including a UDP listener and RS232 listener). We just don't stop the task when auton or teleop is disabled. We clear the integrators and reset to a safe state when the disabled signal goes from low to high, and run everything in a single 10ms high priority task. The UDP listener reads in a While loop with a 0ms timeout and breaks when the read returns a timeout. The RS232 listener does similar.


Wow! you can do that in labview? Or did you make the switch to c++?

This Main.cpp is how we setup. There is only one member variable that is always instantiated between autonomous and teleop. Back when I started in 2011 I instantiated everything in auton and redid this in teleop... that wrecked havoc on teleop where we lost controls (our first match ever... went down like that). I found that for best results keep everything ready to go in between modes. When looking at this code, you can see how the loops happen within the Autonomous() and OperatorControl() callbacks. I can see now from your response that I could have one loop... and these callbacks simply signal what just happened... that is a cool idea. :)

apalrd 03-04-2014 13:54

Re: Network Tables
 
Quote:

Originally Posted by JamesTerm (Post 1368789)
Wow! you can do that in labview? Or did you make the switch to c++?

This Main.cpp is how we setup. There is only one member variable that is always instantiated between autonomous and teleop. Back when I started in 2011 I instantiated everything in auton and redid this in teleop... that wrecked havoc on teleop where we lost controls (our first match ever... went down like that). I found that for best results keep everything ready to go in between modes. When looking at this code, you can see how the loops happen within the Autonomous() and OperatorControl() callbacks. I can see now from your response that I could have one loop... and these callbacks simply signal what just happened... that is a cool idea. :)

I have an RT timed loop in Robot Main

Within the Robot Status VI (the one that returns an enum teleop enabled/auton enabled/teleop disabled...) is a read to a bit register which has an auton bit, enabled bit, and test bit. I read this directly and do a bit of boolean logic to output an 'auton enabled' and 'reinit' flag. Whenever we are not auton enabled we run the driver control code, when whenever the enabled bit goes from low to high we reinit. Reinit resets the state machines to their initial (safe) states, and clears the integrators of all of the control loops.

We no longer use any of the FRC provided framework, or the majority of the libraries, and the code has gotten a lot simpler and cleaner since we did that.


All times are GMT -5. The time now is 22:01.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi