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()?

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:

void Robot::Disabled()
{
	printf("Robot Disabled!!
");
}

If it loops on its own, wouldn’t that print “Robot Disabled!!” over and over?

Disabledinit would print once.
Disabledperiodic would print over and over again.

I use SampleRobot.

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:

Robot::Disabled()
{
  while(!IsEnabled()) //or while(IsEnabled() == false)
  {
     printf("Disabled!
");
  }
}

Regardless, I would only do this at home and not at competitions.

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.

Any reason for this? This should work perfectly fine at competition.

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.

For before the match not after. The code will definitely run Disabled() while Disabled before the match.

Ah I see. It’s probably fine to do before a match.

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.)

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.

I wasn’t on the drive team the year it happened, but I think there was an issue with our loop statements for teleop/auto. Basically autonomous mode worked and then teleop never began for our robot.

That happened for two matches and we worked the magic of deploying different, but still final, code and it started working.

I think the FMS does its best to force your robot to change modes, but sometimes it can’t if you did something bad enough?

I honestly don’t know xD

Please, don’t spread FUD if you don’t know something. If you use the Sample Template and you don’t properly exit your loop in any mode your code can be stuck in that mode. However, this is not field specific behavior, you will see the same thing in your shop if you have this problem. Especially if you use the practice match feature of the DS.