Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 #include <behaviors/NormalBrake.hpp>
00009 
00010 
00011 PLUGINLIB_DECLARE_CLASS(tk_behavior, NormalBrake, telekyb_behavior::NormalBrake, TELEKYB_NAMESPACE::Behavior);
00012 
00013 namespace telekyb_behavior {
00014 
00015 NormalBrake::NormalBrake()
00016         : Behavior("tk_behavior/NormalBrake", BehaviorType::Air)
00017 {
00018 
00019 }
00020 
00021 void NormalBrake::initialize()
00022 {
00023         
00024         tBrakeMinVelocity = addOption<double>("tBrakeMinVelocity",
00025                         "Minimum Velocity for NormalBrake Behavior.",0.1, false, false);
00026 
00027 
00028         
00029         parameterInitialized = true;
00030 }
00031 
00032 void NormalBrake::destroy()
00033 {
00034 
00035 }
00036 
00038 bool NormalBrake::willBecomeActive(const TKState& currentState, const Behavior& previousBehavior)
00039 {
00040         yawAngle = currentState.getEulerRPY()(2);
00041 
00042         return true;
00043 }
00044 
00045 void NormalBrake::didBecomeActive(const TKState& currentState, const Behavior& previousBehavior)
00046 {
00047         
00048 }
00049 
00050 void NormalBrake::willBecomeInActive(const TKState& currentState, const Behavior& nextBehavior)
00051 {
00052         
00053 }
00054 
00055 void NormalBrake::didBecomeInActive(const TKState& currentState, const Behavior& nextBehavior)
00056 {
00057         
00058 }
00059 
00060 
00061 void NormalBrake::trajectoryStepCreation(const TKState& currentState, TKTrajectory& generatedTrajInput)
00062 {
00063         
00064         trajectoryStepActive(currentState,generatedTrajInput);
00065 }
00066 
00067 
00068 void NormalBrake::trajectoryStepActive(const TKState& currentState, TKTrajectory& generatedTrajInput)
00069 {
00070         generatedTrajInput.setVelocity( Velocity3D::Zero() );
00071         generatedTrajInput.setYawAngle( yawAngle );
00072 }
00073 
00074 
00075 void NormalBrake::trajectoryStepTermination(const TKState& currentState, TKTrajectory& generatedTrajInput)
00076 {
00077         
00078         trajectoryStepActive(currentState,generatedTrajInput);
00079 }
00080 
00081 
00082 bool NormalBrake::isValid(const TKState& currentState) const
00083 {
00084         return currentState.linVelocity.norm() > tBrakeMinVelocity->getValue();
00085 }
00086 
00087 
00088 
00089 }