00001 /* 00002 * Ground.hpp 00003 * 00004 * Created on: Nov 11, 2011 00005 * Author: mriedel 00006 */ 00007 00008 #ifndef GROUND_HPP_ 00009 #define GROUND_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 // ground has direct access to Trajectory Controller can toggle MassEstimation 00019 #include <tk_trajctrl/TrajectoryController.hpp> 00020 00021 using namespace TELEKYB_NAMESPACE; 00022 00023 namespace telekyb_behavior { 00024 00025 class Ground : public Behavior { 00026 protected: 00027 TrajectoryController* controller; 00028 Option<bool>* tDoMassEstimation; 00029 00030 public: 00031 Ground(); 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 } 00059 00060 #endif /* GROUND_HPP_ */