【发布时间】:2020-06-27 08:25:25
【问题描述】:
我想将一个向量分配给一个动态大小的矩阵。如以下代码:
Eigen::Vector3f VectorCam; // Vector in camera frame
Eigen::MatrixXf VectorsCam; // Matrix contains the vectors
for (int i=0; i<=theta1.size(); i++)
{
std::cout << "I'm In theta1.size for loop" << std::endl;
VectorCam << sin(theta1[i]), sin(theta2[i]), cos(theta1[i])*cos(theta2[i]);
std::cout << "theta1.size is:" << theta1.size() << std::endl;
std::cout << VectorCam << std::endl;
VectorsCam.col(i) = VectorCam; // Matrix of Camera Vectors
std::cout << "Vectorscam" << VectorsCam << std::endl;
}
在终端中我得到了这个(低于 #### )!知道 for 循环仍在第一次运行中,它应该在退出之前运行至少 2 次!我认为问题出在 VectorsCam.col(i)
########
我在 theta1.size for 循环中
theta1.size 是:1
1
1
7.82347e-10
visual_servo_node: /usr/include/eigen3/Eigen/src/Core/Block.h:123: Eigen::Block
【问题讨论】: