|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Running networking code while robot is disabled
I'd like to run some NetworkTables code while the robot is disabled. No running motors or anything(and I'm pretty sure the FPGA will stop me from doing that), just code that updates variables even when the robot is stopped. Is this legal? Can I just run a loop inside Disabled()?
|
|
#2
|
||||
|
||||
|
Re: Running networking code while robot is disabled
Don't put a loop in Disabled() because when the robot is disabled that function loops on its own.
Having code run in Disabled(), such as variable updates and prints, is fine. However, putting code that could potentially move or control the robot would defeat the purpose of having a Disabled() function. This is usually what my Disabled() function looks like: Code:
void Robot::Disabled()
{
printf("Robot Disabled!!\n");
}
|
|
#3
|
|||
|
|||
|
Re: Running networking code while robot is disabled
Quote:
|
|
#4
|
|||
|
|||
|
Re: Running networking code while robot is disabled
Disabledinit would print once.
Disabledperiodic would print over and over again. |
|
#5
|
|||
|
|||
|
Re: Running networking code while robot is disabled
I use SampleRobot.
|
|
#6
|
||||
|
||||
|
Re: Running networking code while robot is disabled
Sorry, I should have been specific. The periodic one loops. In SampleRobot it does not.
If you want to loop in Disabled() you could try: Code:
Robot::Disabled()
{
while(!IsEnabled()) //or while(IsEnabled() == false)
{
printf("Disabled!\n");
}
}
Edit: When I said that it loops earlier I was thinking of when print statements from OperatorControl continue printing if you're missing the "IsOperatorControl()" function in your while condition. Last edited by MaikeruKonare : 02-08-2016 at 08:12 PM. |
|
#7
|
|||
|
|||
|
Re: Running networking code while robot is disabled
Any reason for this? This should work perfectly fine at competition.
|
|
#8
|
||||
|
||||
|
Re: Running networking code while robot is disabled
No reason in particular. I just wouldn't want to mess with it, I'm not familiar with how the field management system handles the disabled modes.
It would probably be fine, but is there a reason to do it? Once the robot disables at the end of a match it's not like it's going to be powered on much longer. |
|
#9
|
|||
|
|||
|
Re: Running networking code while robot is disabled
For before the match not after. The code will definitely run Disabled() while Disabled before the match.
|
|
#10
|
||||
|
||||
|
Re: Running networking code while robot is disabled
Quote:
I would just be terrified because if there was an error with the disabled loop you could brick the match! (Paranoia, after having bricked matches in the past.) |
|
#11
|
|||
|
|||
|
Re: Running networking code while robot is disabled
Story? I'd like to hear more about this since I'm very interested in the inner workings of the FMS, and how you bricked it.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|