英文:
Invalid size when Initializing Vector4f
问题
当我尝试在ROS / PCL中运行此行时,我收到以下错误:
Eigen::Vector4f normalized(3,1);
我得到以下错误信息:
/usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:281:
void Eigen::PlainObjectBase<Derived>::resize(Eigen::Index, Eigen::Index)
[with Derived = Eigen::Matrix<float, 4, 1>; Eigen::Index = long int]:
Assertion
`(!(RowsAtCompileTime!=Dynamic) || (rows==RowsAtCompileTime)) &&
(!(ColsAtCompileTime!=Dynamic) || (cols==ColsAtCompileTime)) &&
(!(RowsAtCompileTime==Dynamic && MaxRowsAtCompileTime!=Dynamic) ||
(rows<=MaxRowsAtCompileTime)) && (!(ColsAtCompileTime==Dynamic &&
MaxColsAtCompileTime!=Dynamic) || (cols<=MaxColsAtCompileTime)) && rows>=0 && cols>=0 &&
"Invalid sizes when resizing a matrix or array."' failed.
Aborted (core dumped)
我使用的是Ubuntu 20.04
,Eigen 3.3.7
。
请问我应该如何解决这个问题?提前感谢。
英文:
When I try to run this line in ROS / PCL
Eigen::Vector4f normalized(3,1);
I get the following Error:
/usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:281:
void Eigen::PlainObjectBase<Derived>::resize(Eigen::Index, Eigen::Index)
[with Derived = Eigen::Matrix<float, 4, 1>; Eigen::Index = long int]:
Assertion
`(!(RowsAtCompileTime!=Dynamic) || (rows==RowsAtCompileTime)) &&
(!(ColsAtCompileTime!=Dynamic) || (cols==ColsAtCompileTime)) &&
(!(RowsAtCompileTime==Dynamic && MaxRowsAtCompileTime!=Dynamic) ||
(rows<=MaxRowsAtCompileTime)) && (!(ColsAtCompileTime==Dynamic &&
MaxColsAtCompileTime!=Dynamic) || (cols<=MaxColsAtCompileTime)) && rows>=0 && cols>=0 &&
"Invalid sizes when resizing a matrix or array."' failed.
Aborted (core dumped)
I'm using Ubuntu 20.04
, Eigen 3.3.7
.
Can you please tell me how can I solve that? thanks in advance.
答案1
得分: 0
@Homer512解释的解决方案是:
normal.normalized();
英文:
The solution as explained by @Homer512 is:
normal.normalized();
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论