Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 #ifndef HUMANOID_LOCALIZATION_MOTIONMODEL_H_
00025 #define HUMANOID_LOCALIZATION_MOTIONMODEL_H_
00026 
00027 #include <ros/ros.h>
00028 #include <tf/transform_listener.h>
00029 #include <tf/transform_datatypes.h>
00030 #include <Eigen/Cholesky>
00031 
00032 #include <humanoid_localization/humanoid_localization_defs.h>
00033 
00034 namespace humanoid_localization{
00035 class MotionModel {
00036 public:
00037   MotionModel(ros::NodeHandle* nh, EngineT* rngEngine, tf::TransformListener* tf, const std::string& odomFrameId, const std::string& baseFrameId);
00038   virtual ~MotionModel();
00039   void reset();
00041   bool lookupOdomPose(const ros::Time& t, tf::Stamped<tf::Pose>& odomPose) const;
00042 
00044   bool lookupOdomTransform(const ros::Time& t, tf::Transform& odomTransform) const;
00045 
00048   tf::Transform computeOdomTransform(const tf::Transform currentPose) const;
00049 
00051   bool lookupLocalTransform(const std::string& targetFrame, const ros::Time& t, tf::StampedTransform& localTransform) const;
00052 
00054   bool lookupPoseHeight(const ros::Time& t, double& poseHeight) const;
00055 
00057   void applyOdomTransform(Particles& particles, const tf::Transform& odomTransform);
00058 
00061   bool applyOdomTransformTemporal(Particles& particles, const ros::Time& t, double dt);
00062 
00064   void storeOdomPose(const tf::Stamped<tf::Pose>& odomPose);
00065 
00068   bool getLastOdomPose(tf::Stamped<tf::Pose>& lastOdomPose) const;
00069 
00070 
00071   
00072   EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00073 
00074 protected:
00076   void applyOdomTransform(tf::Pose& particlePose, const tf::Transform& odomTransform);
00077 
00079   void transformPose(tf::Pose& particlePose, const tf::Transform& odomTransform);
00080 
00083   tf::Transform odomTransformNoise(const tf::Transform& odomTransform);
00084 
00086   tf::Transform calibrateOdometry(const tf::Transform& odomTransform) const;
00087 
00088   tf::TransformListener* m_tfListener;
00089 
00090   NormalGeneratorT m_rngNormal; 
00091   UniformGeneratorT m_rngUniform;
00092   
00094   Eigen::Matrix3d m_odomNoise2D;
00096   Eigen::Matrix3d m_odomCalibration2D;
00098   double m_odomNoiseZ;
00100   double m_odomNoiseRoll;
00102   double m_odomNoisePitch;
00103 
00104 
00105   std::string m_odomFrameId;
00106   std::string m_baseFrameId;
00107   std::string m_footprintFrameId;
00108 
00109   bool m_firstOdometryReceived;
00110   tf::Stamped<tf::Pose> m_lastOdomPose;
00111 
00112 
00113 };
00114 }
00115 
00116 #endif