Skip to content

Commit

Permalink
PathCrossingDetector - added safety guards in detect
Browse files Browse the repository at this point in the history
  • Loading branch information
rayvburn committed Jan 19, 2024
1 parent f521773 commit 6af249f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/path_crossing_detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ bool PathCrossingDetector::detect(
auto traj_robot_poses = traj_robot.getPoses();

for (const auto& traj_person: traj_people) {
// velocity data is required for further calculations
if (traj_person.getVelocities().empty()) {
continue;
}

auto vel_person = traj_person.getVelocities().front();
double speed_person = std::hypot(vel_person.getX(), vel_person.getY());

Expand All @@ -64,6 +69,9 @@ bool PathCrossingDetector::detect(

// iterator must be referenced to an allocated container
auto traj_person_poses = traj_person.getPoses();
if (traj_person_poses.empty()) {
continue;
}

auto robot_pose_it = traj_robot_poses.cbegin();
auto person_pose_it = traj_person_poses.cbegin();
Expand Down

0 comments on commit 6af249f

Please sign in to comment.