Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
EmergencyStopMC.hGo to the documentation of this file.00001 #ifndef INCLUDED_EmergencyStopMC_h 00002 #define INCLUDED_EmergencyStopMC_h 00003 00004 #include "PostureMC.h" 00005 #include "LedEngine.h" 00006 00007 //!overrides all joints with high priority freeze, blinks tail pink/red/blue cycle 00008 /*! Uses MotionCommand::kEmergencyPriority. Monitors the feedback on joints and 00009 * adjusts joints to react to pressures above a certain threshold. This allows 00010 * you to mold the body while it's in this mode, while retaining enough stiffness 00011 * to hold against gravity. 00012 * 00013 * This MotionCommand is intended to always be left running. It polls WorldState::state 00014 * for a double-tap on the back button, which causes it to set its joint values. 00015 * to whatever their current state is. LEDs are left blank, except the tail, 00016 * which is used to indicate that the emergency stop is on. 00017 * 00018 * A second double-tap will cause it to set all joints to 0 weight 00019 * 00020 * The tail LEDs only ever go up to .5, so that if you really care whether the tail 00021 * light was set by an underlying behavior/motion, you should be able to tell by 00022 * looking closely (if blue is going from .5 to 1, that's because it's already set) 00023 */ 00024 class EmergencyStopMC : public PostureMC { 00025 public: 00026 EmergencyStopMC(); //!< constructor 00027 virtual ~EmergencyStopMC() {} //!< destructor 00028 virtual int updateOutputs(); //!< checks for feedback or double tap 00029 00030 void setActive(bool a); //!< allows you to modify #active 00031 bool getActive() { return active; } //!< returns #active 00032 void setStopped(bool p, bool sound=true); //!< allows you to modify #paused 00033 bool getStopped() const { return paused; } //!< returns #paused 00034 void setDblTapDuration(unsigned int d) { duration=d; } //!< sets #duration 00035 unsigned int getDblTapDuration() const { return duration; } //!< returns #duration 00036 void setResetSensitivity(float r) { pidcutoff=r; } //!< takes a value to set #pidcutoff 00037 float getResetSensitivity() { return pidcutoff; } //!< returns #pidcutoff 00038 00039 protected: 00040 void freezeJoints(); //!< code to execute when locking joints 00041 void releaseJoints(); //!< code to execute when releasing joints 00042 static bool trigger(); //!< true when the trigger condition is active 00043 00044 bool paused; //!< true if the joints are current locked up 00045 bool stilldown; //!< true if the back button was down on last updateJointCmds 00046 bool active; //!< true if the EmergencyStopMC is monitoring the back button (if false, won't pause on a double-tap) 00047 unsigned int period; //!< period of cycles on tail LEDs 00048 unsigned int timeoflastbtn; //!< time of the last button press 00049 unsigned int timeofthisbtn; //!< time of the current button press 00050 unsigned int timeoflastfreeze; //!< the time estop was last turned on 00051 unsigned int duration; //!<the maximum time (in milliseconds) of consecutive button-down's to count as a double tap 00052 float piddutyavgs[NumPIDJoints]; //!< a running average of PID feedback ("duty"), so one bad reading doesn't cause a movement, need a consistent pressure 00053 float pidcutoff; //!<abs pid duty cycle above which we just reset joint to current 00054 LedEngine ledengine; //!< used to do LED effects on the tail 00055 }; 00056 00057 /*! @file 00058 * @brief Describes EmergencyStopMC, overrides all joints, allows modelling, blinks tail 00059 * @author ejt (Creator) 00060 * 00061 * $Author: ejt $ 00062 * $Name: tekkotsu-2_4_1 $ 00063 * $Revision: 1.12 $ 00064 * $State: Exp $ 00065 * $Date: 2005/01/07 19:36:38 $ 00066 */ 00067 00068 #endif |
Tekkotsu v2.4.1 |
Generated Tue Aug 16 16:32:46 2005 by Doxygen 1.4.4 |