MCPcopy Create free account
hub / github.com/CCNYRoboticsLab/imu_tools / checkQuaternionValidity

Method checkQuaternionValidity

rviz_imu_plugin/src/imu_acc_visual.cpp:192–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192bool ImuAccVisual::checkQuaternionValidity(
193 const sensor_msgs::msg::Imu::ConstSharedPtr msg)
194{
195 // REP-145: orientation_covariance[0] == -1 signals "not estimated".
196 if (msg->orientation_covariance[0] == -1.0)
197 {
198 return false;
199 }
200 double x = msg->orientation.x, y = msg->orientation.y,
201 z = msg->orientation.z, w = msg->orientation.w;
202 // Near-zero length indicates the default (0, 0, 0, 0) quaternion,
203 // which would silently zero out any vector multiplication.
204 if (std::sqrt(x * x + y * y + z * z + w * w) < 0.0001)
205 {
206 return false;
207 }
208 return true;
209}
210
211} // namespace rviz_imu_plugin

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected