Eigen trouble initializing Quaterniond from Angleaxisd

Multi tool use


Eigen trouble initializing Quaterniond from Angleaxisd
I am trying to set the value of an Eigen::Quaterniond object from an Eigen::AngleAxisd, as shown here.
I keep getting a "stack smashing" error:
Running main() from gmock_main.cc
*** stack smashing detected ***: <my executable> terminated
Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
when I run this simple test:
TEST_F(UtilTestCase,testEigenQuaternionFromAngleAxis)
{
Eigen::AngleAxisd veh2sensor(M_PI_2, Eigen::Vector3d::UnitZ());
Eigen::Quaterniond q_veh2sensor;
q_veh2sensor.setIdentity();
q_veh2sensor = veh2sensor;
EXPECT_NEAR(q_veh2sensor.x(),0.0,1e-6);
EXPECT_NEAR(q_veh2sensor.y(),0.0,1e-6);
EXPECT_NEAR(q_veh2sensor.z(),1.0 * sin(M_PI_4),1e-6);
EXPECT_NEAR(q_veh2sensor.w(),1.0 * cos(M_PI_4),1e-6);
}
When I run in the debugger, the code always fails at the line where I assign from veh2sensor to q_veh2sensor. In other words:
I somehow get a stack smashing error when attempting to convert between an AngleAxisd and a Quaterniond using the operator= method of the Quaterniond class.
Why on earth is this the case?
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.