View Single Post
  #6   Spotlight this post!  
Unread 16-02-2005, 12:54
gnormhurst's Avatar
gnormhurst gnormhurst is offline
Norm Hurst
AKA: gnorm
#0381 (The Tornadoes)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Trenton, NJ
Posts: 138
gnormhurst will become famous soon enoughgnormhurst will become famous soon enough
Re: Use of Functions in Autonomous

I am losing sleep over this issue, too.

There are two flags #defined in ifi_aliases.h:
disabled_mode
autonomous_mode

The state of these is contolled by the match computer. "Disabled", I believe, means that the outputs are all set to neutral (motors stop, relays are off, etc). It does not mean that your program stops running. Your program continues to execute.

An example of how this could be really bad is if you are using error integration in a PID loop. If the outputs are disabled, your program will continue to integrate error while being unable to control anything (the feedback loop is open). When the disabled_mode goes false and the outputs are re-enabled, there will be a huge error signal that may cause very strange behavior.

This is especially an issue since disabled_mode becomes true multiple times during a match: when the human player steps off the switch pad. The robot stops, but the program continues, possibly integrating PID errors!

Another concern is about state machines getting left in a state != START. If the autonomous code stops being called while a state machine is doing something, that machine will be in the middle of its sequence when it is called again e.g. from non-autonomous mode. I wish I had a way to reset all state machines to their initial state.

It is also not clear how the match computer will sequnce autonomous_mode and disabled_mode. disabled_mode is true before autonomous starts, but the state of autonomous_mode at that time is not clear. Likewise, at the end of autonomous I'm pretty sure that disabled_mode will be set to true, but when does autonomous become false?

I think the rule has to be: the state of autonomous_mode should only be trusted when disabled_mode is false. And if PID loops use integration, they should only be updated when the robot is enabled:
Code:
if ( !disabled_mode )
{
  pid( LEFT) ;
  pid( RIGHT );
}
Comments please...?
__________________
Trenton Tornadoes 381
2004 Philadelphia Regional Winners
2006 Xerox Creativity Award
---
My corner of the USPTO.
My favorite error message from gcc: main is usually a function
My favorite error message from Windows: There is not enough disk space available to delete this file.