Skip to content

Commit

Permalink
add check for within bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
PetervDooren committed Apr 13, 2022
1 parent 5b2d347 commit 6a9af31
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ed_sensor_integration/include/ed/kinect/fitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,11 @@ class Fitter

/**
* @brief checkExpectedBeamThroughEntity checks if the expected center beam passes through the entity. If
* not: something went wrong
* not: throw a fitter error
* @param model_ranges
* @param entity
* @param sensor_pose_xya
* @param expected_center_beam
* @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.
*/
void checkExpectedBeamThroughEntity(const std::vector<double> &model_ranges, ed::EntityConstPtr entity,
const geo::Pose3D &sensor_pose_xya, const int expected_center_beam) const;
Expand Down
2 changes: 1 addition & 1 deletion ed_sensor_integration/src/kinect/fitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ void Fitter::checkExpectedBeamThroughEntity(const std::vector<double>& model_ran
std::vector<int> expected_identifiers(nr_data_points_, 0);
renderEntity(entity, sensor_pose_xya, 1, expected_ranges, expected_identifiers);

if (expected_identifiers[expected_center_beam] != 1) // expected center beam MUST contain the rendered model
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
throw FitterError("Expected beam does not go through entity");
}

Expand Down

0 comments on commit 6a9af31

Please sign in to comment.