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
32namespace 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
Eigen::Vector3d inverseTransformPose(const Eigen::Vector4d &pose) const
const KalmanFilter & getFilter() const
Eigen::Vector4d transformPose(const Eigen::Vector3d &pose) const
void predict(double velX, double velY, double velTheta, const IceUtil::Time &deltaT)
Performs the predict-step of the Kalman filter.
PlatformKalmanFilter(Eigen::Vector2d initialPosition, double initialRotation, double translationSensorStdDev=100.0, double rotationSensorStdDev=0.1, double translationVelocitySensorStdDev=1., double rotationVelocitySensorStdDev=1.)
PlatformKalmanFilter.
const Eigen::Vector3d & getPose() const
Global pose of the holonomic platform.
void setFilter(const KalmanFilter &value)
Change the internal Kalman Filter.
void update(double x, double y, double alpha)
Performs the update-step of the Kalman filter.
Eigen::Matrix3d getCovariance() const
Covariance matrix of the current belief of the state.
This file offers overloads of toIce() and fromIce() functions for STL container types.
VirtualRobot headers.
std::shared_ptr< PlatformKalmanFilter > PlatformKalmanFilterPtr