Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

EmergencyStopMC Class Reference

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

#include <EmergencyStopMC.h>

Inheritance diagram for EmergencyStopMC:

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

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 26 of file EmergencyStopMC.h.

List of all members.

Public Member Functions

 EmergencyStopMC ()
 constructor
virtual ~EmergencyStopMC ()
 destructor
virtual int updateOutputs ()
 checks for feedback or double tap
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 to set pidcutoff
float getResetSensitivity ()
 returns pidcutoff

Protected Member Functions

void freezeJoints ()
 code to execute when locking joints
void releaseJoints ()
 code to execute when releasing joints

Static Protected Member Functions

static bool trigger ()
 true when the trigger condition is active

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 timeoflastrelease
 the time estop was last turned off (may be in the future if still fading out control of joints!)
unsigned int duration
 the maximum time (in milliseconds) of consecutive button-down's to count as a double tap
float piddutyavgs [NumPIDJoints]
 a running average of PID feedback ("duty"), so one bad reading doesn't cause a movement, need a consistent pressure
float pidcutoff
 abs pid duty cycle above which we just reset joint to current
LedEngine ledengine
 used to do LED effects on the tail

Static Protected Attributes

static const unsigned int FADE_OUT_TIME = 400
 number of milliseconds to fade out lock on joints

Constructor & Destructor Documentation

EmergencyStopMC::EmergencyStopMC (  ) 

constructor

Definition at line 13 of file EmergencyStopMC.cc.

virtual EmergencyStopMC::~EmergencyStopMC (  )  [virtual]

destructor

Definition at line 29 of file EmergencyStopMC.h.


Member Function Documentation

void EmergencyStopMC::freezeJoints (  )  [protected]

code to execute when locking joints

Definition at line 218 of file EmergencyStopMC.cc.

Referenced by setActive(), and setStopped().

bool EmergencyStopMC::getActive (  ) 

returns active

Definition at line 33 of file EmergencyStopMC.h.

unsigned int EmergencyStopMC::getDblTapDuration (  )  const

returns duration

Definition at line 37 of file EmergencyStopMC.h.

float EmergencyStopMC::getResetSensitivity (  ) 

returns pidcutoff

Definition at line 39 of file EmergencyStopMC.h.

bool EmergencyStopMC::getStopped (  )  const

returns paused

Definition at line 35 of file EmergencyStopMC.h.

void EmergencyStopMC::releaseJoints (  )  [protected]

code to execute when releasing joints

Definition at line 295 of file EmergencyStopMC.cc.

Referenced by setActive(), and setStopped().

void EmergencyStopMC::setActive ( bool  a  ) 

allows you to modify active

Definition at line 188 of file EmergencyStopMC.cc.

void EmergencyStopMC::setDblTapDuration ( unsigned int  d  ) 

sets duration

Definition at line 36 of file EmergencyStopMC.h.

void EmergencyStopMC::setResetSensitivity ( float  r  ) 

takes a value to set pidcutoff

Definition at line 38 of file EmergencyStopMC.h.

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

allows you to modify paused

Definition at line 199 of file EmergencyStopMC.cc.

Referenced by updateOutputs().

bool EmergencyStopMC::trigger (  )  [static, protected]

true when the trigger condition is active

Definition at line 303 of file EmergencyStopMC.cc.

Referenced by updateOutputs().

int EmergencyStopMC::updateOutputs (  )  [virtual]

checks for feedback or double tap

Reimplemented from PostureMC.

Definition at line 74 of file EmergencyStopMC.cc.


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 50 of file EmergencyStopMC.h.

Referenced by getActive(), setActive(), and setStopped().

unsigned int EmergencyStopMC::duration [protected]

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

Definition at line 56 of file EmergencyStopMC.h.

Referenced by getDblTapDuration(), setDblTapDuration(), and updateOutputs().

const unsigned int EmergencyStopMC::FADE_OUT_TIME = 400 [static, protected]

number of milliseconds to fade out lock on joints

Definition at line 46 of file EmergencyStopMC.h.

Referenced by releaseJoints(), and updateOutputs().

used to do LED effects on the tail

Definition at line 60 of file EmergencyStopMC.h.

Referenced by EmergencyStopMC(), and updateOutputs().

bool EmergencyStopMC::paused [protected]

true if the joints are current locked up

Definition at line 48 of file EmergencyStopMC.h.

Referenced by getStopped(), setActive(), setStopped(), and updateOutputs().

unsigned int EmergencyStopMC::period [protected]

period of cycles on tail LEDs

Definition at line 51 of file EmergencyStopMC.h.

Referenced by EmergencyStopMC(), and updateOutputs().

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

Definition at line 58 of file EmergencyStopMC.h.

Referenced by getResetSensitivity(), setResetSensitivity(), and updateOutputs().

float 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 57 of file EmergencyStopMC.h.

Referenced by EmergencyStopMC(), freezeJoints(), and updateOutputs().

bool EmergencyStopMC::stilldown [protected]

true if the back button was down on last updateJointCmds

Definition at line 49 of file EmergencyStopMC.h.

Referenced by updateOutputs().

unsigned int EmergencyStopMC::timeoflastbtn [protected]

time of the last button press

Definition at line 52 of file EmergencyStopMC.h.

Referenced by updateOutputs().

unsigned int EmergencyStopMC::timeoflastfreeze [protected]

the time estop was last turned on

Definition at line 54 of file EmergencyStopMC.h.

Referenced by freezeJoints(), releaseJoints(), and updateOutputs().

unsigned int EmergencyStopMC::timeoflastrelease [protected]

the time estop was last turned off (may be in the future if still fading out control of joints!)

Definition at line 55 of file EmergencyStopMC.h.

Referenced by releaseJoints(), and updateOutputs().

unsigned int EmergencyStopMC::timeofthisbtn [protected]

time of the current button press

Definition at line 53 of file EmergencyStopMC.h.

Referenced by updateOutputs().


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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:07 2016 by Doxygen 1.6.3