poseupdate.h
Go to the documentation of this file.
00001 //=================================================================================================
00002 // Copyright (c) 2011, Johannes Meyer, TU Darmstadt
00003 // All rights reserved.
00004 
00005 // Redistribution and use in source and binary forms, with or without
00006 // modification, are permitted provided that the following conditions are met:
00007 //     * Redistributions of source code must retain the above copyright
00008 //       notice, this list of conditions and the following disclaimer.
00009 //     * Redistributions in binary form must reproduce the above copyright
00010 //       notice, this list of conditions and the following disclaimer in the
00011 //       documentation and/or other materials provided with the distribution.
00012 //     * Neither the name of the Flight Systems and Automatic Control group,
00013 //       TU Darmstadt, nor the names of its contributors may be used to
00014 //       endorse or promote products derived from this software without
00015 //       specific prior written permission.
00016 
00017 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00018 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00019 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00020 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
00021 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00022 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00023 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00026 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027 //=================================================================================================
00028 
00029 #ifndef HECTOR_POSE_ESTIMATION_POSEUPDATE_H
00030 #define HECTOR_POSE_ESTIMATION_POSEUPDATE_H
00031 
00032 #include <hector_pose_estimation/measurement.h>
00033 #include <geometry_msgs/PoseWithCovarianceStamped.h>
00034 #include <geometry_msgs/TwistWithCovarianceStamped.h>
00035 
00036 #include <boost/function.hpp>
00037 
00038 namespace hector_pose_estimation {
00039 
00040 class PositionXYModel : public MeasurementModel {
00041 public:
00042   static const unsigned int MeasurementDimension = 2;
00043   typedef ColumnVector_<MeasurementDimension> MeasurementVector;
00044   typedef SymmetricMatrix_<MeasurementDimension> NoiseCovariance;
00045 
00046   PositionXYModel() : MeasurementModel(MeasurementDimension) {}
00047   virtual ~PositionXYModel() {}
00048 
00049   virtual ColumnVector ExpectedValueGet() const;
00050   virtual Matrix dfGet(unsigned int i) const;
00051 
00052   void updateState(const SymmetricMatrix &Px, const ColumnVector &x, const ColumnVector &diff, SymmetricMatrix &Pxy, ColumnVector &xy) const;
00053 };
00054 
00055 class PositionZModel : public MeasurementModel {
00056 public:
00057   static const unsigned int MeasurementDimension = 1;
00058   typedef ColumnVector_<MeasurementDimension> MeasurementVector;
00059   typedef SymmetricMatrix_<MeasurementDimension> NoiseCovariance;
00060 
00061   PositionZModel() : MeasurementModel(MeasurementDimension) {}
00062   virtual ~PositionZModel() {}
00063 
00064   virtual ColumnVector ExpectedValueGet() const;
00065   virtual Matrix dfGet(unsigned int i) const;
00066 
00067   void updateState(const SymmetricMatrix &Px, const ColumnVector &x, const ColumnVector &diff, SymmetricMatrix &Pxy, ColumnVector &xy) const;
00068 };
00069 
00070 class YawModel : public MeasurementModel {
00071 public:
00072   static const unsigned int MeasurementDimension = 1;
00073   typedef ColumnVector_<MeasurementDimension> MeasurementVector;
00074   typedef SymmetricMatrix_<MeasurementDimension> NoiseCovariance;
00075 
00076   YawModel() : MeasurementModel(MeasurementDimension) {}
00077   virtual ~YawModel() {}
00078 
00079   virtual ColumnVector ExpectedValueGet() const;
00080   virtual Matrix dfGet(unsigned int i) const;
00081 
00082   void updateState(const SymmetricMatrix &Px, const ColumnVector &x, const ColumnVector &diff, SymmetricMatrix &Pxy, ColumnVector &xy) const;
00083 };
00084 
00085 class TwistModel : public MeasurementModel {
00086 public:
00087   static const unsigned int MeasurementDimension = 6;
00088   typedef ColumnVector_<MeasurementDimension> MeasurementVector;
00089   typedef SymmetricMatrix_<MeasurementDimension> NoiseCovariance;
00090 
00091   TwistModel() : MeasurementModel(MeasurementDimension) {}
00092   virtual ~TwistModel() {}
00093 
00094   virtual ColumnVector ExpectedValueGet() const;
00095   virtual Matrix dfGet(unsigned int i) const;
00096 };
00097 
00098 class PoseUpdate : public Measurement
00099 {
00100 public:
00101   PoseUpdate(const std::string& name = "poseupdate");
00102   virtual ~PoseUpdate();
00103 
00104   class Update : public MeasurementUpdate {
00105   public:
00106     Update() {}
00107     Update(const geometry_msgs::PoseWithCovarianceStamped& pose) : pose(new geometry_msgs::PoseWithCovarianceStamped(pose)) {}
00108     Update(const geometry_msgs::PoseWithCovarianceStampedConstPtr& pose) : pose(pose) {}
00109     Update(const geometry_msgs::TwistWithCovarianceStamped& twist) : twist(new geometry_msgs::TwistWithCovarianceStamped(twist)) {}
00110     Update(const geometry_msgs::TwistWithCovarianceStampedConstPtr& twist) : twist(twist) {}
00111     Update(const geometry_msgs::PoseWithCovarianceStamped& pose, const geometry_msgs::TwistWithCovarianceStamped& twist) : pose(new geometry_msgs::PoseWithCovarianceStamped(pose)), twist(new geometry_msgs::TwistWithCovarianceStamped(twist)) {}
00112     Update(const geometry_msgs::PoseWithCovarianceStampedConstPtr& pose, const geometry_msgs::TwistWithCovarianceStampedConstPtr& twist) : pose(pose), twist(twist) {}
00113     geometry_msgs::PoseWithCovarianceStampedConstPtr pose;
00114     geometry_msgs::TwistWithCovarianceStampedConstPtr twist;
00115   };
00116 
00117   bool update(PoseEstimation &estimator, const MeasurementUpdate &update);
00118 
00119 private:
00120   PositionXYModel position_xy_model_;
00121   PositionZModel position_z_model_;
00122   YawModel yaw_model_;
00123   TwistModel twist_model_;
00124 
00125   double fixed_alpha_, fixed_beta_;
00126   bool interpret_covariance_as_information_matrix_;
00127 
00128   double fixed_position_xy_stddev_;
00129   double fixed_position_z_stddev_;
00130   double fixed_yaw_stddev_;
00131 
00132   double fixed_velocity_xy_stddev_;
00133   double fixed_velocity_z_stddev_;
00134   double fixed_angular_rate_xy_stddev_;
00135   double fixed_angular_rate_z_stddev_;
00136 
00137   double max_time_difference_;
00138   double max_position_xy_error_;
00139   double max_position_z_error_;
00140   double max_yaw_error_;
00141 
00142   double max_velocity_xy_error_;
00143   double max_velocity_z_error_;
00144   double max_angular_rate_xy_error_;
00145   double max_angular_rate_z_error_;
00146 
00147   bool jump_on_max_error_;
00148 
00149   typedef boost::function<void(const SymmetricMatrix &Px, const ColumnVector &x, const ColumnVector &diff, SymmetricMatrix &Pxy, ColumnVector &xy)> JumpFunction;
00150   double calculateOmega(const SymmetricMatrix &Ix, const SymmetricMatrix &Iy) const;
00151   double updateInternal(const SymmetricMatrix &Px, const ColumnVector &x, const SymmetricMatrix &Iy, const ColumnVector &error, const Matrix &H, SymmetricMatrix &Pxy, ColumnVector &xy, const std::string& text, const double max_error = 0.0, JumpFunction jump_function = JumpFunction());
00152 
00153 protected:
00154   Queue_<Update> queue_;
00155   virtual Queue& queue() { return queue_; }
00156 };
00157 
00158 } // namespace hector_pose_estimation
00159 
00160 #endif // HECTOR_POSE_ESTIMATION_POSEUPDATE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends


hector_pose_estimation_core
Author(s): Johannes Meyer
autogenerated on Mon Jul 15 2013 16:48:43