Homepage Demos Overview Downloads Tutorials Reference
Credits
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Search

MotionManager Class Reference

#include <MotionManager.h>

List of all members.


Detailed Description

The purpose of this class is to serialize 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,[arg2,...]]) [, priority [, autoprune] ]);
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->addMotion(tmpvar [, ...]);

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 56 of file MotionManager.h.

Priority Level Constants

Just to give you a general idea what values to use for different priority levels

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 over ride standard stuff

const float kEmergencyPriority = 100
 for really important stuff, such as the emergency stop

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

void setPID (unsigned int j, const float p[3])
 LOCKS MotionManager you can call this to set the PID values directly (instead of using a motion command) Be careful though

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

ListMemBuf< PIDUpdate, NumPIDJoints > pidchanges
 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.

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

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

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


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

MotionCommand Unsafe
MC_ID addMotion (const SharedObjectBase &sm)
 LOCKS MotionManager Creates a new MotionCommand, automatically sharing it between processes (there is some lag time here)

MC_ID addMotion (const SharedObjectBase &sm, float priority)
 LOCKS MotionManager allows a quick way to set a priority level of a new MotionCommand

MC_ID addMotion (const SharedObjectBase &sm, bool autoprune)
 LOCKS MotionManager allows a quick was to set the autoprune flag

MC_ID addMotion (const SharedObjectBase &sm, float priority, bool autoprune)
 LOCKS MotionManager Call one of these to add a MotionCommand to the MotionManager, using the SharedObject class

void removeMotion (MC_ID mcid)
 LOCKS MotionManager removes the specified MotionCommand

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


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 = (MC_ID)-1
 for errors and undefined stuff


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 171 of file MotionManager.h.

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

shorthand for a list of OutputState's

Definition at line 210 of file MotionManager.h.

typedef MotionManagerMsg::MC_ID MotionManager::MC_ID
 

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

Definition at line 65 of file MotionManager.h.


Constructor & Destructor Documentation

MotionManager::MotionManager  ) 
 

Constructor, sets all the outputs to 0.

Definition at line 30 of file MotionManager.cc.

References cmdSums, ERS210Info::NumOutputs, and uint.

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
 

LOCKS MotionManager Call one of these to add a MotionCommand to the MotionManager, using the SharedObject class

Definition at line 454 of file MotionManager.cc.

References addMotion(), SharedObjectBase::data(), end(), func_begin(), func_end(), invalid_MC_ID, MC_ID, MotionCommand::setAutoPrune(), and setPriority().

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

LOCKS MotionManager allows a quick was to set the autoprune flag

Definition at line 444 of file MotionManager.cc.

References addMotion(), SharedObjectBase::data(), invalid_MC_ID, and MotionCommand::setAutoPrune().

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

LOCKS MotionManager allows a quick way to set a priority level of a new MotionCommand

Definition at line 436 of file MotionManager.cc.

References addMotion(), end(), func_begin(), func_end(), MC_ID, and setPriority().

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

LOCKS MotionManager Creates a new MotionCommand, automatically sharing it between processes (there is some lag time here)

Definition at line 409 of file MotionManager.cc.

References _MMaccID, ASSERT, cmdlist, SharedObjectBase::data(), ListMemBuf< CommandEntry, MAX_MOTIONS, MC_ID >::end(), func_begin(), func_end(), SharedObjectBase::getRegion(), invalid_MC_ID, kStdPriority, MAX_ACCESS, MC_ID, numAcc, pop_free(), and subjs.

MC_ID MotionManager::begin  )  const [inline]
 

returns the MC_ID of the first MotionCommand

Definition at line 88 of file MotionManager.h.

References ListMemBuf< CommandEntry, MAX_MOTIONS, MC_ID >::begin(), cmdlist, MC_ID, and skip_ahead().

void MotionManager::checkinMotion MC_ID  mcid  ) 
 

marks a MotionCommand as unused

Definition at line 532 of file MotionManager.cc.

References cmdlist.

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 99 of file MotionManager.h.

References cmdlist.

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

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

Definition at line 501 of file MotionManager.cc.

References _MMaccID, accID_t, cmdlist, and MAX_MOTIONS.

MC_ID MotionManager::end  )  const [inline]
 

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

Definition at line 90 of file MotionManager.h.

References cmdlist, ListMemBuf< CommandEntry, MAX_MOTIONS, MC_ID >::end(), and MC_ID.

void MotionManager::func_begin  )  [inline, protected]
 

called at the begining of many functions to lock MotionManager

Definition at line 173 of file MotionManager.h.

References _MMaccID, MutexLock< MAX_ACCESS >::lock(), and MMlock.

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

same as func_end(), except passes return value through

Definition at line 175 of file MotionManager.h.

References func_end().

void MotionManager::func_end  )  [inline, protected]
 

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

Definition at line 174 of file MotionManager.h.

References MMlock, and MutexLock< MAX_ACCESS >::release().

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 82 of file MotionManager.h.

References cmds.

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 199 of file MotionManager.cc.

References ASSERT, ListMemBuf< OutputState, MAX_MOTIONS >::begin(), begin(), checkinMotion(), checkoutMotion(), ListMemBuf< OutputState, MAX_MOTIONS >::clear(), cmdlist, cmds, cmdstates, cmdSums, cur_cmd, ListMemBuf< OutputState, MAX_MOTIONS >::end(), end(), func_begin(), func_end(), invalid_MC_ID, MC_ID, ListMemBuf< OutputState, MAX_MOTIONS >::next(), next(), ERS210Info::NumFrames, ERS210Info::NumLEDs, ERS210Info::NumOutputs, ERS210Info::NumPIDJoints, ERS210Info::PIDJointOffset, removeMotion(), setPID(), MotionCommand::shouldPrune(), state, uint, MotionCommand::updateOutputs(), OutputCmd::value, and OutputCmd::weight.

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

returns priority level of a MotionCommand

Definition at line 84 of file MotionManager.h.

References cmdlist.

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 43 of file MotionManager.cc.

References _MMaccID, cmdlist, MutexLock< MAX_ACCESS >::lock(), MAX_ACCESS, MMlock, numAcc, MutexLock< MAX_ACCESS >::release(), ListMemBuf< CommandEntry, MAX_MOTIONS, MC_ID >::size(), and subjs.

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 114 of file MotionManager.h.

References _MMaccID, MutexLock< MAX_ACCESS >::lock(), and MMlock.

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

returns the MC_ID of MotionCommand following the one that is passed

Definition at line 89 of file MotionManager.h.

References cmdlist, MC_ID, ListMemBuf< CommandEntry, MAX_MOTIONS, MC_ID >::next(), and skip_ahead().

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 98 of file MotionManager.h.

References _MMaccID, and cmdlist.

MC_ID MotionManager::pop_free  )  [inline, protected]
 

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

Definition at line 205 of file MotionManager.h.

References cmdlist, MC_ID, and ListMemBuf< CommandEntry, MAX_MOTIONS, MC_ID >::new_front().

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

puts an entry back into cmdlist's free section

Definition at line 206 of file MotionManager.h.

References cmdlist, and ListMemBuf< CommandEntry, MAX_MOTIONS, MC_ID >::erase().

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 469 of file MotionManager.cc.

References _MMaccID, EventBase::activateETID, MotionManagerMsg::addMotion, cmdlist, MotionManagerMsg::deleteMotion, erouter, func_begin(), func_end(), MotionManagerMsg::mc_id, MC_ID, EventBase::motmanEGID, EventRouter::postEvent(), and MotionManagerMsg::type.

void MotionManager::release  )  [inline]
 

releases a lock on the motion manager

Definition at line 116 of file MotionManager.h.

References MMlock, and MutexLock< MAX_ACCESS >::release().

void MotionManager::removeMotion MC_ID  mcid  ) 
 

LOCKS MotionManager removes the specified MotionCommand

Test:
do i do this right, or does it leak memory?

Definition at line 538 of file MotionManager.cc.

References _MMaccID, checkinMotion(), checkoutMotion(), cmdlist, EventBase::deactivateETID, erouter, func_begin(), func_end(), invalid_MC_ID, EventBase::motmanEGID, EventRouter::postEvent(), push_free(), MotionManagerMsg::setDelete(), and subjs.

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 172 of file MotionManager.cc.

References ListMemBuf< OutputState, MAX_MOTIONS >::begin(), cmdstates, cmdSums, cur_cmd, ListMemBuf< OutputState, MAX_MOTIONS >::end(), func_begin(), func_end(), MotionManagerMsg::getID(), getPriority(), invalid_MC_ID, kBackgroundPriority, ERS210Info::NumFrames, ERS210Info::NumOutputs, and ListMemBuf< OutputState, MAX_MOTIONS >::push_front().

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 148 of file MotionManager.cc.

References ListMemBuf< OutputState, MAX_MOTIONS >::begin(), cmdstates, cmdSums, cur_cmd, ListMemBuf< OutputState, MAX_MOTIONS >::end(), func_begin(), func_end(), MotionManagerMsg::getID(), getPriority(), invalid_MC_ID, kBackgroundPriority, ERS210Info::NumFrames, ERS210Info::NumOutputs, ListMemBuf< OutputState, MAX_MOTIONS >::push_front(), OutputCmd::value, and OutputCmd::weight.

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

Todo:
should be able to set background pid

Definition at line 128 of file MotionManager.cc.

References ListMemBuf< OutputState, MAX_MOTIONS >::begin(), cmdstates, cur_cmd, ListMemBuf< OutputState, MAX_MOTIONS >::end(), func_begin(), func_end(), MotionManagerMsg::getID(), getPriority(), invalid_MC_ID, kBackgroundPriority, ERS210Info::NumOutputs, and ListMemBuf< OutputState, MAX_MOTIONS >::push_front().

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 106 of file MotionManager.cc.

References ListMemBuf< OutputState, MAX_MOTIONS >::begin(), cmdstates, cmdSums, cur_cmd, ListMemBuf< OutputState, MAX_MOTIONS >::end(), func_begin(), func_end(), MotionManagerMsg::getID(), getPriority(), invalid_MC_ID, kBackgroundPriority, ERS210Info::NumFrames, ERS210Info::NumOutputs, and ListMemBuf< OutputState, MAX_MOTIONS >::push_front().

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 85 of file MotionManager.cc.

References ListMemBuf< OutputState, MAX_MOTIONS >::begin(), cmdstates, cmdSums, cur_cmd, ListMemBuf< OutputState, MAX_MOTIONS >::end(), func_begin(), func_end(), MotionManagerMsg::getID(), getPriority(), invalid_MC_ID, kBackgroundPriority, ERS210Info::NumOutputs, ListMemBuf< OutputState, MAX_MOTIONS >::push_front(), OutputCmd::value, and OutputCmd::weight.

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 63 of file MotionManager.cc.

References ListMemBuf< OutputState, MAX_MOTIONS >::begin(), cmdstates, cmdSums, cur_cmd, ListMemBuf< OutputState, MAX_MOTIONS >::end(), func_begin(), func_end(), MotionManagerMsg::getID(), getPriority(), invalid_MC_ID, kBackgroundPriority, ERS210Info::NumFrames, ERS210Info::NumOutputs, ListMemBuf< OutputState, MAX_MOTIONS >::push_front(), OutputCmd::value, and OutputCmd::weight.

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

LOCKS MotionManager you can call this to set the PID values directly (instead of using a motion command) Be careful though

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 implemented, so right now there's no real benefit until that's done)

Definition at line 563 of file MotionManager.cc.

References ListMemBuf< PIDUpdate, NumPIDJoints >::begin(), ListMemBuf< PIDUpdate, NumPIDJoints >::end(), ListMemBuf< PIDUpdate, NumPIDJoints >::erase(), func_begin(), func_end(), ListMemBuf< PIDUpdate, NumPIDJoints >::next(), pidchanges, WorldState::pids, ListMemBuf< PIDUpdate, NumPIDJoints >::push_back(), state, and uint.

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

sets the priority level of a MotionCommand

Definition at line 83 of file MotionManager.h.

References cmdlist.

unsigned int MotionManager::size  )  const [inline]
 

returns the number of MotionCommands being managed

Definition at line 91 of file MotionManager.h.

References cmdlist, and ListMemBuf< CommandEntry, MAX_MOTIONS, MC_ID >::size().

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 596 of file MotionManager.cc.

References _MMaccID, cmdlist, ListMemBuf< CommandEntry, MAX_MOTIONS, MC_ID >::end(), and ListMemBuf< CommandEntry, MAX_MOTIONS, MC_ID >::next().

bool MotionManager::trylock  )  [inline]
 

tries to get a lock without blocking

Definition at line 115 of file MotionManager.h.

References _MMaccID, MMlock, and MutexLock< MAX_ACCESS >::try_lock().

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

Definition at line 386 of file MotionManager.cc.

References ListMemBuf< PIDUpdate, NumPIDJoints >::empty(), ListMemBuf< PIDUpdate, NumPIDJoints >::front(), pidchanges, WorldState::pids, ListMemBuf< PIDUpdate, NumPIDJoints >::pop_front(), state, and uint.

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 366 of file MotionManager.cc.

References ERS210Info::BinJointOffset, cmdSums, WorldState::ERS210Mask, WorldState::ERS220Mask, ERS210Info::LEDOffset, ERS210Info::NumBinJoints, ERS210Info::NumLEDs, ERS210Info::NumPIDJoints, WorldState::outputs, WorldState::robotDesign, state, and uint.


Member Data Documentation

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

Stores the accessor for the current process.

Definition at line 12 of file MotionManager.cc.

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 201 of file MotionManager.h.

OutputCmd MotionManager::cmds[NumOutputs] [protected]
 

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

Definition at line 213 of file MotionManager.h.

cmdstatelist_t MotionManager::cmdstates[NumOutputs] [protected]
 

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

Definition at line 211 of file MotionManager.h.

float MotionManager::cmdSums[NumOutputs] [protected]
 

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

Definition at line 212 of file MotionManager.h.

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 202 of file MotionManager.h.

const MC_ID MotionManager::invalid_MC_ID = (MC_ID)-1 [static]
 

for errors and undefined stuff

Definition at line 66 of file MotionManager.h.

const float MotionManager::kBackgroundPriority = 0 [static]
 

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

Definition at line 15 of file MotionManager.cc.

const float MotionManager::kEmergencyPriority = 100 [static]
 

for really important stuff, such as the emergency stop

Definition at line 19 of file MotionManager.cc.

const float MotionManager::kHighPriority = 50 [static]
 

for stuff that should over ride standard stuff

Definition at line 18 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 14 of file MotionManager.cc.

const float MotionManager::kLowPriority = 5 [static]
 

for stuff that's not background but lower than standard

Definition at line 16 of file MotionManager.cc.

const float MotionManager::kStdPriority = 10 [static]
 

for every-day commands

Definition at line 17 of file MotionManager.cc.

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 Isn't really a hard maximum, but should be actual expected, need to know when they're all connected

Definition at line 61 of file MotionManager.h.

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 63 of file MotionManager.h.

MutexLock<MAX_ACCESS> MotionManager::MMlock [protected]
 

The main lock for the class.

Definition at line 208 of file MotionManager.h.

accID_t MotionManager::numAcc [protected]
 

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

Definition at line 216 of file MotionManager.h.

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 168 of file MotionManager.h.

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 217 of file MotionManager.h.


The documentation for this class was generated from the following files:
Tekkotsu v1.4
Generated Sat Jul 19 00:09:03 2003 by Doxygen 1.3.2