Skip to content

Commit

Permalink
AttitudeControlTest: fix adaptAntipodal() function
Browse files Browse the repository at this point in the history
  • Loading branch information
MaEtUgR committed Oct 14, 2019
1 parent 83dfa22 commit bb91db2
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/modules/mc_att_control/AttitudeControl/AttitudeControlTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,26 +72,20 @@ class AttitudeControlConvergenceTest : public ::testing::Test
rate_setpoint = rate_setpoint_new;
}

// we need to have reached the goal attitude
if (!(antipodal(_quat_state) == (antipodal(_quat_goal)))) {
antipodal(_quat_state).print();
antipodal(_quat_goal).print();
}

EXPECT_TRUE(antipodal(_quat_state) == antipodal(_quat_goal));
EXPECT_EQ(adaptAntipodal(_quat_state), adaptAntipodal(_quat_goal));
// it shouldn't have taken longer than an iteration timeout to converge
EXPECT_GT(i, 0);
}

Quatf antipodal(const Quatf q)
Quatf adaptAntipodal(const Quatf q)
{
for (int i = 0; i < 1; i++) {
for (int i = 0; i < 4; i++) {
if (fabs(q(i)) > FLT_EPSILON) {
return q * math::signNoZero(q(i));
return q * math::sign(q(i));
}
}

return Quatf(NAN, NAN, NAN, NAN);
return q;
}

AttitudeControl _attitude_control;
Expand Down

0 comments on commit bb91db2

Please sign in to comment.