ab_filter_pose.h
Go to the documentation of this file.
00001 /*
00002  *  Alpha-Beta Filter
00003  *  Copyright (C) 2011, CCNY Robotics Lab
00004  *  Ivan Dryanovski <ivan.dryanovski@gmail.com>
00005  *
00006  *  http://robotics.ccny.cuny.edu
00007  *
00008  *  This program is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  This program is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *  GNU General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU General Public License
00019  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00020  */
00021 
00022 #ifndef AB_FILTER_AB_FILTER_POSE_H
00023 #define AB_FILTER_AB_FILTER_POSE_H
00024 
00025 #include <ros/ros.h>
00026 #include <geometry_msgs/PoseStamped.h>
00027 #include <geometry_msgs/TwistStamped.h>
00028 #include <tf/transform_datatypes.h>
00029 
00030 namespace mav
00031 {
00032 
00033 class ABFilterPose
00034 {
00035   typedef geometry_msgs::PoseStamped Pose;
00036   typedef geometry_msgs::TwistStamped Twist;
00037 
00038 // for campatibility b/n ROS Electric and Fuerte
00039 #if ROS_VERSION_MINIMUM(1, 8, 0)
00040   typedef tf::Matrix3x3 MyMatrix;
00041 #else
00042   typedef btMatrix3x3 MyMatrix;
00043 #endif
00044 
00045   private:
00046 
00047     // **** ROS-related
00048     ros::NodeHandle nh_;
00049     ros::NodeHandle nh_private_;
00050 
00051     ros::Subscriber subscriber_;
00052     ros::Publisher pose_publisher_;
00053     ros::Publisher twist_publisher_;
00054     ros::Publisher twist_unf_publisher_;
00055 
00056     // **** state variables    
00057 
00058     bool initialized_;
00059     ros::Time last_update_time_;
00060 
00061     tf::Vector3 pos_;
00062     tf::Vector3 lin_vel_;
00063     tf::Vector3 lin_vel_unf_;
00064 
00065     tf::Quaternion q_;
00066     tf::Vector3 ang_vel_;
00067     tf::Vector3 ang_vel_unf_;
00068 
00069     double roll_, pitch_, yaw_;
00070     double v_roll_, v_pitch_, v_yaw_;
00071 
00072     // **** parameters
00073   
00074     double alpha_;
00075     double beta_;
00076     bool publish_unfiltered_;
00077 
00078     // **** member functions
00079 
00080     void initializeParams();
00081 
00082     void poseCallback(const Pose::ConstPtr pose_msg);
00083     void publishPose(const std_msgs::Header& header);
00084 
00085     // [0, 2pi)
00086     void normalizeAngle2Pi(double& angle);
00087 
00088     // [-pi, pi)
00089     void normalizeAnglePi(double& angle);
00090 
00091   public:
00092 
00093     ABFilterPose(ros::NodeHandle nh, ros::NodeHandle nh_private);
00094     virtual ~ABFilterPose();
00095 };
00096 
00097 } // end namespace mav
00098 
00099 #endif // AB_FILTER_AB_FILTER_POSE2D_H


ab_filter
Author(s): Ivan Dryanovski
autogenerated on Thu Jan 2 2014 11:28:26