mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
ekf2-test: add flow unit test for negative distance
This commit is contained in:
parent
ddb9a5d0b9
commit
82ea544e8c
@ -71,3 +71,22 @@ TEST(FlowGenerated, distBottom0y)
|
||||
sym::ComputeFlowYInnovVarAndH(state.vector(), P, R, FLT_EPSILON, &innov_var, &H);
|
||||
EXPECT_GT(innov_var, 1e12);
|
||||
}
|
||||
|
||||
TEST(FlowGenerated, distBottomNeg)
|
||||
{
|
||||
// GIVEN: a small negative distance to the ground (singularity)
|
||||
StateSample state{};
|
||||
state.quat_nominal = Quatf();
|
||||
state.pos(2) = 1e-3f;
|
||||
|
||||
const float R = sq(radians(sq(0.5f)));
|
||||
SquareMatrixState P = createRandomCovarianceMatrix();
|
||||
|
||||
VectorState H;
|
||||
Vector2f innov_var;
|
||||
sym::ComputeFlowXyInnovVarAndHx(state.vector(), P, R, FLT_EPSILON, &innov_var, &H);
|
||||
EXPECT_GT(innov_var(0), 1e6);
|
||||
EXPECT_GT(innov_var(1), 1e6);
|
||||
sym::ComputeFlowYInnovVarAndH(state.vector(), P, R, FLT_EPSILON, &innov_var(1), &H);
|
||||
EXPECT_GT(innov_var(1), 1e6);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user