00001 /* 00002 * ViconStateEstimator.hpp 00003 * 00004 * Created on: Dec 6, 2011 00005 * Author: mriedel 00006 */ 00007 00008 #ifndef VICONSTATEESTIMATOR_HPP_ 00009 #define VICONSTATEESTIMATOR_HPP_ 00010 00011 #include <telekyb_defines/telekyb_defines.hpp> 00012 #include <telekyb_base/Options.hpp> 00013 00014 #include <tk_state/StateEstimator.hpp> 00015 00016 // plugin stuff 00017 #include <pluginlib/class_list_macros.h> 00018 00019 #include <geometry_msgs/PoseStamped.h> 00020 // ros 00021 #include <ros/subscriber.h> 00022 00023 #include <telekyb_base/Spaces/R3.hpp> 00024 00025 #include <telekyb_base/Filter/IIRFilter.hpp> 00026 00027 using namespace TELEKYB_NAMESPACE; 00028 00029 namespace telekyb_state { 00030 00031 class ViconStateEstimatorOptions : public OptionContainer { 00032 public: 00033 Option<std::string>* tViconSeTopicName; 00034 Option<Eigen::Matrix3d>* tViconToNEDMatrix; 00035 00036 // Velocity Filters 00037 Option<double>* tViconVelFilterFreq; 00038 Option<double>* tViconSmoothVelFilterFreq; 00039 Option<double>* tViconAngFilterFreq; 00040 00041 Option<double>* tViconSampleTime; 00042 00043 Option<bool>* tViconPublishSmoothVel; 00044 00045 ViconStateEstimatorOptions(); 00046 }; 00047 00048 class ViconStateEstimator : public TELEKYB_NAMESPACE::StateEstimator { 00049 protected: 00050 ViconStateEstimatorOptions options; 00051 00052 ros::NodeHandle nodeHandle; 00053 ros::Subscriber viconSub; 00054 00055 ros::Publisher smoothVelPub; 00056 00057 void initVelocityFilters(); 00058 00059 IIRFilter* velFilter[3]; 00060 IIRFilter* smoothVelFilter[3]; 00061 IIRFilter* angFilter[4]; 00062 00063 void velQuatToBodyOmega(const Quaternion& quat, const Quaternion& quatRates, Velocity3D& bodyOmega); 00064 00065 public: 00066 virtual void initialize(); 00067 virtual void willBecomeActive(); 00068 virtual void willBecomeInActive(); 00069 virtual void destroy(); 00070 00071 virtual std::string getName() const; 00072 00073 void viconCallback(const geometry_msgs::PoseStamped::ConstPtr& msg); 00074 // ViconStateEstimator(); 00075 // virtual ~ViconStateEstimator(); 00076 }; 00077 00078 } /* namespace telekyb_state */ 00079 #endif /* VICONSTATEESTIMATOR_HPP_ */