Skip to content

Commit 6a9af31

Browse files
committed
add check for within bounds
1 parent 5b2d347 commit 6a9af31

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ed_sensor_integration/include/ed/kinect/fitter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ class Fitter
233233

234234
/**
235235
* @brief checkExpectedBeamThroughEntity checks if the expected center beam passes through the entity. If
236-
* not: something went wrong
236+
* not: throw a fitter error
237237
* @param model_ranges
238238
* @param entity
239239
* @param sensor_pose_xya
240-
* @param expected_center_beam
240+
* @param expected_center_beam expected index of the beam through the center of the object. range: any int. indices outside bounds will also throw an error.
241241
*/
242242
void checkExpectedBeamThroughEntity(const std::vector<double> &model_ranges, ed::EntityConstPtr entity,
243243
const geo::Pose3D &sensor_pose_xya, const int expected_center_beam) const;

ed_sensor_integration/src/kinect/fitter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ void Fitter::checkExpectedBeamThroughEntity(const std::vector<double>& model_ran
463463
std::vector<int> expected_identifiers(nr_data_points_, 0);
464464
renderEntity(entity, sensor_pose_xya, 1, expected_ranges, expected_identifiers);
465465

466-
if (expected_identifiers[expected_center_beam] != 1) // expected center beam MUST contain the rendered model
466+
if (expected_center_beam < 0 || expected_center_beam >= nr_data_points_ || expected_identifiers[expected_center_beam] != 1) // expected center beam MUST contain the rendered model
467467
throw FitterError("Expected beam does not go through entity");
468468
}
469469

0 commit comments

Comments
 (0)