StartupBehavior Class Reference#include <StartupBehavior.h>
Inheritance diagram for StartupBehavior:
[legend]List of all members.
Detailed Description
This is the default init behavior - it launches daemons, builds the Controller menu structure, does some nice things to fade the joints in to full power (reduces twitch).
This is done by assigning an instance of StartupBehavior to the global ProjectInterface::startupBehavior variable. Note that there's nothing special about the type of this class, it's just another BehaviorBase - ProjectInterface::startupBehavior could be any behavior.
If you want some other behavior to handle the root initialization, simply remove the assignment of theStartup to startupBehavior at the beginning of StartupBehavior.cc. Then you can substitute your own behavior instead. Probably a good way to distribute project code when you're all done with development and want to ship a single-purpose memory stick (assuming your users won't want to get access to things like the Controller anymore... up to you.)
If all you want to do is get your behavior to launch at startup, you don't need to replace this. Just add a menu entry. (in say, the Mode Switch menu, which is separated out into StartupBehavior_SetupModeSwitch.cc for reduced recompilation after header files are modified) If you use a BehaviorSwitchControl, you can call its BehaviorSwitchControl::start() method to start the behavior it controls as you add it to the menu. There are several examples of this usage in the Background Behaviors menu (StartupBehavior_SetupBackgroundBehaviors.cc)
This behavior is similar in idea to the init process in unix/linux.
Definition at line 41 of file StartupBehavior.h.
Constructor & Destructor Documentation
StartupBehavior::StartupBehavior |
( |
|
) |
|
|
Member Function Documentation
void StartupBehavior::addItem |
( |
ControlBase * |
control |
) |
[protected, virtual] |
|
void StartupBehavior::DoStart |
( |
|
) |
[virtual] |
|
void StartupBehavior::DoStop |
( |
|
) |
[virtual] |
|
|
By default, subtracts from the reference counter (RemoveReference()), and thus may deletex if zero; Don't forget to still call this when you override this; Warning: call this at the end of your DoStop(), not beginning (it might delete this ).
Reimplemented from BehaviorBase.
Definition at line 99 of file StartupBehavior.cc. |
ControlBase * StartupBehavior::endSubMenu |
( |
|
) |
[protected, virtual] |
|
std::string StartupBehavior::getClassDescription |
( |
|
) |
[inline, static] |
|
|
Gives a short description of what this class of behaviors does... you should override this (but don't have to).
Reimplemented from BehaviorBase.
Definition at line 53 of file StartupBehavior.h. |
virtual std::string StartupBehavior::getName |
( |
|
) |
const [inline, virtual] |
|
void StartupBehavior::initVision |
( |
|
) |
[protected, virtual] |
|
|
Sets up the vision pipelines (held in StartupBehavior_SetupVision.cc).
We set the default vision generators and source IDs here.
The vis*SID and def*Generator variables are defined in ProjectInterface. You can reassign their values as you see fit, which allows you to reorganize and adapt the vision pipeline, but still retain the ability of the included demo behaviors to access vision information.
Definition at line 32 of file StartupBehavior_SetupVision.cc.
Referenced by DoStart(). |
void StartupBehavior::processEvent |
( |
const EventBase & |
event |
) |
[virtual] |
|
|
Uses a few timer events at the beginning to fade in the PID values, and closes the mouth too
Reimplemented from BehaviorBase.
Definition at line 109 of file StartupBehavior.cc. |
ControlBase * StartupBehavior::SetupBackgroundBehaviors |
( |
|
) |
[protected, virtual] |
|
ControlBase * StartupBehavior::SetupFileAccess |
( |
|
) |
[protected, virtual] |
|
ControlBase * StartupBehavior::SetupMenus |
( |
|
) |
[protected, virtual] |
|
|
Initializes the Controller menu structure - calls each of the other Setup functions in turn.
Also adds Shutdown and Help items at the end
Definition at line 148 of file StartupBehavior.cc.
Referenced by DoStart(). |
ControlBase * StartupBehavior::SetupModeSwitch |
( |
|
) |
[protected, virtual] |
|
ControlBase * StartupBehavior::SetupStatusReports |
( |
|
) |
[protected, virtual] |
|
ControlBase * StartupBehavior::SetupTekkotsuMon |
( |
|
) |
[protected, virtual] |
|
ControlBase * StartupBehavior::SetupVision |
( |
|
) |
[protected, virtual] |
|
ControlBase * StartupBehavior::SetupWalkEdit |
( |
|
) |
[protected, virtual] |
|
void StartupBehavior::startSubMenu |
( |
|
) |
[protected, virtual] |
|
Member Data Documentation
|
Holds pointers to all the behaviors spawned from DoStart, so they can automatically be stopped on DoStop (should only happen on shutdown, but ensures cleanliness).
Definition at line 74 of file StartupBehavior.h.
Referenced by DoStart(), and DoStop(). |
The documentation for this class was generated from the following files:
|