初始化 Vector4f 时出现无效尺寸。

huangapple go评论100阅读模式
英文:

Invalid size when Initializing Vector4f

问题

当我尝试在ROS / PCL中运行此行时,我收到以下错误:

  1. Eigen::Vector4f normalized(3,1);

我得到以下错误信息:

  1. /usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:281:
  2. void Eigen::PlainObjectBase<Derived>::resize(Eigen::Index, Eigen::Index)
  3. [with Derived = Eigen::Matrix<float, 4, 1>; Eigen::Index = long int]:
  4. Assertion
  5. `(!(RowsAtCompileTime!=Dynamic) || (rows==RowsAtCompileTime)) &&
  6. (!(ColsAtCompileTime!=Dynamic) || (cols==ColsAtCompileTime)) &&
  7. (!(RowsAtCompileTime==Dynamic && MaxRowsAtCompileTime!=Dynamic) ||
  8. (rows<=MaxRowsAtCompileTime)) && (!(ColsAtCompileTime==Dynamic &&
  9. MaxColsAtCompileTime!=Dynamic) || (cols<=MaxColsAtCompileTime)) && rows>=0 && cols>=0 &&
  10. "Invalid sizes when resizing a matrix or array."' failed.
  11. Aborted (core dumped)

我使用的是Ubuntu 20.04,Eigen 3.3.7

请问我应该如何解决这个问题?提前感谢。

英文:

When I try to run this line in ROS / PCL

  1. Eigen::Vector4f normalized(3,1);

I get the following Error:

  1. /usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:281:
  2. void Eigen::PlainObjectBase&lt;Derived&gt;::resize(Eigen::Index, Eigen::Index)
  3. [with Derived = Eigen::Matrix&lt;float, 4, 1&gt;; Eigen::Index = long int]:
  4. Assertion
  5. `(!(RowsAtCompileTime!=Dynamic) || (rows==RowsAtCompileTime)) &amp;&amp;
  6. (!(ColsAtCompileTime!=Dynamic) || (cols==ColsAtCompileTime)) &amp;&amp;
  7. (!(RowsAtCompileTime==Dynamic &amp;&amp; MaxRowsAtCompileTime!=Dynamic) ||
  8. (rows&lt;=MaxRowsAtCompileTime)) &amp;&amp; (!(ColsAtCompileTime==Dynamic &amp;&amp;
  9. MaxColsAtCompileTime!=Dynamic) || (cols&lt;=MaxColsAtCompileTime)) &amp;&amp; rows&gt;=0 &amp;&amp; cols&gt;=0 &amp;&amp;
  10. &quot;Invalid sizes when resizing a matrix or array.&quot;&#39; failed.
  11. 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解释的解决方案是:

  1. normal.normalized();
英文:

The solution as explained by @Homer512 is:

  1. normal.normalized();

huangapple
  • 本文由 发表于 2023年5月25日 03:37:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/76326886.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定