Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
#include <MMCombo.h>
Inheritance diagram for MMCombo:
Why go to all this trouble? Virtual functions and polymorphism! Instead of writing my own object typing and serialization system, I would rather just use C++'s. But function lookups of the run time type information (RTTI) will break unless the object that created the object and the object that's actually calling the function agree on what object A's information is.
The easiest way to guarantee this is to compile them as one object, and then replace the strings in the source binary with strings for each of the final objects so they'll each have their own identity, but share the same code.
This is as close as I can get to a "fork", which is what i really want.
Definition at line 29 of file MMCombo.h.
Public Member Functions | |
MMCombo () | |
constructor | |
virtual | ~MMCombo () |
destructor | |
virtual OStatus | DoInit (const OSystemEvent &) |
first call (after constructor), set up memory | |
virtual OStatus | DoStart (const OSystemEvent &) |
second call, ask for messages | |
virtual OStatus | DoStop (const OSystemEvent &) |
next to last call, stop sending and receiving messages | |
virtual OStatus | DoDestroy (const OSystemEvent &) |
last call (before destructor), clean up memory here | |
void | ReadyRegisterWorldState (const OReadyEvent &) |
main only, send out the state global | |
void | GotWorldState (const ONotifyEvent &event) |
motion only, called when state global is received | |
void | ReadyRegisterMotionManager (const OReadyEvent &) |
motion only, send out motman global | |
void | GotMotionManager (const ONotifyEvent &event) |
main only, called when motman global is received | |
void | ReadyRegisterEventTranslatorQueue (const OReadyEvent &) |
main only, send out the EventTranslatorQueue | |
void | GotEventTranslatorQueue (const ONotifyEvent &event) |
motion only, called when EventTranslatorQueue is received | |
void | ReadySendJoints (const OReadyEvent &event) |
motion only (until main does ears again, then both) calls SendJoints, if DoStart has already been called | |
void | GotSensorFrame (const ONotifyEvent &event) |
main only, called when new sensor information is available | |
void | GotImage (const ONotifyEvent &event) |
main only, called when a new image is available | |
void | GotPowerEvent (void *msg) |
main only, called when a power event occurs (can be just status events) | |
void | GotMotionMsg (const ONotifyEvent &event) |
both, called when a new MotionManagerMsg has been received | |
void | GotSoundManager (const ONotifyEvent &event) |
both, called when the sndman global is received | |
void | ListenCont (void *msg) |
main only, called when //ALTODO | |
void | BindCont (void *msg) |
main only, called when //ALTODO | |
void | ConnectCont (void *msg) |
main only, called when //ALTODO | |
void | SendCont (void *msg) |
main only, called when //ALTODO | |
void | ReceiveCont (void *msg) |
main only, called when //ALTODO | |
void | CloseCont (void *msg) |
main only, called when //ALTODO | |
bool | RPOPENR_isReady () |
main only, called when //ALTODO | |
int | RPOPENR_send (char *buf, int bufsize) |
main only, called when //ALTODO | |
void | RPOPENR_ready (const OReadyEvent &) |
main only, called when //ALTODO | |
void | RPOPENR_notify (const ONotifyEvent &event) |
main only, called when //ALTODO | |
Public Attributes | |
OSubject * | subject [numOfSubject] |
holds information for each of our subjects (data we provide) | |
OObserver * | observer [numOfObserver] |
holds information for each of the sources we're observing | |
Protected Member Functions | |
void | OpenPrimitives () |
both, called from SetupOutputs() (mostly for motion, but main does ears), uses open to tell which to open | |
void | SetupOutputs (const bool to_open[NumOutputs]) |
both, called from DoInit() (mostly for motion, but main does ears) | |
RCRegion * | InitRegion (unsigned int size) |
both, called to set up a shared memory region of a given size | |
void | addRunLevel () |
Main, checks runLevel and creates StartBehavior when ready. | |
OLEDValue | calcLEDValue (unsigned int i, float x) |
Motion only, maintains the activation level of the LEDs, returns whether it should be 'fired'. | |
Protected Attributes | |
RCRegion * | motmanMemRgn |
Motion creates, Main receives. | |
RCRegion * | worldStateMemRgn |
Main creates, Motion receives. | |
RCRegion * | soundManagerMemRgn |
SoundPlay creates, Main & Motion receives. | |
RCRegion * | eventTranslatorQueueMemRgn |
Main creates, Motion (& SoundPlay) receive. | |
OPrimitiveID | primIDs [NumOutputs] |
both, Main ears only, Motion the rest | |
RCRegion * | region [NUM_COMMAND_VECTOR] |
both, the actual buffers | |
float | ledActivation [NumLEDs] |
Motion, used for partial LED activation. | |
unsigned int | runLevel |
Main, incremented until all sections are ready. | |
bool | open [NumOutputs] |
both, holds information regarding which outputs are open in ("controlled by") this process | |
unsigned int | num_open |
both, count of how many are open | |
EventTranslator | etrans |
both, allows events to be sent between processes (from other processes besides these two too) | |
bool | RPOPENR_isready |
true if we've received a ready message from a remote process | |
bool | isStopped |
true if we've received a DoStart and no DoStop - we need this because sometimes an extra message seems to slip in after we've been told to stop, in which case we should ignore it | |
Static Protected Attributes | |
const unsigned int | NUM_COMMAND_VECTOR = 2 |
both, for double buffering | |
const unsigned int | readyLevel = 5 |
Main, runLevel at which StartBehavior is created. (1st power event, 1st sensor event, motman init, sndman init, MainObj::DoStart()). | |
Private Member Functions | |
MMCombo (const MMCombo &) | |
should never be called... | |
MMCombo & | operator= (const MMCombo &) |
should never be called... |
|
constructor
Definition at line 26 of file MMCombo.cc. References Profiler::initBuckets(), ERS210Info::NumOutputs, open, and primIDs. |
|
destructor
|
|
should never be called...
|
|
Main, checks runLevel and creates StartBehavior when ready.
Definition at line 591 of file MMCombo.cc. References BehaviorBase::DoStart(), readyLevel, runLevel, and startupBehavior. |
|
main only, called when //ALTODO
Definition at line 60 of file MMCombo.h. References Wireless::BindCont(), and wireless. |
|
Motion only, maintains the activation level of the LEDs, returns whether it should be 'fired'.
Definition at line 102 of file MMCombo.h. References ledActivation. |
|
main only, called when //ALTODO
Definition at line 64 of file MMCombo.h. References Wireless::CloseCont(), and wireless. |
|
main only, called when //ALTODO
Definition at line 61 of file MMCombo.h. References Wireless::ConnectCont(), and wireless. |
|
last call (before destructor), clean up memory here
Definition at line 158 of file MMCombo.cc. References erouter, eventTranslatorQueueMemRgn, motmanMemRgn, ReferenceCounter::RemoveReference(), soundManagerMemRgn, startupBehavior, and worldStateMemRgn. |
|
first call (after constructor), set up memory
Definition at line 40 of file MMCombo.cc. References ReferenceCounter::AddReference(), config, erouter, etrans, eventTranslatorQueueMemRgn, MotionManager::InitAccess(), InitRegion(), ERS210Info::IsFastOutput, isStopped, ProcessID::MainProcess, MotionManager::MAX_MOTIONS, ProcessID::MotionProcess, motman, motmanMemRgn, ERS210Info::NumOutputs, observer, serr, Socket::setFlushType(), Socket::setForward(), ProcessID::setID(), MotionCommand::setQueue(), EventTranslator::setQueue(), Socket::setTextForward(), SetupOutputs(), Wireless::socket(), sout, startupBehavior, state, subject, vision, wireless, Wireless::WIRELESS_DEF_RECV_SIZE, Wireless::WIRELESS_DEF_SEND_SIZE, and worldStateMemRgn. |
|
second call, ask for messages
Definition at line 117 of file MMCombo.cc. References addRunLevel(), config, Config::main_config::console_port, erouter, isStopped, Wireless::listen(), Config::main, WorldState::read(), serr, sout, state, Config::main_config::stderr_port, and wireless. |
|
next to last call, stop sending and receiving messages
Definition at line 142 of file MMCombo.cc. References Wireless::close(), BehaviorBase::DoStop(), isStopped, serr, sout, startupBehavior, and wireless. |
|
motion only, called when EventTranslatorQueue is received
Definition at line 258 of file MMCombo.cc. References EventRouter::addTrapper(), ASSERT, erouter, etrans, eventTranslatorQueueMemRgn, observer, MotionCommand::setQueue(), and EventTranslator::setQueue(). |
|
main only, called when a new image is available
Definition at line 410 of file MMCombo.cc. References erouter, etrans, isStopped, WorldState::mainProfile, observer, Vision::processFrame(), EventRouter::processTimers(), PROFSECTION, state, EventTranslator::translateEvents(), and vision. |
|
main only, called when motman global is received
Definition at line 224 of file MMCombo.cc. References addRunLevel(), ASSERT, MotionManager::InitAccess(), motman, motmanMemRgn, observer, and subject. |
|
both, called when a new MotionManagerMsg has been received
Definition at line 472 of file MMCombo.cc. References isStopped, motman, observer, and MotionManager::receivedMsg(). |
|
main only, called when a power event occurs (can be just status events)
Definition at line 441 of file MMCombo.cc. References addRunLevel(), erouter, etrans, isStopped, WorldState::mainProfile, WorldState::powerFlags, EventRouter::processTimers(), PROFSECTION, WorldState::read(), state, and EventTranslator::translateEvents(). |
|
main only, called when new sensor information is available
Definition at line 382 of file MMCombo.cc. References addRunLevel(), erouter, etrans, isStopped, WorldState::mainProfile, observer, EventRouter::processTimers(), PROFSECTION, WorldState::read(), WorldStateSerializer::serialize(), state, EventTranslator::translateEvents(), and WorldState::wsser. |
|
both, called when the sndman global is received
Definition at line 488 of file MMCombo.cc. References addRunLevel(), ASSERT, SoundManager::InitAccess(), observer, sndman, soundManagerMemRgn, and subject. |
|
motion only, called when state global is received
Definition at line 193 of file MMCombo.cc. References ASSERT, observer, state, and worldStateMemRgn. |
|
both, called to set up a shared memory region of a given size Will round up size to the nearest page Definition at line 582 of file MMCombo.cc. References ASSERT. |
|
main only, called when //ALTODO
Definition at line 59 of file MMCombo.h. References Wireless::ListenCont(), and wireless. |
|
both, called from SetupOutputs() (mostly for motion, but main does ears), uses open to tell which to open
Definition at line 502 of file MMCombo.cc. References ERS210Info::NumOutputs, open, primIDs, and ERS210Info::PrimitiveName. |
|
should never be called...
|
|
main only, send out the EventTranslatorQueue Called when MotoObj is initially ready as well as when it has finished processing the previous message - we only want to do this the first time otherwise we infinite loop. Definition at line 245 of file MMCombo.cc. References eventTranslatorQueueMemRgn, and subject. |
|
motion only, send out motman global Called when MainObj is initially ready as well as when it has finished processing the previous message - we only want to do this the first time otherwise we infinite loop. Definition at line 211 of file MMCombo.cc. References motmanMemRgn, and subject. |
|
main only, send out the state global Called when MotoObj is initially ready as well as when it has finished processing the previous message - we only want to do this the first time otherwise we infinite loop. Definition at line 180 of file MMCombo.cc. References subject, and worldStateMemRgn. |
|
motion only (until main does ears again, then both) calls SendJoints, if DoStart has already been called
Definition at line 276 of file MMCombo.cc. References ASSERTRET, ERS210Info::BinJointOffset, calcLEDValue(), ProcessID::getID(), Profiler::getNewID(), MotionManager::getOutputs(), isStopped, ERS210Info::LEDOffset, ProcessID::MainProcess, WorldState::mainProfile, ProcessID::MotionProcess, WorldState::motionProfile, motman, NUM_COMMAND_VECTOR, num_open, ERS210Info::NumBinJoints, ERS210Info::NumFrames, ERS210Info::NumLEDs, ERS210Info::NumOutputs, ERS210Info::NumPIDJoints, ERS210Info::NumSlowFrames, open, WorldState::outputs, ERS210Info::PIDJointOffset, primIDs, region, Profiler::Timer::setID(), state, subject, MotionManager::updatePIDs(), and MotionManager::updateWorldState(). |
|
main only, called when //ALTODO
Definition at line 63 of file MMCombo.h. References Wireless::ReceiveCont(), and wireless. |
|
main only, called when //ALTODO
Definition at line 66 of file MMCombo.h. References RPOPENR_isready. |
|
main only, called when //ALTODO
Definition at line 601 of file MMCombo.cc. References erouter, observer, and EventRouter::postEvent(). |
|
main only, called when //ALTODO
Definition at line 69 of file MMCombo.h. References RPOPENR_isready. |
|
main only, called when //ALTODO
Definition at line 616 of file MMCombo.cc. References RPOPENR_isready, and subject. |
|
main only, called when //ALTODO
Definition at line 62 of file MMCombo.h. References Wireless::SendCont(), and wireless. |
|
both, called from DoInit() (mostly for motion, but main does ears)
Definition at line 513 of file MMCombo.cc. References ASSERT, ERS210Info::BinJointOffset, ERS210Info::LEDOffset, NUM_COMMAND_VECTOR, num_open, ERS210Info::NumBinJoints, ERS210Info::NumFrames, ERS210Info::NumLEDs, ERS210Info::NumOutputs, ERS210Info::NumPIDJoints, ERS210Info::NumSlowFrames, open, OpenPrimitives(), ERS210Info::PIDJointOffset, primIDs, and region. |
|
both, allows events to be sent between processes (from other processes besides these two too)
|
|
Main creates, Motion (& SoundPlay) receive.
|
|
true if we've received a DoStart and no DoStop - we need this because sometimes an extra message seems to slip in after we've been told to stop, in which case we should ignore it
|
|
Motion, used for partial LED activation.
|
|
Motion creates, Main receives.
|
|
both, for double buffering
|
|
both, count of how many are open
|
|
holds information for each of the sources we're observing
|
|
both, holds information regarding which outputs are open in ("controlled by") this process
|
|
both, Main ears only, Motion the rest
|
|
Main, runLevel at which StartBehavior is created. (1st power event, 1st sensor event, motman init, sndman init, MainObj::DoStart()).
|
|
both, the actual buffers
|
|
true if we've received a ready message from a remote process
|
|
Main, incremented until all sections are ready.
|
|
SoundPlay creates, Main & Motion receives.
|
|
holds information for each of our subjects (data we provide)
|
|
Main creates, Motion receives.
|
Tekkotsu v1.4 |
Generated Sat Jul 19 00:09:03 2003 by Doxygen 1.3.2 |