00001 /* 00002 * StandardTrajectoryTracker.hpp 00003 * 00004 * Created on: Nov 8, 2011 00005 * Author: mriedel 00006 */ 00007 00008 #ifndef STANDARDTRAJECTORYTRACKER_HPP_ 00009 #define STANDARDTRAJECTORYTRACKER_HPP_ 00010 00011 #include <telekyb_defines/telekyb_defines.hpp> 00012 00013 00014 // Interface Definition 00015 #include <tk_trajctrl/TrajectoryTracker.hpp> 00016 00017 // Position Controller 00018 #include <tk_ctrlalgo/PositionControl.hpp> 00019 // Yaw Controller 00020 #include <tk_ctrlalgo/YawControl.hpp> 00021 // Dynamic Mass Estimator 00022 // Class Loading 00023 #include <pluginlib/class_loader.h> 00024 // Interface Definition 00025 #include <tk_param_estimator/MassEstimator.hpp> 00026 00027 // Ros 00028 #include <ros/ros.h> 00029 00030 00031 // Boost 00032 #include <boost/thread/mutex.hpp> 00033 00034 namespace TELEKYB_NAMESPACE { 00035 00036 00037 // Option Definition 00038 class StandardTrajectoryTrackerOptions : public OptionContainer { 00039 public: 00040 //Option<bool>* tCompletelyDisableME; 00041 00042 Option<std::string>* tCommandsTopic; 00043 Option<std::string>* tPluginLookupName; 00044 00045 StandardTrajectoryTrackerOptions(); 00046 }; 00047 00048 /* 00049 * OptionListener<bool> -> if MassEstimation is completely disabled! 00050 */ 00051 00052 class StandardTrajectoryTracker : public TrajectoryTracker { 00053 protected: 00054 // Mass Estimation Option 00055 Option<bool>* tDoMassEstimation; 00056 00057 // ClassLoader 00058 pluginlib::ClassLoader<MassEstimator> meLoader; 00059 00060 // Loaded Mass Estimator 00061 MassEstimator* massEstimator; 00062 00063 StandardTrajectoryTrackerOptions options; 00064 PositionControl positionControl; 00065 YawControl yawControl; 00066 //MassEstimation massEstimation; 00067 00068 // currentMass -> either constant or estimated by MassEstimator 00069 double currentMass; 00070 00071 boost::mutex currentInputMutex; 00072 TKTrajectory currentInput; 00073 00074 // Nodehandle 00075 ros::NodeHandle nodeHandle; 00076 ros::NodeHandle commandNodeHandle; 00077 00078 // Publish TKLLCommands 00079 ros::Publisher tTcCommandsPub; 00080 00081 00082 public: 00083 StandardTrajectoryTracker(); 00084 virtual ~StandardTrajectoryTracker(); 00085 00086 // Standard Interface functions 00087 void initialize(); 00088 void destroy(); 00089 00090 std::string getName() const; 00091 00092 // Callback Functions 00093 void trajectoryCB(const TKTrajectory& trajectory); 00094 void stateCB(const TKState& state); 00095 00096 00097 }; 00098 00099 } 00100 00101 #endif /* STANDARDTRAJECTORYTRACKER_HPP_ */