15 #include <gtest/gtest.h>
43 return std::transform_reduce(
44 landmark_probs.cbegin(), landmark_probs.cend(), 1.0, std::multiplies{}, [](
const double v) { return v; });
48 LandmarkModelParam ret;
49 ret.sigma_range = 1.0;
70 struct LandmarkSensorModelTests :
public ::testing::Test {};
72 using LandmarkSensorModelTestsTypes = ::testing::Types<Sensor2D, Sensor3D>;
76 TYPED_TEST(LandmarkSensorModelTests, BullsEyeDetection) {
80 const auto state_weighting_function = sensor_model({{{1.0, 2.0, 0.0}, 0}});
81 const auto pose = get_robot_pose_in_world<typename TypeParam::state_type>();
85 TYPED_TEST(LandmarkSensorModelTests, MapUpdate) {
90 const auto state_weighting_function = sensor_model({{{1.0, 2.0, 0.0}, 0}});
91 const auto pose = get_robot_pose_in_world<typename TypeParam::state_type>();
93 ASSERT_NO_THROW(sensor_model.update_map(std::move(map_2)));
97 TYPED_TEST(LandmarkSensorModelTests, MultipleBullsEyeDetections) {
99 const auto sensor_model = TypeParam{
104 {{1.0, -2.0, 0.0}, 0},
105 {{1.0, -0.0, 0.0}, 1},
106 {{2.0, -1.0, 0.0}, 2},
107 {{0.0, -1.0, 0.0}, 3},
110 const auto state_weighting_function = sensor_model({
111 {{+1.0, +0.0, 0.0}, 0},
112 {{-1.0, +0.0, 0.0}, 1},
113 {{+0.0, +1.0, 0.0}, 2},
114 {{+0.0, -1.0, 0.0}, 3},
117 const auto pose = get_robot_pose_in_world<typename TypeParam::state_type>();
121 TYPED_TEST(LandmarkSensorModelTests, OneStdInRange) {
122 const auto pose = get_robot_pose_in_world<typename TypeParam::state_type>();
128 auto state_weighting_function = sensor_model({{{10.0, 0.0, 0.0}, 0}});
133 auto state_weighting_function = sensor_model({{{9.0, 0.0, 0.0}, 0}});
138 auto state_weighting_function = sensor_model({{{11.0, 0.0, 0.0}, 0}});
143 TYPED_TEST(LandmarkSensorModelTests, OneStdInBearing) {
144 const auto pose = get_robot_pose_in_world<typename TypeParam::state_type>();
150 auto state_weighting_function = sensor_model({{{10.0, 0.0, 0.0}, 0}});
155 auto state_weighting_function = sensor_model({{{0.0, 10.0, 0.0}, 0}});
160 auto state_weighting_function = sensor_model({{{0.0, -10.0, 0.0}, 0}});
165 TYPED_TEST(LandmarkSensorModelTests, NoSuchLandmark) {
166 const auto pose = get_robot_pose_in_world<typename TypeParam::state_type>();
170 auto state_weighting_function = sensor_model({{{0.0, 2.0, 0.0}, 88}});