Skip to content

Commit

Permalink
Regenerate hashcode/equals/tostring
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 committed Sep 21, 2024
1 parent 5706dfe commit 4db7331
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
with:
python-version: 3.11
- name: Install wpiformat
run: pip3 install wpiformat==2024.37
run: pip3 install wpiformat==2024.41
- name: Run
run: wpiformat
- name: Check output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ public int hashCode() {
temp = Double.doubleToLongBits(skew);
result = prime * result + (int) (temp ^ (temp >>> 32));
result = prime * result + fiducialId;
result = prime * result + objDetectId;
result = prime * result + Float.floatToIntBits(objDetectConf);
result = prime * result + ((bestCameraToTarget == null) ? 0 : bestCameraToTarget.hashCode());
result = prime * result + ((altCameraToTarget == null) ? 0 : altCameraToTarget.hashCode());
temp = Double.doubleToLongBits(poseAmbiguity);
Expand All @@ -202,6 +204,9 @@ public boolean equals(Object obj) {
if (Double.doubleToLongBits(area) != Double.doubleToLongBits(other.area)) return false;
if (Double.doubleToLongBits(skew) != Double.doubleToLongBits(other.skew)) return false;
if (fiducialId != other.fiducialId) return false;
if (objDetectId != other.objDetectId) return false;
if (Float.floatToIntBits(objDetectConf) != Float.floatToIntBits(other.objDetectConf))
return false;
if (bestCameraToTarget == null) {
if (other.bestCameraToTarget != null) return false;
} else if (!bestCameraToTarget.equals(other.bestCameraToTarget)) return false;
Expand All @@ -221,8 +226,7 @@ public boolean equals(Object obj) {

@Override
public String toString() {
return "PhotonTrackedTarget{"
+ "yaw="
return "PhotonTrackedTarget [yaw="
+ yaw
+ ", pitch="
+ pitch
Expand All @@ -232,11 +236,21 @@ public String toString() {
+ skew
+ ", fiducialId="
+ fiducialId
+ ", cameraToTarget="
+ ", objDetectId="
+ objDetectId
+ ", objDetectConf="
+ objDetectConf
+ ", bestCameraToTarget="
+ bestCameraToTarget
+ ", targetCorners="
+ ", altCameraToTarget="
+ altCameraToTarget
+ ", poseAmbiguity="
+ poseAmbiguity
+ ", minAreaRectCorners="
+ minAreaRectCorners
+ '}';
+ ", detectedCorners="
+ detectedCorners
+ "]";
}

public static final PhotonTrackedTargetProto proto = new PhotonTrackedTargetProto();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#include "photon/targeting/proto/MultiTargetPNPResultProto.h"

#include <vector>

#include "photon.pb.h"
#include "photon/targeting/proto/PNPResultProto.h"

Expand Down
1 change: 1 addition & 0 deletions photon-targeting/src/test/native/cpp/PacketTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#include <chrono>
#include <vector>

#include <units/angle.h>

Expand Down
4 changes: 0 additions & 4 deletions photonlib-cpp-examples/aimattarget/src/main/cpp/Robot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ void Robot::RobotPeriodic() {
auto start = frc::Timer::GetFPGATimestamp();
photon::PhotonPipelineResult result = camera.GetLatestResult();
auto end = frc::Timer::GetFPGATimestamp();

std::printf("DT is %.2f uS for %i targets\n",
units::microsecond_t(end - start).to<double>(),
result.GetTargets().size());
}

void Robot::TeleopPeriodic() {
Expand Down

0 comments on commit 4db7331

Please sign in to comment.