ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

The relevant bit of the assertion is Assertion index >= 0 && index < size()' failed.

Before you access an element of the VectorXd, you need to resize the VectorXd to be large enough. Another option, since you know the number of elements that you want from the angular velocity, is to use a fixed size vector such as Vector3d . That would not require a .resize() call and may be faster than the dynamically sized VectorXd.

Here's a snippet that reproduces your error:

#include <Eigen/Geometry>

int main(int argc, char** argv)
{

   Eigen::VectorXd vec;
   //vec.resize(1);
   vec(0) = 1.0;

   return 0;
}

Commenting in that vec.resize(1) allows it to compile and run fine.