Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
040edb9
changed order of class variables to match the order of the constructor
ShmayaR Dec 22, 2025
dc1b5c5
changed getClosestObjectToPosition to be just. return statement. (tha…
ShmayaR Dec 22, 2025
b7940fe
cleaned calculateObjectDistanceRating
ShmayaR Dec 22, 2025
dbb4869
cleaned updateObjectPositions
ShmayaR Dec 22, 2025
3467107
this shouldnt be in the template
ShmayaR Dec 22, 2025
b7a14a2
renamed stuff
ShmayaR Dec 22, 2025
ca9bc12
Revert "cleaned updateObjectPositions"
ShmayaR Dec 22, 2025
9e66d23
got rid of stream
ShmayaR Dec 22, 2025
1173f30
Update ObjectDetectionCamera.java
ShmayaR Dec 22, 2025
3fe3d92
Update SimulationObjectDetectionCameraIO.java
ShmayaR Dec 22, 2025
f8e5c7a
added code to use more than one camera
ShmayaR Dec 22, 2025
98ab0c2
moved the object pose estimator to be under the pose estimator package
ShmayaR Dec 22, 2025
fb64741
reorganized pose estimation packages and classes
ShmayaR Dec 30, 2025
6bf5614
Merge branch 'main' into clean-object-detection
ShmayaR Dec 30, 2025
78cefa2
reformatted
ShmayaR Jan 1, 2026
295ebe8
extracted update object positions into a few functions to make more r…
ShmayaR Jan 1, 2026
fff101a
fixed incorrect condition
ShmayaR Jan 1, 2026
45ecfa2
java doc fix
ShmayaR Jan 1, 2026
ece1bda
update logic issue
ShmayaR Jan 1, 2026
251248e
reorganized obejct pose estimation to what it was before
ShmayaR Jan 5, 2026
06f7927
Merge branch 'main' into clean-object-detection
ShmayaR Jan 5, 2026
b131bcd
Update lib
ShmayaR Jan 5, 2026
e5d38b0
renaming and organizing
ShmayaR Jan 6, 2026
ffe948e
rename
ShmayaR Jan 6, 2026
a570776
removed distance rating
ShmayaR Jan 6, 2026
a3f401f
removed distance calcultation method
ShmayaR Jan 6, 2026
ea74422
more ranaming
ShmayaR Jan 6, 2026
bf047fa
changed updateObjectPositions to compare both cameras objects to the …
ShmayaR Jan 8, 2026
4ddf1a4
fixed issue
ShmayaR Jan 8, 2026
c90f8f3
made object updating function more efficient and separated into mor…
ShmayaR Jan 8, 2026
dd4e9bd
updated the function
ShmayaR Jan 10, 2026
3fe913e
updated function again
ShmayaR Jan 11, 2026
e81df9f
removed redundant function
ShmayaR Jan 11, 2026
687bef3
extracted into another function for readability
ShmayaR Jan 11, 2026
5f142dd
rename
ShmayaR Jan 11, 2026
471d800
fixed logic issue
ShmayaR Jan 11, 2026
e60a7ba
rename
ShmayaR Jan 11, 2026
a01fda9
added javadoc
ShmayaR Jan 11, 2026
ffc03a9
Merge branch 'main' into clean-object-detection
ShmayaR Jan 11, 2026
dd17786
fix
ShmayaR Jan 11, 2026
d607c89
fixed issue
ShmayaR Jan 11, 2026
d49a98a
extracted into separate functions
ShmayaR Jan 11, 2026
9ddfda6
fixed issue
ShmayaR Jan 11, 2026
b0e8f32
reverted to one camera
ShmayaR Jan 11, 2026
124ea0a
Update ObjectPoseEstimator.java
ShmayaR Jan 11, 2026
172bef1
Update ObjectPoseEstimator.java
ShmayaR Jan 11, 2026
b0fe9e0
changed functions to void
ShmayaR Jan 12, 2026
d6cff5a
added object checking before removing them
ShmayaR Jan 12, 2026
daa5a01
made functions void
ShmayaR Jan 12, 2026
ddd468c
added javadoc for class hashmap
ShmayaR Jan 12, 2026
ebd93d8
fixed javadoc
ShmayaR Jan 12, 2026
12ecdd2
added javadoc
ShmayaR Jan 12, 2026
c58b5f7
added function for updating position of discarded update
ShmayaR Jan 12, 2026
4e0068c
fix logic issue
ShmayaR Jan 12, 2026
3ef33a7
fixed logic issue
ShmayaR Jan 12, 2026
8104499
fix order so no crash
ShmayaR Jan 12, 2026
031c69c
clean
ShmayaR Jan 12, 2026
3499127
rename
ShmayaR Jan 12, 2026
456f1f8
reduced unnecessary processes
ShmayaR Jan 12, 2026
83cfa1e
Update ObjectPoseEstimator.java
ShmayaR Jan 12, 2026
77e2c55
Update ObjectPoseEstimator.java
ShmayaR Jan 12, 2026
3878d70
Update ObjectPoseEstimator.java
ShmayaR Jan 12, 2026
bb2bbd3
rename and javadoc edits
ShmayaR Jan 13, 2026
9ff0e06
moved double creation outside for loop
ShmayaR Jan 13, 2026
b8a1f3d
Merge branch 'main' into clean-object-detection
ShmayaR Jan 13, 2026
018d4cf
simplified logic
ShmayaR Jan 13, 2026
6477951
Update ObjectPoseEstimator.java
ShmayaR Jan 13, 2026
fcda610
Update ObjectDetectionCamera.java
ShmayaR Jan 13, 2026
43c1a89
Update ObjectPoseEstimator.java
ShmayaR Jan 13, 2026
5a799b2
mergggge
ShmayaR Jan 13, 2026
342eb19
sdfgh
ShmayaR Jan 13, 2026
330da69
Update lib
ShmayaR Jan 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/frc/trigon/lib
Submodule lib updated 0 files
2 changes: 2 additions & 0 deletions src/main/java/frc/trigon/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import frc.trigon.lib.hardware.RobotHardwareStats;
import frc.trigon.lib.hardware.phoenix6.Phoenix6Inputs;
import frc.trigon.robot.constants.RobotConstants;
import frc.trigon.robot.misc.simulatedfield.SimulationFieldHandler;
import org.littletonrobotics.junction.LogFileUtil;
import org.littletonrobotics.junction.LoggedRobot;
import org.littletonrobotics.junction.Logger;
Expand Down Expand Up @@ -59,6 +60,7 @@ public void testInit() {

@Override
public void simulationPeriodic() {
SimulationFieldHandler.update();
}

@Override
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/frc/trigon/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@
import frc.trigon.robot.constants.CameraConstants;
import frc.trigon.robot.constants.LEDConstants;
import frc.trigon.robot.constants.OperatorConstants;
import frc.trigon.robot.misc.objectdetectioncamera.ObjectPoseEstimator;
import frc.trigon.robot.misc.objectDetection.ObjectPoseEstimator;
import frc.trigon.robot.misc.simulatedfield.SimulatedGamePieceConstants;
import frc.trigon.robot.poseestimation.poseestimator.PoseEstimator;
import frc.trigon.robot.poseestimation.robotposeestimator.RobotPoseEstimator;
import frc.trigon.robot.subsystems.MotorSubsystem;
import frc.trigon.robot.subsystems.swerve.Swerve;
import org.littletonrobotics.junction.networktables.LoggedDashboardChooser;

public class RobotContainer {
public static final PoseEstimator ROBOT_POSE_ESTIMATOR = new PoseEstimator();
public static final RobotPoseEstimator ROBOT_POSE_ESTIMATOR = new RobotPoseEstimator();
public static final ObjectPoseEstimator OBJECT_POSE_ESTIMATOR = new ObjectPoseEstimator(
CameraConstants.OBJECT_POSE_ESTIMATOR_DELETION_THRESHOLD_SECONDS,
ObjectPoseEstimator.DistanceCalculationMethod.ROTATION_AND_TRANSLATION,
SimulatedGamePieceConstants.GamePieceType.GAME_PIECE_TYPE,
CameraConstants.OBJECT_DETECTION_CAMERA
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import frc.trigon.lib.utilities.flippable.FlippableRotation2d;
import frc.trigon.robot.RobotContainer;
import frc.trigon.robot.commands.commandfactories.GeneralCommands;
import frc.trigon.robot.misc.objectDetection.ObjectPoseEstimator;
import frc.trigon.robot.constants.AutonomousConstants;
import frc.trigon.robot.misc.objectdetectioncamera.ObjectPoseEstimator;
import frc.trigon.robot.misc.simulatedfield.SimulatedGamePieceConstants;
import frc.trigon.robot.subsystems.swerve.SwerveCommands;
import org.littletonrobotics.junction.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private boolean hasNoTrackedGamePiece() {
}

private void trackGamePiece() {
distanceFromTrackedGamePiece = RobotContainer.OBJECT_POSE_ESTIMATOR.hasObject() ?
distanceFromTrackedGamePiece = RobotContainer.OBJECT_POSE_ESTIMATOR.hasObjects() ?
calculateSelfRelativeDistanceFromBestGamePiece() :
null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import edu.wpi.first.math.geometry.Transform3d;
import edu.wpi.first.math.geometry.Translation3d;
import edu.wpi.first.math.util.Units;
import frc.trigon.robot.misc.objectdetectioncamera.ObjectDetectionCamera;
import frc.trigon.robot.misc.objectDetection.objectdetectioncamera.ObjectDetectionCamera;

public class CameraConstants {
private static final Transform3d ROBOT_CENTER_TO_OBJECT_DETECTION_CAMERA = new Transform3d(//TODO: AHAHAHAHAH
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package frc.trigon.robot.misc.objectdetectioncamera;
package frc.trigon.robot.misc.objectDetection;

import frc.trigon.robot.misc.simulatedfield.SimulatedGamePieceConstants;

public class ObjectDetectionCameraConstants {
public class ObjectDetectionConstants {
public static final int NUMBER_OF_GAME_PIECE_TYPES = SimulatedGamePieceConstants.GamePieceType.values().length;
static final double TRACKED_OBJECT_TOLERANCE_METERS = 0.12;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
package frc.trigon.robot.misc.objectDetection;

import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Transform2d;
import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.trigon.robot.RobotContainer;
import frc.trigon.robot.misc.objectDetection.objectdetectioncamera.ObjectDetectionCamera;
import frc.trigon.robot.misc.simulatedfield.SimulatedGamePieceConstants;
import org.littletonrobotics.junction.Logger;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;

public class ObjectPoseEstimator extends SubsystemBase {
private final double deletionThresholdSeconds;
private final SimulatedGamePieceConstants.GamePieceType gamePieceType;
private final ObjectDetectionCamera camera;
/**
* Stores the position of each detected object along with the timestamp of when it was detected.
*/
private final HashMap<Translation2d, Double> objectPositionsToDetectionTimestamp;

/**
* Constructs an ObjectPoseEstimator for estimating the positions of objects detected by camera.
*
* @param deletionThresholdSeconds the time in seconds after which an object is considered old and removed
* @param gamePieceType the type of game piece to track
* @param camera the camera used for detecting objects
*/
public ObjectPoseEstimator(double deletionThresholdSeconds,
SimulatedGamePieceConstants.GamePieceType gamePieceType,
ObjectDetectionCamera camera) {
this.deletionThresholdSeconds = deletionThresholdSeconds;
this.gamePieceType = gamePieceType;
this.camera = camera;
this.objectPositionsToDetectionTimestamp = new HashMap<>();
}

/**
* Updates the object positions based on the camera detected objects.
* Removes objects that have not been detected for a certain time frame, defined in {@link ObjectPoseEstimator#deletionThresholdSeconds}.
*/
@Override
public void periodic() {
updateTrackedObjectsPositions();
removeOldObjects();
Logger.recordOutput("ObjectPoseEstimator/knownObjectPositions", getObjectsOnField().toArray(Translation2d[]::new));
}

/**
* Gets the position of all known objects on the field.
*
* @return a list of Translation2d representing the positions of objects on the field
*/
public ArrayList<Translation2d> getObjectsOnField() {
return new ArrayList<>(objectPositionsToDetectionTimestamp.keySet());
}

/**
* Removes the closest object to the robot from the list of objects in the pose estimator.
*/
public void removeClosestObjectToRobot() {
final Translation2d closestObject = getClosestObjectToRobot();
if (closestObject == null)
return;
removeObject(closestObject);
}

/**
* Removes the closest object to the intake from the list of objects in the pose estimator.
*
* @param intakeTransform the transform of the intake relative to the robot
*/
public void removeClosestObjectToIntake(Transform2d intakeTransform) {
final Pose2d robotPose = RobotContainer.ROBOT_POSE_ESTIMATOR.getEstimatedRobotPose();
final Translation2d closestObjectToIntake = getClosestTrackedObjectToPosition(robotPose.transformBy(intakeTransform).getTranslation());
if (closestObjectToIntake == null)
return;
removeObject(closestObjectToIntake);
}

/**
* Removes the closest object to a given pose from the list of objects in the pose estimator.
*
* @param fieldRelativePose the pose to which the removed object is closest
*/
public void removeClosestObjectToPose(Pose2d fieldRelativePose) {
removeClosestObjectToPosition(fieldRelativePose.getTranslation());
}

/**
* Removes the closest object to a given position from the stored objects in the pose estimator.
*
* @param position the position to which the removed object is closest
*/
public void removeClosestObjectToPosition(Translation2d position) {
final Translation2d closestObject = getClosestTrackedObjectToPosition(position);
if (closestObject == null)
return;
removeObject(closestObject);
}

/**
* Removes a specific object from the stored objects in the pose estimator.
* Unlike {@link #removeClosestObjectToPosition} which removes the closest object to a given position.
*
* @param objectPosition the position of the object to be removed. Must be the precise position as stored in the pose estimator.
*/
public void removeObject(Translation2d objectPosition) {
objectPositionsToDetectionTimestamp.remove(objectPosition);
}

/**
* Returns whether any objects are stored in the pose estimator.
*
* @return if there are objects stored in the pose estimator
*/
public boolean hasObjects() {
return !objectPositionsToDetectionTimestamp.isEmpty();
}

/**
* Gets the position of the closest object to the robot.
*
* @return the closest object to the robot
*/
public Translation2d getClosestObjectToRobot() {
return getClosestTrackedObjectToPosition(RobotContainer.ROBOT_POSE_ESTIMATOR.getEstimatedRobotPose().getTranslation());
}

private void updateTrackedObjectsPositions() {
final Translation2d[] visibleObjects = camera.getObjectPositionsOnField(gamePieceType);
final HashMap<Translation2d, Translation2d> trackedObjectsToUpdatedPositions = new HashMap<>();

for (Translation2d visibleObject : visibleObjects)
updateObjectPosition(visibleObject, trackedObjectsToUpdatedPositions);

applyObjectUpdates(trackedObjectsToUpdatedPositions);
}

private void applyObjectUpdates(HashMap<Translation2d, Translation2d> currentToNewObjectPositions) {
final double currentTimestamp = Timer.getTimestamp();

objectPositionsToDetectionTimestamp.keySet().removeAll(currentToNewObjectPositions.keySet());
currentToNewObjectPositions.values().forEach(object -> objectPositionsToDetectionTimestamp.put(object, currentTimestamp));
}

private void updateObjectPosition(Translation2d objectUpdate, HashMap<Translation2d, Translation2d> trackedObjectsToUpdatedPositions) {
final Translation2d closestAvailableTrackedObjectToVisibleObject = getClosestAvailableObjectToUpdate(objectUpdate, trackedObjectsToUpdatedPositions);
if (closestAvailableTrackedObjectToVisibleObject == null) {
trackedObjectsToUpdatedPositions.put(objectUpdate, objectUpdate);
return;
}
final Translation2d previousUpdate = trackedObjectsToUpdatedPositions.get(closestAvailableTrackedObjectToVisibleObject);
trackedObjectsToUpdatedPositions.put(closestAvailableTrackedObjectToVisibleObject, objectUpdate);
if (previousUpdate != null)
updateObjectPosition(previousUpdate, trackedObjectsToUpdatedPositions);
}

private Translation2d getClosestAvailableObjectToUpdate(Translation2d update, HashMap<Translation2d, Translation2d> objectsWithUpdates) {
final Set<Translation2d> availableObjectsToUpdate = getAvailableObjectsToUpdate(update, objectsWithUpdates);
if (availableObjectsToUpdate == null || availableObjectsToUpdate.isEmpty())
return null;
return getClosestObjectFromSetToPosition(update, availableObjectsToUpdate);
}

private Set<Translation2d> getAvailableObjectsToUpdate(Translation2d update, HashMap<Translation2d, Translation2d> objectsWithUpdates) {
if (objectPositionsToDetectionTimestamp.isEmpty())
return null;
final Set<Translation2d> availableObjects = new HashSet<>();
for (Translation2d currentObject : objectPositionsToDetectionTimestamp.keySet()) {
final double updateDistanceFromCurrentObject = update.getDistance(currentObject);
if (updateDistanceFromCurrentObject > ObjectDetectionConstants.TRACKED_OBJECT_TOLERANCE_METERS)
continue;
if (!objectsWithUpdates.containsKey(currentObject)) {
availableObjects.add(currentObject);
continue;
}
if (isNewUpdateCloserThanPreviousUpdate(update, objectsWithUpdates.get(currentObject), currentObject))
availableObjects.add(currentObject);
}
return availableObjects;
}

private boolean isNewUpdateCloserThanPreviousUpdate(Translation2d newUpdate, Translation2d previousUpdate, Translation2d object) {
return newUpdate.getDistance(object) < previousUpdate.getDistance(object);
}

private Translation2d getClosestTrackedObjectToPosition(Translation2d position) {
return getClosestObjectFromSetToPosition(position, objectPositionsToDetectionTimestamp.keySet());
}

private Translation2d getClosestObjectFromSetToPosition(Translation2d position, Set<Translation2d> objects) {
if (objects.isEmpty())
return null;
Translation2d closestObjectTranslation = null;
double closestObjectDistance = Double.MAX_VALUE;

for (Translation2d object : objects) {
final double currentObjectDistance = position.getDistance(object);
if (currentObjectDistance < closestObjectDistance) {
closestObjectDistance = currentObjectDistance;
closestObjectTranslation = object;
}
}
return closestObjectTranslation;
}

private void removeOldObjects() {
objectPositionsToDetectionTimestamp.entrySet().removeIf(entry -> hasObjectExpired(entry.getValue()));
}

private boolean hasObjectExpired(double timestamp) {
return Timer.getTimestamp() - timestamp > deletionThresholdSeconds;
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package frc.trigon.robot.misc.objectdetectioncamera;
package frc.trigon.robot.misc.objectDetection.objectdetectioncamera;

import edu.wpi.first.math.geometry.*;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.trigon.lib.hardware.RobotHardwareStats;
import frc.trigon.robot.RobotContainer;
import frc.trigon.robot.misc.objectdetectioncamera.io.PhotonObjectDetectionCameraIO;
import frc.trigon.robot.misc.objectdetectioncamera.io.SimulationObjectDetectionCameraIO;
import frc.trigon.robot.misc.objectDetection.objectdetectioncamera.io.PhotonObjectDetectionCameraIO;
import frc.trigon.robot.misc.objectDetection.objectdetectioncamera.io.SimulationObjectDetectionCameraIO;
import frc.trigon.robot.misc.simulatedfield.SimulatedGamePieceConstants;
import org.littletonrobotics.junction.Logger;
import frc.trigon.lib.hardware.RobotHardwareStats;

/**
* An object detection camera is a class that represents a camera that detects objects other than apriltags, most likely game pieces.
Expand All @@ -31,51 +31,52 @@ public void periodic() {
}

/**
* Calculates the position of the best object on the field from the 3D rotation of the object relative to the camera.
* Calculates the position of the closest object on the field from its 3D rotation relative to the camera.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on Their positions (plural)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

* This assumes the object is on the ground.
* Once it is known that the object is on the ground,
* one can simply find the transform from the camera to the ground and apply it to the object's rotation.
*
* @return the best object's 2D position on the field (z is assumed to be 0)
* @return the closest object's 2D position on the field (z is assumed to be 0)
*/
public Translation2d calculateBestObjectPositionOnField(SimulatedGamePieceConstants.GamePieceType targetGamePiece) {
public Translation2d calculateClosestObjectPositionOnField(SimulatedGamePieceConstants.GamePieceType targetGamePiece) {
final Translation2d[] targetObjectsTranslation = getObjectPositionsOnField(targetGamePiece);
final Translation2d currentRobotTranslation = RobotContainer.ROBOT_POSE_ESTIMATOR.getEstimatedRobotPose().getTranslation();
if (targetObjectsTranslation.length == 0)
return null;
Translation2d bestObjectTranslation = targetObjectsTranslation[0];
Translation2d closestObjectTranslation = targetObjectsTranslation[0];
double closestObjectDistanceToRobot = currentRobotTranslation.getDistance(closestObjectTranslation);

for (int i = 1; i < targetObjectsTranslation.length; i++) {
final Translation2d currentObjectTranslation = targetObjectsTranslation[i];
final double bestObjectDifference = currentRobotTranslation.getDistance(bestObjectTranslation);
final double currentObjectDifference = currentRobotTranslation.getDistance(currentObjectTranslation);
if (currentObjectDifference < bestObjectDifference)
bestObjectTranslation = currentObjectTranslation;
for (Translation2d currentObjectTranslation : targetObjectsTranslation) {
final double currentObjectDistanceToRobot = currentRobotTranslation.getDistance(currentObjectTranslation);
if (currentObjectDistanceToRobot < closestObjectDistanceToRobot) {
closestObjectTranslation = currentObjectTranslation;
closestObjectDistanceToRobot = currentObjectDistanceToRobot;
}
}
return bestObjectTranslation;
return closestObjectTranslation;
}

public boolean hasTargets(SimulatedGamePieceConstants.GamePieceType targetGamePiece) {
return objectDetectionCameraInputs.hasTarget[targetGamePiece.id];
public boolean hasObject(SimulatedGamePieceConstants.GamePieceType targetGamePiece) {
return objectDetectionCameraInputs.hasObject[targetGamePiece.id];
}

public Translation2d[] getObjectPositionsOnField(SimulatedGamePieceConstants.GamePieceType targetGamePiece) {
final Rotation3d[] visibleObjectsRotations = getTargetObjectsRotations(targetGamePiece);
final Translation2d[] objectsPositionsOnField = new Translation2d[visibleObjectsRotations.length];
final Rotation3d[] visibleObjectRotations = getObjectsRotations(targetGamePiece);
final Translation2d[] objectPositionsOnField = new Translation2d[visibleObjectRotations.length];

for (int i = 0; i < visibleObjectsRotations.length; i++)
objectsPositionsOnField[i] = calculateObjectPositionFromRotation(visibleObjectsRotations[i]);
for (int i = 0; i < visibleObjectRotations.length; i++)
objectPositionsOnField[i] = calculateObjectPositionFromRotation(visibleObjectRotations[i]);

Logger.recordOutput("ObjectDetectionCamera/Visible" + targetGamePiece.name(), objectsPositionsOnField);
return objectsPositionsOnField;
Logger.recordOutput("ObjectDetectionCamera/Visible" + targetGamePiece.name(), objectPositionsOnField);
return objectPositionsOnField;
}

public Rotation3d[] getTargetObjectsRotations(SimulatedGamePieceConstants.GamePieceType targetGamePiece) {
public Rotation3d[] getObjectsRotations(SimulatedGamePieceConstants.GamePieceType targetGamePiece) {
return objectDetectionCameraInputs.visibleObjectRotations[targetGamePiece.id];
}

/**
* Calculates the position of the object on the field from the 3D rotation of the object relative to the camera.
* Calculates the position of an object on the field from its 3D rotation relative to the camera.
* This assumes the object is on the ground.
* Once it is known that the object is on the ground,
* one can simply find the transform from the camera to the ground and apply it to the object's rotation.
Expand Down
Loading
Loading