Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wp-statistics domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /www/wwwroot/robotattractor/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the jetpack domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /www/wwwroot/robotattractor/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the updraftplus domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /www/wwwroot/robotattractor/wp-includes/functions.php on line 6114
自动驾驶基础知识——Eigen – 机器人家园

1 Eigen

  在Apollo自动驾驶项目中使用了Eigen实现一些坐标变换和矩阵运算,常用的操作如下。

1.1 行数和列数

  mat.rows()是矩阵的行数;
  mat.cols()是矩阵的列数;
  注意这两个成员函数都是输出,所以括号里不需要给任何输入。

1.2 取第几行第几列

  mat.row(i)是取第 i 行的所有元素;
  mat.col(i)是取第 i 列的所有元素;
  注意这两个与前面的获取行列数不一样,括号里要给行号列号。这两个非常容易记混。
  而且如果下标访问越界程序会直接退出,所以要小心。

1.3 std::vectorEigen::VectorXd

  下面是std::vector转换成Eigen::VectorXd的例子,参考自open_space_trajectory_optimizer.cc

std::vector x(10,0);
Eigen::VectorXd y = Eigen::Map(x.data(), x.size());
1.4 Eigen::VectorXdstd::vector

  下面是Eigen::VectorXd转换成std::vector的例子,参考自open_space_trajectory_optimizer.cc

Eigen::VectorXd x;
std::vector y(&x[0], x.data()+x.rows());

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注