00001 /* 00002 * LinearFlyTo.hpp 00003 * 00004 * Created on: Nov 22, 2011 00005 * Author: mriedel 00006 */ 00007 00008 #ifndef LINEARFLYTO_HPP_ 00009 #define LINEARFLYTO_HPP_ 00010 00011 #include <telekyb_defines/telekyb_defines.hpp> 00012 00013 #include <tk_behavior/Behavior.hpp> 00014 00015 // plugin stuff 00016 #include <pluginlib/class_list_macros.h> 00017 00018 using namespace TELEKYB_NAMESPACE; 00019 00020 namespace telekyb_behavior { 00021 00022 class LinearFlyTo : public Behavior { 00023 protected: 00024 Option<Position3D>* tFlyToDestination; 00025 Option<double>* tFlyToVelocity; 00026 Option<double>* tFlyToDestinationRadius; 00027 00028 double yawAngle; 00029 00030 public: 00031 LinearFlyTo(); 00032 00033 virtual void initialize(); 00034 virtual void destroy(); 00035 00036 // Called directly after Change Event is registered. 00037 virtual bool willBecomeActive(const TKState& currentState, const Behavior& previousBehavior); 00038 // Called after actual Switch. Note: During execution trajectoryStepCreation is used 00039 virtual void didBecomeActive(const TKState& currentState, const Behavior& previousBehavior); 00040 // Called directly after Change Event is registered: During execution trajectoryStepTermination is used 00041 virtual void willBecomeInActive(const TKState& currentState, const Behavior& nextBehavior); 00042 // Called after actual Switch. Runs in seperate Thread. 00043 virtual void didBecomeInActive(const TKState& currentState, const Behavior& nextBehavior); 00044 00045 // called everytime a new TKState is available AND it is the NEW Behavior of an active Switch 00046 virtual void trajectoryStepCreation(const TKState& currentState, TKTrajectory& generatedTrajInput); 00047 00048 // called everytime a new TKState is available. Should return false if invalid (swtich to next behavior, or Hover if undef). 00049 virtual void trajectoryStepActive(const TKState& currentState, TKTrajectory& generatedTrajInput); 00050 00051 // called everytime a new TKState is available AND it is the OLD Behavior of an active Switch 00052 virtual void trajectoryStepTermination(const TKState& currentState, TKTrajectory& generatedTrajInput); 00053 00054 // Return true if the active Behavior is (still) valid. Initiate Switch otherwise 00055 virtual bool isValid(const TKState& currentState) const; 00056 }; 00057 00058 } /* namespace telekyb_behavior */ 00059 #endif /* LINEARFLYTO_HPP_ */