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

EmergencyStopMC Class Reference

#include <EmergencyStopMC.h>

Inheritance diagram for EmergencyStopMC:

Inheritance graph
[legend]
List of all members.

Detailed Description

overrides all joints with high priority freeze, blinks tail pink/red/blue cycle

Uses MotionCommand::kEmergencyPriority. Monitors the feedback on joints and adjusts joints to react to pressures above a certain threshold. This allows you to mold the body while it's in this mode, while retaining enough stiffness to hold against gravity.

This MotionCommand is intended to always be left running. It polls WorldState::state for a double-tap on the back button, which causes it to set its joint values. to whatever their current state is. LEDs are left blank, except the tail, which is used to indicate that the emergency stop is on.

A second double-tap will cause it to set all joints to MotionCommand::unusedJoint

The tail LEDs only ever go up to .5, so that if you really care whether the tail light was set by an underlying behavior/motion, you should be able to tell by looking closely (if blue is going from .5 to 1, that's because it's already set)

Definition at line 24 of file EmergencyStopMC.h.

Public Member Functions

 EmergencyStopMC ()
 constructor

virtual ~EmergencyStopMC ()
 destructor

virtual int updateOutputs ()
 checks for feedback or double tap

virtual void takeSnapshot ()
 records current positions of joints

void setActive (bool a)
 allows you to modify active

bool getActive ()
 returns active

void setStopped (bool p, bool sound=true)
 allows you to modify paused

bool getStopped () const
 returns paused

void setDblTapDuration (unsigned int d)
 sets duration

unsigned int getDblTapDuration () const
 returns duration

void setResetSensitivity (float r)
 takes a value [0,1] to set pidcutoff

float getResetSensitivity ()
 returns a value [0-1], corresponding to pidcutoff


Protected Member Functions

void freezeJoints ()
 code to execute when locking joints

void releaseJoints ()
 code to execute when releasing joints


Protected Attributes

bool paused
 true if the joints are current locked up

bool stilldown
 true if the back button was down on last updateJointCmds

bool active
 true if the EmergencyStopMC is monitoring the back button (if false, won't pause on a double-tap)

unsigned int period
 period of cycles on tail LEDs

unsigned int timeoflastbtn
 time of the last button press

unsigned int timeofthisbtn
 time of the current button press

unsigned int timeoflastfreeze
 the time estop was last turned on

unsigned int duration
 the maximum time (in milliseconds) of consecutive button-down's to count as a double tap

unsigned char piddutyavgs [NumPIDJoints]
 a running average of PID feedback ("duty"), so one bad reading doesn't cause a movement, need a consistent pressure

unsigned char pidcutoff
 abs pid duty cycle above which we just reset joint to current

LedEngine ledengine
 used to do LED effects on the tail


Constructor & Destructor Documentation

EmergencyStopMC::EmergencyStopMC  ) 
 

constructor

Definition at line 11 of file EmergencyStopMC.cc.

References LedEngine::cycle(), WorldState::ERS210Mask, WorldState::ERS220Mask, ledengine, ERS210Info::NumPIDJoints, period, piddutyavgs, WorldState::robotDesign, MotionCommand::setAutoPrune(), and state.

virtual EmergencyStopMC::~EmergencyStopMC  )  [inline, virtual]
 

destructor

Definition at line 27 of file EmergencyStopMC.h.


Member Function Documentation

void EmergencyStopMC::freezeJoints  )  [protected]
 

code to execute when locking joints

Definition at line 101 of file EmergencyStopMC.cc.

References EventBase::activateETID, PostureEngine::cmds, WorldState::ERS210Mask, WorldState::ERS220Mask, EventBase::estopEGID, MotionManagerMsg::getID(), ERS210Info::LEDOffset, ERS210Info::NumLEDs, ERS210Info::NumOutputs, MotionCommand::postEvent(), WorldState::robotDesign, OutputCmd::set(), state, takeSnapshot(), OutputCmd::unset(), and OutputCmd::weight.

bool EmergencyStopMC::getActive  )  [inline]
 

returns active

Definition at line 33 of file EmergencyStopMC.h.

References active.

unsigned int EmergencyStopMC::getDblTapDuration  )  const [inline]
 

returns duration

Definition at line 37 of file EmergencyStopMC.h.

References duration.

float EmergencyStopMC::getResetSensitivity  )  [inline]
 

returns a value [0-1], corresponding to pidcutoff

Definition at line 39 of file EmergencyStopMC.h.

References pidcutoff.

bool EmergencyStopMC::getStopped  )  const [inline]
 

returns paused

Definition at line 35 of file EmergencyStopMC.h.

References paused.

void EmergencyStopMC::releaseJoints  )  [protected]
 

code to execute when releasing joints

Definition at line 120 of file EmergencyStopMC.cc.

References PostureEngine::cmds, EventBase::deactivateETID, WorldState::ERS210Mask, WorldState::ERS220Mask, EventBase::estopEGID, get_time(), MotionManagerMsg::getID(), ERS210Info::LEDOffset, motman, ERS210Info::NumLEDs, ERS210Info::NumOutputs, MotionCommand::postEvent(), WorldState::robotDesign, MotionManager::setOutput(), state, timeoflastfreeze, and OutputCmd::unset().

void EmergencyStopMC::setActive bool  a  ) 
 

allows you to modify active

Definition at line 67 of file EmergencyStopMC.cc.

References active, freezeJoints(), paused, and releaseJoints().

void EmergencyStopMC::setDblTapDuration unsigned int  d  )  [inline]
 

sets duration

Definition at line 36 of file EmergencyStopMC.h.

References duration.

void EmergencyStopMC::setResetSensitivity float  r  )  [inline]
 

takes a value [0,1] to set pidcutoff

Definition at line 38 of file EmergencyStopMC.h.

References pidcutoff.

void EmergencyStopMC::setStopped bool  p,
bool  sound = true
 

allows you to modify paused

Definition at line 78 of file EmergencyStopMC.cc.

References active, config, PostureMC::dirty, Config::motion_config::estop_off_snd, Config::motion_config::estop_on_snd, freezeJoints(), get_time(), Config::motion, paused, SoundManager::PlayFile(), releaseJoints(), sndman, and timeoflastfreeze.

void EmergencyStopMC::takeSnapshot  )  [virtual]
 

records current positions of joints

Reimplemented from PostureMC.

Definition at line 61 of file EmergencyStopMC.cc.

References PostureEngine::cmds, PostureMC::dirty, ERS210Info::NumOutputs, WorldState::outputs, state, and OutputCmd::value.

int EmergencyStopMC::updateOutputs  )  [virtual]
 

checks for feedback or double tap

Reimplemented from PostureMC.

Definition at line 32 of file EmergencyStopMC.cc.

References ERS210Info::BackButOffset, WorldState::button_times, PostureEngine::cmds, duration, get_time(), ledengine, ERS210Info::LEDOffset, ERS210Info::NumPIDJoints, paused, pidcutoff, WorldState::pidduties, piddutyavgs, setStopped(), state, stilldown, timeoflastbtn, timeofthisbtn, LedEngine::updateLEDs(), PostureMC::updateOutputs(), and OutputCmd::value.


Member Data Documentation

bool EmergencyStopMC::active [protected]
 

true if the EmergencyStopMC is monitoring the back button (if false, won't pause on a double-tap)

Definition at line 47 of file EmergencyStopMC.h.

unsigned int EmergencyStopMC::duration [protected]
 

the maximum time (in milliseconds) of consecutive button-down's to count as a double tap

Definition at line 52 of file EmergencyStopMC.h.

LedEngine EmergencyStopMC::ledengine [protected]
 

used to do LED effects on the tail

Definition at line 55 of file EmergencyStopMC.h.

bool EmergencyStopMC::paused [protected]
 

true if the joints are current locked up

Definition at line 45 of file EmergencyStopMC.h.

unsigned int EmergencyStopMC::period [protected]
 

period of cycles on tail LEDs

Definition at line 48 of file EmergencyStopMC.h.

unsigned char EmergencyStopMC::pidcutoff [protected]
 

abs pid duty cycle above which we just reset joint to current

Definition at line 54 of file EmergencyStopMC.h.

unsigned char EmergencyStopMC::piddutyavgs[NumPIDJoints] [protected]
 

a running average of PID feedback ("duty"), so one bad reading doesn't cause a movement, need a consistent pressure

Definition at line 53 of file EmergencyStopMC.h.

bool EmergencyStopMC::stilldown [protected]
 

true if the back button was down on last updateJointCmds

Definition at line 46 of file EmergencyStopMC.h.

unsigned int EmergencyStopMC::timeoflastbtn [protected]
 

time of the last button press

Definition at line 49 of file EmergencyStopMC.h.

unsigned int EmergencyStopMC::timeoflastfreeze [protected]
 

the time estop was last turned on

Definition at line 51 of file EmergencyStopMC.h.

unsigned int EmergencyStopMC::timeofthisbtn [protected]
 

time of the current button press

Definition at line 50 of file EmergencyStopMC.h.


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