Skip to content

Commit

Permalink
added == operator for VisionTargetSim
Browse files Browse the repository at this point in the history
  • Loading branch information
r4stered committed Nov 26, 2023
1 parent d43a124 commit 63c4caa
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ class VisionTargetSim {
return pose.Translation().Norm() < right.pose.Translation().Norm();
}

bool operator==(const VisionTargetSim& other) const {
return units::math::abs(pose.Translation().X() -
other.GetPose().Translation().X()) < 1_in &&
units::math::abs(pose.Translation().Y() -
other.GetPose().Translation().Y()) < 1_in &&
units::math::abs(pose.Translation().Z() -
other.GetPose().Translation().Z()) < 1_in &&
units::math::abs(pose.Rotation().Degrees() -
other.GetPose().Degrees()) < 1_deg &&
pose.model.GetIsPlanar() == other.model.GetIsPlanar();
}

private:
frc::Pose3d pose;
TargetModel model;
Expand Down

0 comments on commit 63c4caa

Please sign in to comment.