Homepage Demos Overview Downloads Tutorials Reference
Credits

MotionManager Class Reference

#include <MotionManager.h>

List of all members.


Detailed Description

The purpose of this class is to provide mutually exclusive access to the MotionCommands and simplify their sharing between memory spaces.

Since MotionObject and MainObject run as separate processes, they could potentially try to access the same motion command at the same time, leading to unpredictable behavior. The MotionManager enforces a set of locks to solve this.

The other problem is that we are sharing between processes. MotionManager will do what's necessary to distribute new MotionCommand's to all the processes (currently just MainObj and MotoObj)
You should be able to create and add a new motion in one line:

  motman->addMotion( SharedObject<YourMC>([arg1,...]) , autoprune [, priority ]);

But if you want to do some more initializations not handled by the constructor (the arg1, arg2, ... params) then you would want to do something like the following:

  SharedObject<YourMC> tmpvar([arg1,[arg2,...]]);
  tmpvar->cmd1();
  tmpvar->cmd2();
  //...
  motman->addPrunableMotion(tmpvar [, ...]); //or addPersistentMotion(...)

Notice that tmpvar is of type SharedObject, but you're calling YourMC functions on it... SharedObject is a "smart pointer" which will pass your function calls on to the underlying templated type. Isn't C++ great? :)

Warning:
Once the MotionCommand has been added you must check it out to modify it or risk concurrent access problems.
See also:
MotionCommand for information on creating new motion primitives.

MMAccessor for information on accessing motions after you've added them to MotionManager.

Definition at line 66 of file MotionManager.h.

Public Types

typedef MotionManagerMsg::MC_ID MC_ID
 use this type when referring to the ID numbers that MotionManager hands out

Public Member Functions

 MotionManager ()
 Constructor, sets all the outputs to 0.
void InitAccess (OSubject *subj)
 LOCKS MotionManager Everyone who is planning to use the MotionManager needs to call this before they access it or suffer a horrible fate
void receivedMsg (const ONotifyEvent &event)
 LOCKS MotionManager This gets called by an OObject when it receives a message from one of the other OObject's MotionManagerComm Subject
MotionCommand Safe
void setOutput (const MotionCommand *caller, unsigned int output, const OutputCmd &cmd)
 LOCKS MotionManager Requests a value be set for the specified output, copies cmd across frames
void setOutput (const MotionCommand *caller, unsigned int output, const OutputCmd &cmd, unsigned int frame)
 LOCKS MotionManager Requests a value be set for the specified output in the specified frame
void setOutput (const MotionCommand *caller, unsigned int output, const OutputCmd cmd[NumFrames])
 LOCKS MotionManager Requests a value be set for the specified output across frames
void setOutput (const MotionCommand *caller, unsigned int output, const OutputPID &pid)
 LOCKS MotionManager Requests a PID be set for the specified output, notice that this might be overruled by a higher priority motion
void setOutput (const MotionCommand *caller, unsigned int output, const OutputCmd &cmd, const OutputPID &pid)
 LOCKS MotionManager Requests a value and PID be set for the specified output
void setOutput (const MotionCommand *caller, unsigned int output, const OutputCmd cmd[NumFrames], const OutputPID &pid)
 LOCKS MotionManager Requests a value and PID be set for the specified output
const OutputCmdgetOutputCmd (unsigned int output) const
 Returns the value of the output last sent to the OS. Note that this will differ from the sensed value in state, even when staying still. There is no corresponding getOutputPID because this value *will* duplicate the value in state.
void setPriority (MC_ID mcid, float p)
 sets the priority level of a MotionCommand
float getPriority (MC_ID mcid) const
 returns priority level of a MotionCommand
MC_ID begin () const
 returns the MC_ID of the first MotionCommand
MC_ID next (MC_ID cur) const
 returns the MC_ID of MotionCommand following the one that is passed
MC_ID end () const
 returns the MC_ID of the one-past-the-end MotionCommand (like the STL)
unsigned int size () const
 returns the number of MotionCommands being managed
MotionCommand "Risky"
You can have one MC check out and modify another, but make sure the other MC doesn't call setOutput()

MotionCommandcheckoutMotion (MC_ID mcid, bool block=true)
 locks the command and possibly performs RTTI conversion; supports recursive calls
void checkinMotion (MC_ID mcid)
 marks a MotionCommand as unused
MotionCommandpeekMotion (MC_ID mcid)
 allows access to a MotionCommand without checking it out; warning never call a function based on this, only access member fields through it
unsigned int checkoutLevel (MC_ID mcid)
 returns the number of times mcid has been checked out minus the times it's been checked in
bool isOwner (MC_ID mcid)
 locks the command and possibly performs RTTI conversion; supports recursive calls
MotionCommand Unsafe
MC_ID addPrunableMotion (const SharedObjectBase &sm, float priority=kStdPriority)
 LOCKS MotionManager adds a new motion (wrapped in a SharedObject) and marks that it should be automatically deleted when the MotionCommand::isAlive() returns false.
MC_ID addPersistentMotion (const SharedObjectBase &sm, float priority=kStdPriority)
 LOCKS MotionManager adds a new motion (wrapped in a SharedObject) and marks that it should not be deleted, until removeMotion(MC_ID mcid) is called.
void removeMotion (MC_ID mcid)
 LOCKS MotionManager removes the specified MotionCommand
Deprecated
MC_ID addMotion (const SharedObjectBase &sm) __attribute__((deprecated))
 deprecated, we're recommending users call either addPrunableMotion() or addPersistentMotion() so there are no surprises
MC_ID addMotion (const SharedObjectBase &sm, bool autoprune) __attribute__((deprecated))
 deprecated, we're recommending users call either addPrunableMotion() or addPersistentMotion() so there are no surprises
MC_ID addMotion (const SharedObjectBase &sm, float priority) __attribute__((deprecated))
 deprecated, we're recommending users call either addPrunableMotion() or addPersistentMotion() so there are no surprises
MC_ID addMotion (const SharedObjectBase &sm, float priority, bool autoprune) __attribute__((deprecated))
 deprecated, we're recommending users call either addPrunableMotion() or addPersistentMotion() so there are no surprises
void lock ()
 gets an exclusive lock on MotionManager - functions marked LOCKS MotionManager will cause (and require) this to happen automatically
bool trylock ()
 tries to get a lock without blocking
void release ()
 releases a lock on the motion manager
void getOutputs (float outputs[NumFrames][NumOutputs])
 LOCKS MotionManager called by MotionObject to fill in the output values for the next NumFrames frames (only MotoObj should call this...)
void updateWorldState ()
 call this when you want MotionManager to set the WorldState to reflect what things should be for unsensed outputs (LEDs, ears) (only MotoObj should be calling this...)
bool updatePIDs (OPrimitiveID primIDs[NumOutputs])
 call this when you want MotionManager to update modified PID values, returns true if changes made (only MotoObj should be calling this...), see PIDMC for general PID documentation

Static Public Attributes

const unsigned int MAX_ACCESS = 2
 This is the number of processes which will be accessing the MotionManager.
const unsigned int MAX_MOTIONS = 64
 This is the maximum number of Motions which can be managed, can probably be increased reasonably without trouble.
const MC_ID invalid_MC_ID = MotionManagerMsg::invalid_MC_ID
 for errors and undefined stuff
Priority Level Constants
Just to give you some guidelines for what values to use for different priority levels, but you can pick any value you like (that's why they are floats)

const float kIgnoredPriority = -1
 won't be expressed, handy if you want to temporarily pause something
const float kBackgroundPriority = 0
 will only be expressed if *nothing* else is using that joint
const float kLowPriority = 5
 for stuff that's not background but lower than standard
const float kStdPriority = 10
 for every-day commands
const float kHighPriority = 50
 for stuff that should override standard stuff
const float kEmergencyPriority = 100
 for really important stuff, such as the emergency stop

Protected Types

typedef unsigned short accID_t
 type to use to refer to accessors of MotionManager (or its locks)
typedef ListMemBuf< OutputState,
MAX_MOTIONS
cmdstatelist_t
 shorthand for a list of OutputState's

Protected Member Functions

MC_ID doAddMotion (const SharedObjectBase &sm, bool autoprune, float priority)
 does the actual work of adding a motion
void setPID (unsigned int j, const float p[3])
 LOCKS MotionManager, called internally to do the work of setting the PID... you probably want to call setOutput with an OutputPID argument, not this...
void func_begin ()
 called at the begining of many functions to lock MotionManager
void func_end ()
 called at the end of a function which called func_begin() to release it
template<class T>
func_end (T val)
 same as func_end(), except passes return value through
MC_ID skip_ahead (MC_ID mcid) const
 during iteration, skips over motioncommands which are still in transit from on OObject to another
MC_ID pop_free ()
 pulls an entry from cmdlist's free section and returns its index
void push_free (MC_ID a)
 puts an entry back into cmdlist's free section

Protected Attributes

ListMemBuf< PIDUpdate, NumPIDJointspidchanges
 stores PID updates, up to one per joint (if same is set more than once, it's just overwrites previous update)
ListMemBuf< CommandEntry,
MAX_MOTIONS, MC_ID
cmdlist
 the list where MotionCommands are stored, remember, we're in a shared memory region with different base addresses - no pointers!
MC_ID cur_cmd
 MC_ID of the MotionCommand currently being updated by getOutputs(), or NULL if not in getOutputs. This is used by the setOutput()'s to tell which MotionCommand is calling.
MutexLock< MAX_ACCESSMMlock
 The main lock for the class.
cmdstatelist_t cmdstates [NumOutputs]
 requested positions by each of the MC's for each of the outputs
float cmdSums [NumOutputs]
 Holds the final values for the outputs of the last frame generated.
OutputCmd cmds [NumOutputs]
 Holds the weighted values and total weight for the outputs of the last frame.
accID_t numAcc
 The number of accessors who have registered with InitAccess().
OSubject * subjs [MAX_ACCESS]
 The OSubject for each process (accessor) on which it should be broadcast when a command is added.

Static Protected Attributes

int _MMaccID = -1U
 Stores the accessor for the current process.

Private Member Functions

 MotionManager (const MotionManager &)
 this shouldn't be called...
MotionManageroperator= (const MotionManager &)
 this shouldn't be called...


Member Typedef Documentation

typedef unsigned short MotionManager::accID_t [protected]
 

type to use to refer to accessors of MotionManager (or its locks)

Definition at line 198 of file MotionManager.h.

Referenced by checkoutMotion().

typedef ListMemBuf<OutputState,MAX_MOTIONS> MotionManager::cmdstatelist_t [protected]
 

shorthand for a list of OutputState's

Definition at line 237 of file MotionManager.h.

Referenced by getOutputs(), and setOutput().

typedef MotionManagerMsg::MC_ID MotionManager::MC_ID
 

use this type when referring to the ID numbers that MotionManager hands out

Definition at line 76 of file MotionManager.h.

Referenced by WaypointWalkControl::activate(), WalkCalibration::activate(), ValueSetControl< T >::activate(), ValueEditControl< T >::activate(), ToggleControl::activate(), ShutdownControl::activate(), RebootControl::activate(), ProfilerCheckControl::activate(), PostureEditor::activate(), NullControl::activate(), HelpControl::activate(), FileBrowserControl::activate(), ControlBase::activate(), BehaviorSwitchControlBase::activate(), BehaviorSwitchActivatorControl::activate(), BehaviorReportControl::activate(), BehaviorActivatorControl::activate(), BatteryCheckControl::activate(), MotionStressTestBehavior::addMS(), checkinMotion(), checkoutMotion(), doAddMotion(), MotionStressTestBehavior::DoStart(), MCRepeater::DoStart(), EStopControllerBehavior::EStopControllerBehavior(), ControlBase::getDisplay(), TailWagNode::getMC_ID(), LedNode::getMC_ID(), HeadPointerNode::getMC_ID(), PlayMotionSequenceNode< SIZE >::getMSid(), getOutputs(), WalkNode::getWalkID(), WalkControllerBehavior::getWalkID(), LoadPostureControl::LoadPostureControl(), LoadWalkControl::LoadWalkControl(), MCValueEditControl< T >::MCValueEditControl(), MMAccessor< MC_t >::MMAccessor(), MotionManager::OutputState::OutputState(), PostureEditor::PostureEditor(), MCRepeater::processEvent(), AutoGetupBehavior::processEvent(), receivedMsg(), removeMotion(), RunSequenceControl< SequenceSize >::RunSequenceControl(), SaveWalkControl::SaveWalkControl(), LoadWalkControl::selectedFile(), LoadPostureControl::selectedFile(), ControlBase::setDisplay(), Controller::setEStopID(), WalkNode::setWalkID(), skip_ahead(), SaveWalkControl::takeInput(), and WaypointWalkControl::WaypointEditControl::WaypointEditControl().


Constructor & Destructor Documentation

MotionManager::MotionManager  ) 
 

Constructor, sets all the outputs to 0.

Definition at line 27 of file MotionManager.cc.

MotionManager::MotionManager const MotionManager  )  [private]
 

this shouldn't be called...


Member Function Documentation

MotionManager::MC_ID MotionManager::addMotion const SharedObjectBase sm,
float  priority,
bool  autoprune
 

deprecated, we're recommending users call either addPrunableMotion() or addPersistentMotion() so there are no surprises

Deprecated:
, we're recommending users call either addPrunableMotion() or addPersistentMotion() so there are no surprises

Definition at line 513 of file MotionManager.cc.

MotionManager::MC_ID MotionManager::addMotion const SharedObjectBase sm,
float  priority
 

deprecated, we're recommending users call either addPrunableMotion() or addPersistentMotion() so there are no surprises

Deprecated:
, we're recommending users call either addPrunableMotion() or addPersistentMotion() so there are no surprises

Definition at line 508 of file MotionManager.cc.

MotionManager::MC_ID MotionManager::addMotion const SharedObjectBase sm,
bool  autoprune
 

deprecated, we're recommending users call either addPrunableMotion() or addPersistentMotion() so there are no surprises

Deprecated:
, we're recommending users call either addPrunableMotion() or addPersistentMotion() so there are no surprises

Definition at line 503 of file MotionManager.cc.

MotionManager::MC_ID MotionManager::addMotion const SharedObjectBase sm  ) 
 

deprecated, we're recommending users call either addPrunableMotion() or addPersistentMotion() so there are no surprises

Deprecated:
, we're recommending users call either addPrunableMotion() or addPersistentMotion() so there are no surprises

Definition at line 498 of file MotionManager.cc.

MC_ID MotionManager::addPersistentMotion const SharedObjectBase sm,
float  priority = kStdPriority
[inline]
 

LOCKS MotionManager adds a new motion (wrapped in a SharedObject) and marks that it should not be deleted, until removeMotion(MC_ID mcid) is called.

Definition at line 130 of file MotionManager.h.

Referenced by WaypointWalkControl::activate(), PostureEditor::activate(), WalkToTargetMachine::DoStart(), WalkControllerBehavior::DoStart(), ToggleHeadLightBehavior::DoStart(), TailWagNode::DoStart(), StareAtPawBehavior2::DoStart(), StareAtPawBehavior::DoStart(), StareAtBallBehavior::DoStart(), SimpleChaseBallBehavior::DoStart(), RelaxBehavior::DoStart(), LookForSoundBehavior::DoStart(), LedNode::DoStart(), KinematicSampleBehavior2::DoStart(), KinematicSampleBehavior::DoStart(), HeadPointerNode::DoStart(), HeadPointControllerBehavior::DoStart(), HeadLevelBehavior::DoStart(), FollowHeadBehavior::DoStart(), DriveMeBehavior::DoStart(), Controller::DoStart(), ChaseBallBehavior::DoStart(), CameraBehavior::DoStart(), AlanBehavior::DoStart(), Aibo3DControllerBehavior::DoStart(), BanditMachine::PressNode::PressNode(), HeadLevelBehavior::processEvent(), RunSequenceControl< SequenceSize >::selectedFile(), ExploreMachine::setup(), BatteryMonitorBehavior::startWarning(), WalkNode::updateWalk(), and BanditMachine::WaitNode::WaitNode().

MC_ID MotionManager::addPrunableMotion const SharedObjectBase sm,
float  priority = kStdPriority
[inline]
 

LOCKS MotionManager adds a new motion (wrapped in a SharedObject) and marks that it should be automatically deleted when the MotionCommand::isAlive() returns false.

Definition at line 128 of file MotionManager.h.

Referenced by MotionStressTestBehavior::addMS(), WallTestBehavior::DoStart(), MotionStressTestBehavior::DoStart(), MCRepeater::DoStart(), BanditMachine::DoStart(), RelaxBehavior::DoStop(), StareAtPawBehavior2::processEvent(), StareAtPawBehavior::processEvent(), MCRepeater::processEvent(), KinematicSampleBehavior2::processEvent(), KinematicSampleBehavior::processEvent(), GroundPlaneBehavior::processEvent(), FollowHeadBehavior::processEvent(), AutoGetupBehavior::processEvent(), RunSequenceControl< SequenceSize >::runFile(), LoadPostureControl::selectedFile(), and PlayMotionSequenceNode< SIZE >::updateMS().

MC_ID MotionManager::begin  )  const [inline]
 

returns the MC_ID of the first MotionCommand

Definition at line 109 of file MotionManager.h.

Referenced by getOutputs().

void MotionManager::checkinMotion MC_ID  mcid  ) 
 

marks a MotionCommand as unused

Definition at line 629 of file MotionManager.cc.

Referenced by MMAccessor< MC_t >::checkin(), MCValueEditControl< T >::doSelect(), getOutputs(), WalkToTargetMachine::processEvent(), StareAtBallBehavior::processEvent(), DriveMeBehavior::processEvent(), ChaseBallBehavior::processEvent(), removeMotion(), LoadWalkControl::selectedFile(), SaveWalkControl::takeInput(), and Aibo3DControllerBehavior::updateRC().

unsigned int MotionManager::checkoutLevel MC_ID  mcid  )  [inline]
 

returns the number of times mcid has been checked out minus the times it's been checked in

Definition at line 120 of file MotionManager.h.

MotionCommand * MotionManager::checkoutMotion MC_ID  mcid,
bool  block = true
 

locks the command and possibly performs RTTI conversion; supports recursive calls

Definition at line 598 of file MotionManager.cc.

Referenced by MMAccessor< MC_t >::checkout(), MCValueEditControl< T >::doSelect(), getOutputs(), WalkToTargetMachine::processEvent(), StareAtBallBehavior::processEvent(), DriveMeBehavior::processEvent(), ChaseBallBehavior::processEvent(), removeMotion(), LoadWalkControl::selectedFile(), SaveWalkControl::takeInput(), and Aibo3DControllerBehavior::updateRC().

MotionManager::MC_ID MotionManager::doAddMotion const SharedObjectBase sm,
bool  autoprune,
float  priority
[protected]
 

does the actual work of adding a motion

We have made this function protected because it's more readable if you call addPrunableMotion() or addPersistentMotion() instead... we decided requiring people to pass a true/false arguement wouldn't make it clear what that true/false was controlling.

Definition at line 521 of file MotionManager.cc.

Referenced by addMotion().

MC_ID MotionManager::end  )  const [inline]
 

returns the MC_ID of the one-past-the-end MotionCommand (like the STL)

Definition at line 111 of file MotionManager.h.

Referenced by getOutputs().

void MotionManager::func_begin  )  [inline, protected]
 

called at the begining of many functions to lock MotionManager

Definition at line 200 of file MotionManager.h.

Referenced by doAddMotion(), getOutputs(), receivedMsg(), removeMotion(), setOutput(), and setPID().

template<class T>
T MotionManager::func_end val  )  [inline, protected]
 

same as func_end(), except passes return value through

Definition at line 202 of file MotionManager.h.

void MotionManager::func_end  )  [inline, protected]
 

called at the end of a function which called func_begin() to release it

Definition at line 201 of file MotionManager.h.

Referenced by doAddMotion(), getOutputs(), receivedMsg(), removeMotion(), setOutput(), and setPID().

const OutputCmd& MotionManager::getOutputCmd unsigned int  output  )  const [inline]
 

Returns the value of the output last sent to the OS. Note that this will differ from the sensed value in state, even when staying still. There is no corresponding getOutputPID because this value *will* duplicate the value in state.

Definition at line 103 of file MotionManager.h.

void MotionManager::getOutputs float  outputs[NumFrames][NumOutputs]  ) 
 

LOCKS MotionManager called by MotionObject to fill in the output values for the next NumFrames frames (only MotoObj should call this...)

What's worse? A plethora of functions which are only called, and only useful at one place, or a big massive function which doesn't pollute the namespace? This is the latter, for better or worse.

Definition at line 214 of file MotionManager.cc.

Referenced by MMCombo::ReadySendJoints().

float MotionManager::getPriority MC_ID  mcid  )  const [inline]
 

returns priority level of a MotionCommand

Definition at line 105 of file MotionManager.h.

Referenced by setOutput().

void MotionManager::InitAccess OSubject *  subj  ) 
 

LOCKS MotionManager Everyone who is planning to use the MotionManager needs to call this before they access it or suffer a horrible fate

Definition at line 40 of file MotionManager.cc.

Referenced by MMCombo::DoInit(), and MMCombo::GotMotionManager().

bool MotionManager::isOwner MC_ID  mcid  )  [inline]
 

locks the command and possibly performs RTTI conversion; supports recursive calls

Definition at line 121 of file MotionManager.h.

Referenced by MMAccessor< MC_t >::operator=().

void MotionManager::lock  )  [inline]
 

gets an exclusive lock on MotionManager - functions marked LOCKS MotionManager will cause (and require) this to happen automatically

Definition at line 145 of file MotionManager.h.

MC_ID MotionManager::next MC_ID  cur  )  const [inline]
 

returns the MC_ID of MotionCommand following the one that is passed

Definition at line 110 of file MotionManager.h.

Referenced by DynamicMotionSequence::clear(), getOutputs(), and DynamicMotionSequence::setRange().

MotionManager& MotionManager::operator= const MotionManager  )  [private]
 

this shouldn't be called...

MotionCommand* MotionManager::peekMotion MC_ID  mcid  )  [inline]
 

allows access to a MotionCommand without checking it out; warning never call a function based on this, only access member fields through it

Definition at line 119 of file MotionManager.h.

Referenced by MMAccessor< MC_t >::MMAccessor(), Controller::setEStopID(), and BatteryMonitorBehavior::startWarning().

MC_ID MotionManager::pop_free  )  [inline, protected]
 

pulls an entry from cmdlist's free section and returns its index

Definition at line 232 of file MotionManager.h.

Referenced by doAddMotion().

void MotionManager::push_free MC_ID  a  )  [inline, protected]
 

puts an entry back into cmdlist's free section

Definition at line 233 of file MotionManager.h.

Referenced by removeMotion().

void MotionManager::receivedMsg const ONotifyEvent &  event  ) 
 

LOCKS MotionManager This gets called by an OObject when it receives a message from one of the other OObject's MotionManagerComm Subject

Definition at line 562 of file MotionManager.cc.

Referenced by MMCombo::GotMotionMsg().

void MotionManager::release  )  [inline]
 

releases a lock on the motion manager

Definition at line 147 of file MotionManager.h.

void MotionManager::removeMotion MC_ID  mcid  ) 
 

LOCKS MotionManager removes the specified MotionCommand

Definition at line 635 of file MotionManager.cc.

Referenced by WaypointWalkControl::deactivate(), PostureEditor::deactivate(), WalkToTargetMachine::DoStop(), WalkControllerBehavior::DoStop(), ToggleHeadLightBehavior::DoStop(), TailWagNode::DoStop(), StareAtPawBehavior2::DoStop(), StareAtPawBehavior::DoStop(), StareAtBallBehavior::DoStop(), SimpleChaseBallBehavior::DoStop(), RelaxBehavior::DoStop(), PlayMotionSequenceNode< SIZE >::DoStop(), MotionStressTestBehavior::DoStop(), LookForSoundBehavior::DoStop(), LedNode::DoStop(), KinematicSampleBehavior2::DoStop(), KinematicSampleBehavior::DoStop(), HeadPointerNode::DoStop(), HeadPointControllerBehavior::DoStop(), HeadLevelBehavior::DoStop(), FollowHeadBehavior::DoStop(), DriveMeBehavior::DoStop(), Controller::DoStop(), ChaseBallBehavior::DoStop(), CameraBehavior::DoStop(), BanditMachine::DoStop(), AlanBehavior::DoStop(), Aibo3DControllerBehavior::DoStop(), getOutputs(), RunSequenceControl< SequenceSize >::processEvent(), HeadLevelBehavior::processEvent(), WalkNode::setWalkID(), BatteryMonitorBehavior::stopWarning(), WalkNode::teardown(), PlayMotionSequenceNode< SIZE >::teardown(), ExploreMachine::teardown(), BanditMachine::PressNode::~PressNode(), and BanditMachine::WaitNode::~WaitNode().

void MotionManager::setOutput const MotionCommand caller,
unsigned int  output,
const OutputCmd  cmd[NumFrames],
const OutputPID pid
 

LOCKS MotionManager Requests a value and PID be set for the specified output

Definition at line 185 of file MotionManager.cc.

void MotionManager::setOutput const MotionCommand caller,
unsigned int  output,
const OutputCmd cmd,
const OutputPID pid
 

LOCKS MotionManager Requests a value and PID be set for the specified output

Definition at line 159 of file MotionManager.cc.

void MotionManager::setOutput const MotionCommand caller,
unsigned int  output,
const OutputPID pid
 

LOCKS MotionManager Requests a PID be set for the specified output, notice that this might be overruled by a higher priority motion

Definition at line 138 of file MotionManager.cc.

void MotionManager::setOutput const MotionCommand caller,
unsigned int  output,
const OutputCmd  cmd[NumFrames]
 

LOCKS MotionManager Requests a value be set for the specified output across frames

Definition at line 107 of file MotionManager.cc.

void MotionManager::setOutput const MotionCommand caller,
unsigned int  output,
const OutputCmd cmd,
unsigned int  frame
 

LOCKS MotionManager Requests a value be set for the specified output in the specified frame

Definition at line 84 of file MotionManager.cc.

void MotionManager::setOutput const MotionCommand caller,
unsigned int  output,
const OutputCmd cmd
 

LOCKS MotionManager Requests a value be set for the specified output, copies cmd across frames

Definition at line 60 of file MotionManager.cc.

Referenced by Controller::deactivate(), Controller::DoStop(), FollowHeadBehavior::processEvent(), EmergencyStopMC::releaseJoints(), LedEngine::updateLEDs(), WalkMC::updateOutputs(), TailWagMC::updateOutputs(), RemoteControllerMC::updateOutputs(), PostureMC::updateOutputs(), PIDMC::updateOutputs(), OldHeadPointerMC::updateOutputs(), MotionSequenceMC< MAXMOVE >::updateOutputs(), LedMC::updateOutputs(), HeadPointerMC::updateOutputs(), and DynamicMotionSequence::updateOutputs().

void MotionManager::setPID unsigned int  joint,
const float  pids[3]
[protected]
 

LOCKS MotionManager, called internally to do the work of setting the PID... you probably want to call setOutput with an OutputPID argument, not this...

Note that we don't actually set the PIDs in the system here, we just queue them up. PID changes seem to be an expensive operation, so may only want to clear the queue at some reduced rate (although that's not actually currently being done, it just could be)

Definition at line 662 of file MotionManager.cc.

Referenced by getOutputs(), and setOutput().

void MotionManager::setPriority MC_ID  mcid,
float  p
[inline]
 

sets the priority level of a MotionCommand

Definition at line 104 of file MotionManager.h.

Referenced by Controller::activate(), Controller::deactivate(), and BatteryMonitorBehavior::processEvent().

unsigned int MotionManager::size  )  const [inline]
 

returns the number of MotionCommands being managed

Definition at line 112 of file MotionManager.h.

Referenced by DynamicMotionSequence::clear(), DynamicMotionSequence::getUsedFrames(), and DynamicMotionSequence::newKeyFrame().

MotionManager::MC_ID MotionManager::skip_ahead MC_ID  mcid  )  const [protected]
 

during iteration, skips over motioncommands which are still in transit from on OObject to another

Definition at line 697 of file MotionManager.cc.

bool MotionManager::trylock  )  [inline]
 

tries to get a lock without blocking

Definition at line 146 of file MotionManager.h.

bool MotionManager::updatePIDs OPrimitiveID  primIDs[NumOutputs]  ) 
 

call this when you want MotionManager to update modified PID values, returns true if changes made (only MotoObj should be calling this...), see PIDMC for general PID documentation

This function handles the conversion from the Tekkotsu format (one regular IEEE float per parameter, to the OPEN-R format (which takes a specialized, reduced precision floating point number) This is all documented in PIDMC as well.

In order to send Tekkotsu's PIDs to the system, they are converted to the gain/shift format. On the ERS-2xx, we could dynamically choose shift values to allow more precision in setting values.

With the ERS-7, all shifts are shared, so they must be set to a common set of values, defined by WorldState::DefaultPIDShifts. This limits the range of gains which can then be set.

Due to the mysterious warning which would occur with the 2xx, (AGRMSDriver::SetGain() : 0x0A IS USED FOR GAIN SHIFT VALUE.) and since this seems to be the way things are going, all models now, by default, use global shift values (which can vary from model to model, just global for each model)

You can revert to the dynamic shift selection by commenting-in the noted code section below.

A final note: the OPENR::SetJointGain function seems to be a rather costly function call. You should probably try to avoid setting PIDs at too high a frequency.

Definition at line 451 of file MotionManager.cc.

Referenced by MMCombo::ReadySendJoints().

void MotionManager::updateWorldState  ) 
 

call this when you want MotionManager to set the WorldState to reflect what things should be for unsensed outputs (LEDs, ears) (only MotoObj should be calling this...)

Definition at line 396 of file MotionManager.cc.

Referenced by MMCombo::ReadySendJoints().


Member Data Documentation

int MotionManager::_MMaccID = -1U [static, protected]
 

Stores the accessor for the current process.

Definition at line 13 of file MotionManager.cc.

Referenced by checkoutMotion(), doAddMotion(), and InitAccess().

ListMemBuf<CommandEntry,MAX_MOTIONS,MC_ID> MotionManager::cmdlist [protected]
 

the list where MotionCommands are stored, remember, we're in a shared memory region with different base addresses - no pointers!

Definition at line 228 of file MotionManager.h.

Referenced by checkinMotion(), checkoutMotion(), doAddMotion(), getOutputs(), InitAccess(), receivedMsg(), removeMotion(), and skip_ahead().

OutputCmd MotionManager::cmds[NumOutputs] [protected]
 

Holds the weighted values and total weight for the outputs of the last frame.

Definition at line 240 of file MotionManager.h.

Referenced by getOutputs().

cmdstatelist_t MotionManager::cmdstates[NumOutputs] [protected]
 

requested positions by each of the MC's for each of the outputs

Definition at line 238 of file MotionManager.h.

Referenced by getOutputs(), and setOutput().

float MotionManager::cmdSums[NumOutputs] [protected]
 

Holds the final values for the outputs of the last frame generated.

Definition at line 239 of file MotionManager.h.

Referenced by getOutputs(), MotionManager(), setOutput(), and updateWorldState().

MC_ID MotionManager::cur_cmd [protected]
 

MC_ID of the MotionCommand currently being updated by getOutputs(), or NULL if not in getOutputs. This is used by the setOutput()'s to tell which MotionCommand is calling.

Definition at line 229 of file MotionManager.h.

Referenced by getOutputs(), and setOutput().

const MC_ID MotionManager::invalid_MC_ID = MotionManagerMsg::invalid_MC_ID [static]
 

for errors and undefined stuff

Definition at line 77 of file MotionManager.h.

const float MotionManager::kBackgroundPriority = 0 [static]
 

will only be expressed if *nothing* else is using that joint

Definition at line 16 of file MotionManager.cc.

const float MotionManager::kEmergencyPriority = 100 [static]
 

for really important stuff, such as the emergency stop

Definition at line 20 of file MotionManager.cc.

const float MotionManager::kHighPriority = 50 [static]
 

for stuff that should override standard stuff

Definition at line 19 of file MotionManager.cc.

const float MotionManager::kIgnoredPriority = -1 [static]
 

won't be expressed, handy if you want to temporarily pause something

Definition at line 15 of file MotionManager.cc.

const float MotionManager::kLowPriority = 5 [static]
 

for stuff that's not background but lower than standard

Definition at line 17 of file MotionManager.cc.

const float MotionManager::kStdPriority = 10 [static]
 

for every-day commands

Definition at line 18 of file MotionManager.cc.

Referenced by addMotion().

const unsigned int MotionManager::MAX_ACCESS = 2 [static]
 

This is the number of processes which will be accessing the MotionManager.

Probably just MainObject and MotionObject... This isn't really a hard maximum, but should be actual expected, need to know when they're all connected

Definition at line 72 of file MotionManager.h.

Referenced by doAddMotion().

const unsigned int MotionManager::MAX_MOTIONS = 64 [static]
 

This is the maximum number of Motions which can be managed, can probably be increased reasonably without trouble.

Definition at line 74 of file MotionManager.h.

MutexLock<MAX_ACCESS> MotionManager::MMlock [protected]
 

The main lock for the class.

Definition at line 235 of file MotionManager.h.

Referenced by InitAccess().

accID_t MotionManager::numAcc [protected]
 

The number of accessors who have registered with InitAccess().

Definition at line 243 of file MotionManager.h.

Referenced by doAddMotion(), and InitAccess().

ListMemBuf<PIDUpdate,NumPIDJoints> MotionManager::pidchanges [protected]
 

stores PID updates, up to one per joint (if same is set more than once, it's just overwrites previous update)

Definition at line 195 of file MotionManager.h.

Referenced by setPID(), and updatePIDs().

OSubject* MotionManager::subjs[MAX_ACCESS] [protected]
 

The OSubject for each process (accessor) on which it should be broadcast when a command is added.

Definition at line 244 of file MotionManager.h.

Referenced by doAddMotion(), InitAccess(), and removeMotion().


The documentation for this class was generated from the following files:

Tekkotsu v2.2.1
Generated Tue Nov 23 16:37:49 2004 by Doxygen 1.3.9.1