1 位姿变换相关
使用示例:
//位姿
Eigen::Vector3d translation(data[6],data[7],data[8]);//3*1向量
Eigen::Quaterniond rotation(data[9],data[10],data[11],data[12]);
Eigen::Isometry3d pose(rotation.normalized());
pose.pretranslate(translation);
(1) Eigen::Isometry3d
用于表示等距位姿变换或者说是构造等距变换矩阵(4*4的矩阵),包括旋转和平移。等距变换下长度(两点距离)、角度(两线夹角)和面积不变
示例:
std::vector<Eigen::Isometry3d> submap_poses;
(2)Eigen::Vector3d
类型为double,3*1(3
×1
vector of type double),可以用于表示平移变换
Eigen::Vector3d translation(data[6],data[7],data[8]);//3*1向量
(3)
Eigen::Quaterniond
用于表示四元数,组成元素顺序为:w,x,y,z;
有两种数据类型供选择:float和double
Eigen::Quaterniond rotation(data[9],data[10],data[11],data[12]);
分割线 2022年5月14日前------------------------------------------------------------------------------------
示例1:
Eigen::Matrix<unsigned char, Eigen::Dynamic, Eigen::Dynamic> binary = global_map.get("obstacle").cast<unsigned char>();
Eigen::Dynamic
const int Eigen::Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time, and that instead the value is stored in some runtime variable.----这个值在编译时是不知道正数(例如大小),而是将值存储在某个运行时变量中。
Changing the value of Dynamic breaks the ABI, as Dynamic is often used as a template parameter for Matrix.----更改 Dynamic 的值会破坏 ABI,因为 Dynamic 通常用作 Matrix 的模板参数。
Eigen::Matrix
template<typename Scalar_, int Rows_, int Cols_, int Options_, int MaxRows_, int MaxCols_>
class Eigen::Matrix< Scalar_, Rows_, Cols_, Options_, MaxRows_, MaxCols_ >
必选参数
Scalar_ | Numeric type, e.g. float, double, int or std::complex<float>. User defined scalar types are supported as well (see here). ----数据类型 |
Rows_ | Number of rows, or Dynamic ----行数 |
Cols_ | Number of columns, or Dynamic ----列数 |
可选参数
Options_ | A combination of either RowMajor or ColMajor, and of either AutoAlign or DontAlign. The former controls storage order, and defaults to column-major. The latter controls alignment, which is required for vectorization. It defaults to aligning matrices except for fixed sizes that aren't a multiple of the packet size. RowMajor 或 ColMajor 以及 AutoAlign 或 DontAlign 的组合。 前者控制存储顺序,默认为列优先。 后者控制对齐,这是矢量化所必需的。 它默认对齐矩阵,除了不是数据包大小倍数的固定大小。 |
MaxRows_ | Maximum number of rows. Defaults to Rows_ (note). 最大行数,默认和必需参数里面的Rows相同 |
MaxCols_ | Maximum number of columns. Defaults to Cols_ (note). 最大列数,默认和必需参数里面的Cols相同 |
Eigen::Translation::cast ( )
----将当前数据类型投向指定的新数据类型
Returns
*this with scalar type casted to NewScalarTypeNote that if NewScalarType is equal to the current scalar type of *this then this function smartly returns a const reference to *this.
附录:
Eigen官方参考链接:Eigen: Eigen Namespace Reference
eigen构造变换矩阵:
https://blog.csdn.net/HelloJinYe/article/details/106926187
@meng