PoseManifoldGaussian.h
Go to the documentation of this file.
1#pragma once
2
3#include <Eigen/Core>
4#include <Eigen/Geometry>
5
6namespace armarx::objpose
7{
8
9 /**
10 * @brief A "gaussian" distribution in pose space (i.e. pose manifold).
11 *
12 * The mean is a specific pose, represented as 4x4 homogeneous matrix.
13 *
14 * The covariance is a 6 x 6 covariance matrix.
15 * The first 3 dimensions represent the position (translation) part,
16 * the second 3 dimensions represent the orientation (rotation) part.
17 * A column of the pure orientational part (lower right 3 x 3 matrix)
18 * is a scaled rotation axis, i.e. rotation axis whose norm is the
19 * rotation angle (in this case the "angle variance").
20 *
21 * Note that the lower left and upper right 3x3 parts of the covariance
22 * matrix can be non-zero.
23 */
25 {
26 public:
27 /// The mean (i.e. a pose).
28 Eigen::Matrix4f mean = Eigen::Matrix4f::Identity();
29 /// The covariance matrix.
31
32
33 public:
34 /// Get the pure positional part of the covariance matrix.
35 Eigen::Block<Eigen::Matrix<float, 6, 6>, 3, 3>
37 {
38 return covariance.block<3, 3>(0, 0);
39 }
40
41 Eigen::Block<const Eigen::Matrix<float, 6, 6>, 3, 3>
43 {
44 return covariance.block<3, 3>(0, 0);
45 }
46
47 /// Get the pure orientational part of the covariance matrix.
48 Eigen::Block<Eigen::Matrix<float, 6, 6>, 3, 3>
50 {
51 return covariance.block<3, 3>(3, 3);
52 }
53
54 Eigen::Block<const Eigen::Matrix<float, 6, 6>, 3, 3>
56 {
57 return covariance.block<3, 3>(3, 3);
58 }
59
60 struct Ellipsoid
61 {
62 Eigen::Vector3f center;
63 Eigen::Matrix3f orientation;
64 Eigen::Vector3f size;
65 };
66
67 /// Get the parameters of a 3D ellipsoid illustrating this gaussian.
69
70
71 /**
72 * @brief Get a column of the pure orientational covariance matrix
73 * as axis-angle rotation.
74 *
75 * @param index
76 * The column's index.
77 * @param global
78 * If true, rotate the axis by the mean orientation.
79 * @return
80 */
81 Eigen::AngleAxisf getScaledRotationAxis(int index, bool global = false) const;
82
83
84 /**
85 * @brief Transform this gaussian by the given transform (e.g. to another frame).
86 * @param transform The transform to apply.
87 * @return The transformed gaussian.
88 */
89 PoseManifoldGaussian getTransformed(const Eigen::Matrix4f& transform) const;
90
91 /**
92 * @brief Transform this gaussian from one base coordinate system to another one.
93 * @param fromFrame The original (current) base coordinate system' pose.
94 * @param toFrame The new base coordinate system' pose.
95 * @return The same gaussian in thenew coordinate system.
96 */
97 PoseManifoldGaussian getTransformed(const Eigen::Matrix4f& fromFrame,
98 const Eigen::Matrix4f& toFrame) const;
99 };
100
101} // namespace armarx::objpose
uint8_t index
auto transform(const Container< InputT, Alloc > &in, OutputT(*func)(InputT const &)) -> Container< OutputT, typename std::allocator_traits< Alloc >::template rebind_alloc< OutputT > >
Convenience function (with less typing) to transform a container of type InputT into the same contain...
Definition algorithm.h:351
A "gaussian" distribution in pose space (i.e.
Eigen::Block< Eigen::Matrix< float, 6, 6 >, 3, 3 > positionCovariance()
Get the pure positional part of the covariance matrix.
Eigen::Block< const Eigen::Matrix< float, 6, 6 >, 3, 3 > orientationCovariance() const
Eigen::Matrix4f mean
The mean (i.e. a pose).
Eigen::Block< const Eigen::Matrix< float, 6, 6 >, 3, 3 > positionCovariance() const
Eigen::Block< Eigen::Matrix< float, 6, 6 >, 3, 3 > orientationCovariance()
Get the pure orientational part of the covariance matrix.
PoseManifoldGaussian getTransformed(const Eigen::Matrix4f &transform) const
Transform this gaussian by the given transform (e.g.
Eigen::AngleAxisf getScaledRotationAxis(int index, bool global=false) const
Get a column of the pure orientational covariance matrix as axis-angle rotation.
Ellipsoid getPositionEllipsoid() const
Get the parameters of a 3D ellipsoid illustrating this gaussian.
Eigen::Matrix< float, 6, 6 > covariance
The covariance matrix.