MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / rotation_equal

Function rotation_equal

libraries/AP_Math/AP_Math.cpp:366–377  ·  view source on GitHub ↗

return true if two rotations are equivalent This copes with the fact that we have some duplicates, like ROLL_180_YAW_90 and PITCH_180_YAW_270 */

Source from the content-addressed store, hash-verified

364 This copes with the fact that we have some duplicates, like ROLL_180_YAW_90 and PITCH_180_YAW_270
365 */
366bool rotation_equal(enum Rotation r1, enum Rotation r2)
367{
368 if (r1 == r2) {
369 return true;
370 }
371 Vector3f v(1,2,3);
372 Vector3f v1 = v;
373 Vector3f v2 = v;
374 v1.rotate(r1);
375 v2.rotate(r2);
376 return (v1 - v2).length() < 0.001;
377}
378
379/*
380 * return a velocity correction (in m/s in NED) for a sensor's position given it's position offsets

Callers 2

TESTFunction · 0.85
test_rotation_duplicatesFunction · 0.85

Calls 2

rotateMethod · 0.45
lengthMethod · 0.45

Tested by 2

TESTFunction · 0.68
test_rotation_duplicatesFunction · 0.68