PlatformKalmanFilter.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2017, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package ArmarX
19  * @author Mirko Waechter( mirko.waechter at kit dot edu)
20  * @date 2018
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 #pragma once
25 
26 #include <memory>
27 
28 #include <IceUtil/Time.h>
29 
30 #include "KalmanFilter.h"
31 
32 namespace memoryx
33 {
34  /**
35  * @brief This class is a convenience class for a holonomic platform using a Kalman filter.
36  */
38  {
39  public:
40  /**
41  * @brief PlatformKalmanFilter
42  * @param initialPosition Initial position in mm
43  * @param initialRotation Initial rotation in rad
44  * @param translationSensorStdDev Standard deviation of the position sensing in mm
45  * @param rotationSensorStdDev Standard deviation of the orientation sensing in rad
46  * @param translationVelocitySensorStdDev Standard deviation of the translation velocity sensing in mm. This value is scaled with the current velocity in the predict step.
47  * @param rotationVelocitySensorStdDev Standard deviation of the rotation velocity sensing in rad. This value is scaled with the current velocity in the predict step.
48  */
49  PlatformKalmanFilter(Eigen::Vector2d initialPosition,
50  double initialRotation,
51  double translationSensorStdDev = 100.0,
52  double rotationSensorStdDev = 0.1,
53  double translationVelocitySensorStdDev = 1.,
54  double rotationVelocitySensorStdDev = 1.);
55  /**
56  * @brief Performs the predict-step of the Kalman filter.
57  * @param velX translational velocity on x-axis of the platform in **robot coordinates**
58  * @param velY translational velocity on y-axis of the platform in **robot coordinates**
59  * @param velTheta rotational velocity on z-axis of the platform in **robot coordinates**
60  * @param deltaT timestep between last and current velocity measurement, i.e. between last and current predict() call
61  */
62  void predict(double velX, double velY, double velTheta, const IceUtil::Time& deltaT);
63 
64  /**
65  * @brief Performs the update-step of the Kalman filter.
66  * @param x X-position of the platform in **global coordinates**
67  * @param y Y-position of the platform in **global coordinates**
68  * @param alpha Rotation of the platform in **global coordinates**
69  */
70  void update(double x, double y, double alpha);
71 
72  /**
73  * @brief Global pose of the holonomic platform.
74  * @return x,y,rotation
75  */
76  const Eigen::Vector3d& getPose() const;
77 
78  Eigen::Vector2d getPosition() const;
79  double getOrientation() const;
80 
81  /**
82  * @brief Covariance matrix of the current belief of the state
83  */
84  Eigen::Matrix3d getCovariance() const;
85 
86  const KalmanFilter& getFilter() const;
87 
88  /**
89  * @brief Change the internal Kalman Filter. Only use if you know what you are doing.
90  */
91  void setFilter(const KalmanFilter& value);
92 
93  protected:
94  Eigen::Vector4d transformPose(const Eigen::Vector3d& pose) const;
95  Eigen::Vector3d inverseTransformPose(const Eigen::Vector4d& pose) const;
96 
97 
101  Eigen::Vector3d pose;
102  };
103 
104  using PlatformKalmanFilterPtr = std::shared_ptr<PlatformKalmanFilter>;
105 
106 } // namespace memoryx
memoryx::PlatformKalmanFilter::state
Gaussian state
Definition: PlatformKalmanFilter.h:99
memoryx::PlatformKalmanFilter::transformPose
Eigen::Vector4d transformPose(const Eigen::Vector3d &pose) const
Definition: PlatformKalmanFilter.cpp:151
KalmanFilter
Definition: KalmanFilter.h:28
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
memoryx::PlatformKalmanFilter::filter
KalmanFilter filter
Definition: PlatformKalmanFilter.h:98
memoryx::PlatformKalmanFilter::getOrientation
double getOrientation() const
Definition: PlatformKalmanFilter.cpp:124
memoryx::PlatformKalmanFilter::getCovariance
Eigen::Matrix3d getCovariance() const
Covariance matrix of the current belief of the state.
Definition: PlatformKalmanFilter.cpp:130
memoryx::PlatformKalmanFilter
This class is a convenience class for a holonomic platform using a Kalman filter.
Definition: PlatformKalmanFilter.h:37
memoryx::PlatformKalmanFilter::getPosition
Eigen::Vector2d getPosition() const
Definition: PlatformKalmanFilter.cpp:118
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:855
memoryx::PlatformKalmanFilter::update
void update(double x, double y, double alpha)
Performs the update-step of the Kalman filter.
Definition: PlatformKalmanFilter.cpp:101
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
memoryx::PlatformKalmanFilter::getPose
const Eigen::Vector3d & getPose() const
Global pose of the holonomic platform.
Definition: PlatformKalmanFilter.cpp:112
KalmanFilter.h
memoryx::PlatformKalmanFilterPtr
std::shared_ptr< PlatformKalmanFilter > PlatformKalmanFilterPtr
Definition: PlatformKalmanFilter.h:104
memoryx::PlatformKalmanFilter::PlatformKalmanFilter
PlatformKalmanFilter(Eigen::Vector2d initialPosition, double initialRotation, double translationSensorStdDev=100.0, double rotationSensorStdDev=0.1, double translationVelocitySensorStdDev=1., double rotationVelocitySensorStdDev=1.)
PlatformKalmanFilter.
Definition: PlatformKalmanFilter.cpp:31
memoryx::PlatformKalmanFilter::setFilter
void setFilter(const KalmanFilter &value)
Change the internal Kalman Filter.
Definition: PlatformKalmanFilter.cpp:145
memoryx::PlatformKalmanFilter::pose
Eigen::Vector3d pose
Definition: PlatformKalmanFilter.h:101
Gaussian
Definition: Gaussian.h:50
memoryx::PlatformKalmanFilter::motionNoise
Gaussian motionNoise
Definition: PlatformKalmanFilter.h:100
memoryx::PlatformKalmanFilter::predict
void predict(double velX, double velY, double velTheta, const IceUtil::Time &deltaT)
Performs the predict-step of the Kalman filter.
Definition: PlatformKalmanFilter.cpp:69
memoryx::PlatformKalmanFilter::getFilter
const KalmanFilter & getFilter() const
Definition: PlatformKalmanFilter.cpp:139
memoryx::PlatformKalmanFilter::inverseTransformPose
Eigen::Vector3d inverseTransformPose(const Eigen::Vector4d &pose) const
Definition: PlatformKalmanFilter.cpp:161