Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test fixes to Ogre2.2 branch #279

Merged
merged 2 commits into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions test/integration/gpu_rays.cc
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,13 @@ void GpuRaysTest::RaysUnitBox(const std::string &_renderEngine)
// rays caster 1 should see box01 and box02
EXPECT_NEAR(scan[mid], expectedRangeAtMidPointBox1, LASER_TOL);
EXPECT_NEAR(scan[0], expectedRangeAtMidPointBox2, LASER_TOL);
EXPECT_DOUBLE_EQ(scan[last], ignition::math::INF_D);
EXPECT_FLOAT_EQ(scan[last], ignition::math::INF_F);

// rays cater should see box01 with laser retro value set to laserRetro1
// and box02 with laser retro value set to laserRetro2
EXPECT_NEAR(scan[mid+1], laserRetro1, 5.0);
EXPECT_NEAR(scan[0+1], laserRetro2, 5.0);
EXPECT_DOUBLE_EQ(scan[last+1], 0.0);
EXPECT_FLOAT_EQ(scan[last+1], 0.0);

// Verify rays caster 2 range readings
// listen to new gpu rays frames
Expand All @@ -308,9 +308,9 @@ void GpuRaysTest::RaysUnitBox(const std::string &_renderEngine)
gpuRays2->Copy(scan2);

// Only box01 should be visible to rays caster 2
EXPECT_DOUBLE_EQ(scan2[0], maxRange);
EXPECT_FLOAT_EQ(scan2[0], maxRange);
EXPECT_NEAR(scan2[mid], expectedRangeAtMidPointBox1, LASER_TOL);
EXPECT_DOUBLE_EQ(scan2[last], maxRange);
EXPECT_FLOAT_EQ(scan2[last], maxRange);

// Move all boxes out of range
visualBox1->SetWorldPosition(
Expand All @@ -325,10 +325,10 @@ void GpuRaysTest::RaysUnitBox(const std::string &_renderEngine)
gpuRays2->Copy(scan2);

for (int i = 0; i < gpuRays->RayCount(); ++i)
EXPECT_DOUBLE_EQ(scan[i * 3], ignition::math::INF_D);
EXPECT_FLOAT_EQ(scan[i * 3], ignition::math::INF_F);

for (int i = 0; i < gpuRays2->RayCount(); ++i)
EXPECT_DOUBLE_EQ(scan2[i * 3], maxRange);
EXPECT_FLOAT_EQ(scan2[i * 3], maxRange);

c.reset();

Expand Down Expand Up @@ -442,10 +442,10 @@ void GpuRaysTest::LaserVertical(const std::string &_renderEngine)
angleStep += vAngleStep;

// check that the values in the extremes are infinity
EXPECT_DOUBLE_EQ(scan[i * hRayCount * channels],
ignition::math::INF_D);
EXPECT_DOUBLE_EQ(scan[(i * hRayCount + (hRayCount - 1)) * channels],
ignition::math::INF_D);
EXPECT_FLOAT_EQ(scan[i * hRayCount * channels],
ignition::math::INF_F);
EXPECT_FLOAT_EQ(scan[(i * hRayCount + (hRayCount - 1)) * channels],
ignition::math::INF_F);
}

// Move box out of range
Expand All @@ -461,8 +461,8 @@ void GpuRaysTest::LaserVertical(const std::string &_renderEngine)
{
for (int i = 0; i < gpuRays->RayCount(); ++i)
{
EXPECT_DOUBLE_EQ(scan[j * gpuRays->RayCount() * channels+ i * channels],
ignition::math::INF_D);
EXPECT_FLOAT_EQ(scan[j * gpuRays->RayCount() * channels+ i * channels],
ignition::math::INF_F);
}
}

Expand Down Expand Up @@ -629,7 +629,7 @@ void GpuRaysTest::RaysParticles(const std::string &_renderEngine)
EXPECT_NEAR(expectedRangeAtMidPointBox2, scan[0], LASER_TOL);

// sensor should not see box03 as it is out of range
EXPECT_DOUBLE_EQ(ignition::math::INF_D, scan[last]);
EXPECT_DOUBLE_EQ(ignition::math::INF_F, scan[last]);
}

// there should be at least one hit
Expand Down Expand Up @@ -667,7 +667,7 @@ void GpuRaysTest::RaysParticles(const std::string &_renderEngine)
EXPECT_NEAR(expectedRangeAtMidPointBox2, scan[0], LASER_TOL);

// sensor should not see box03 as it is out of range
EXPECT_DOUBLE_EQ(ignition::math::INF_D, scan[last]);
EXPECT_DOUBLE_EQ(ignition::math::INF_F, scan[last]);
}

// there should be at least one hit
Expand Down
36 changes: 18 additions & 18 deletions test/integration/lidar_visual.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,22 @@ void LidarVisualTest::Configure(const std::string &_renderEngine)
// The following tests all the getters and setters
{
lidarVis->SetMinVerticalAngle(0.1);
EXPECT_NEAR(lidarVis->MinVerticalAngle(), 0.1, 1e-6);
EXPECT_DOUBLE_EQ(lidarVis->MinVerticalAngle(), 0.1);

lidarVis->SetMaxVerticalAngle(251.20);
EXPECT_NEAR(lidarVis->MaxVerticalAngle(), 251.20, 1e-6);
EXPECT_DOUBLE_EQ(lidarVis->MaxVerticalAngle(), 251.20);

lidarVis->SetMinRange(0.05);
EXPECT_NEAR(lidarVis->MinRange(), 0.05, 1e-6);
EXPECT_DOUBLE_EQ(lidarVis->MinRange(), 0.05);

lidarVis->SetMaxRange(105.20);
EXPECT_NEAR(lidarVis->MaxRange(), 105.20, 1e-6);
EXPECT_DOUBLE_EQ(lidarVis->MaxRange(), 105.20);

lidarVis->SetMinHorizontalAngle(-1.513);
EXPECT_NEAR(lidarVis->MinHorizontalAngle(), -1.513, 1e-6);
lidarVis->SetMinHorizontalAngle(-1.5136);
EXPECT_DOUBLE_EQ(lidarVis->MinHorizontalAngle(), -1.5136);

lidarVis->SetMaxHorizontalAngle(2.513);
EXPECT_NEAR(lidarVis->MaxHorizontalAngle(), 2.513, 1e-6);
EXPECT_DOUBLE_EQ(lidarVis->MaxHorizontalAngle(), 2.513);

lidarVis->SetHorizontalRayCount(360);
EXPECT_EQ(lidarVis->HorizontalRayCount(), 360u);
Expand Down Expand Up @@ -319,7 +319,7 @@ void LidarVisualTest::RaysUnitBox(const std::string &_renderEngine)
// rays caster values received from lidar should see box01 and box02
EXPECT_NEAR(pts_back[mid], expectedRangeAtMidPointBox1, LASER_TOL);
EXPECT_NEAR(pts_back[0], expectedRangeAtMidPointBox2, LASER_TOL);
EXPECT_DOUBLE_EQ(pts_back[last], ignition::math::INF_D);
EXPECT_FLOAT_EQ(pts_back[last], ignition::math::INF_F);

// Verify rays caster 2 range readings
// listen to new gpu rays frames
Expand All @@ -343,9 +343,9 @@ void LidarVisualTest::RaysUnitBox(const std::string &_renderEngine)
std::vector<double> pts_back2 = lidarVis2->Points();

// Only box01 should be visible to rays caster 2
EXPECT_DOUBLE_EQ(pts_back2[0], maxRange);
EXPECT_FLOAT_EQ(pts_back2[0], maxRange);
EXPECT_NEAR(pts_back2[mid], expectedRangeAtMidPointBox1, LASER_TOL);
EXPECT_DOUBLE_EQ(pts_back2[last], maxRange);
EXPECT_FLOAT_EQ(pts_back2[last], maxRange);

// Move all boxes out of range
visualBox1->SetWorldPosition(
Expand Down Expand Up @@ -378,10 +378,10 @@ void LidarVisualTest::RaysUnitBox(const std::string &_renderEngine)
}

for (unsigned int i = 0; i < lidarVis->HorizontalRayCount(); ++i)
EXPECT_DOUBLE_EQ(pts[i], ignition::math::INF_D);
EXPECT_FLOAT_EQ(pts[i], ignition::math::INF_F);

for (unsigned int i = 0; i < lidarVis->HorizontalRayCount(); ++i)
EXPECT_DOUBLE_EQ(pts2[i], maxRange);
EXPECT_FLOAT_EQ(pts2[i], maxRange);

c.reset();

Expand Down Expand Up @@ -518,10 +518,10 @@ void LidarVisualTest::LaserVertical(const std::string &_renderEngine)
angleStep += vAngleStep;

// check that the values in the extremes are infinity
EXPECT_DOUBLE_EQ(pts[i * hRayCount ],
ignition::math::INF_D);
EXPECT_DOUBLE_EQ(pts[(i * hRayCount + (hRayCount - 1))],
ignition::math::INF_D);
EXPECT_FLOAT_EQ(pts[i * hRayCount ],
ignition::math::INF_F);
EXPECT_FLOAT_EQ(pts[(i * hRayCount + (hRayCount - 1))],
ignition::math::INF_F);
}

// Move box out of range
Expand All @@ -548,8 +548,8 @@ void LidarVisualTest::LaserVertical(const std::string &_renderEngine)
{
for (unsigned int i = 0; i < lidarVis->HorizontalRayCount(); ++i)
{
EXPECT_DOUBLE_EQ(pts[j * lidarVis->HorizontalRayCount()+ i],
ignition::math::INF_D);
EXPECT_FLOAT_EQ(pts[j * lidarVis->HorizontalRayCount()+ i],
ignition::math::INF_F);
}
}

Expand Down