Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
levyishai committed Jan 9, 2025
1 parent 6fa3c00 commit cb9f33d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
package frc.trigon.robot.commands;

import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.kinematics.ChassisSpeeds;
import edu.wpi.first.math.util.Units;
import edu.wpi.first.wpilibj.util.Color;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.InstantCommand;
import frc.trigon.robot.RobotContainer;
import frc.trigon.robot.commands.commandfactories.GeneralCommands;
import frc.trigon.robot.constants.CameraConstants;
import frc.trigon.robot.constants.OperatorConstants;
import frc.trigon.robot.constants.PathPlannerConstants;
import frc.trigon.robot.subsystems.swerve.SwerveCommands;
import org.trigon.commands.CameraPositionCalculationCommand;
import org.trigon.commands.WheelRadiusCharacterizationCommand;
import org.trigon.hardware.misc.XboxController;
import org.trigon.hardware.misc.leds.LEDCommands;
Expand Down Expand Up @@ -60,7 +63,6 @@ public class CommandConstants {
RobotContainer.SWERVE
);


/**
* Calculates the target drive power from an axis value by dividing it by the shift mode value.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public double getLatestResultTimestampSeconds() {
}

public boolean hasValidResult() {
return inputs.hasResult && inputs.poseAmbiguity < AprilTagCameraConstants.MAXIMUM_AMBIGUITY && estimatedRobotPose != null;
return inputs.hasResult && inputs.poseAmbiguity < AprilTagCameraConstants.MAXIMUM_AMBIGUITY;
}

/**
Expand Down Expand Up @@ -107,6 +107,9 @@ private double calculateStandardDeviation(double exponent, double distance, int
}

private Pose2d calculateRobotPose() {
if (!hasValidResult())
return null;

return cameraPoseToRobotPose(inputs.cameraSolvePNPPose.toPose2d());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ private void putAprilTagsOnFieldWidget() {
private void logTargetPath() {
PathPlannerLogging.setLogActivePathCallback((pathPoses) -> {
field.getObject("path").setPoses(pathPoses);
Logger.recordOutput("Path", pathPoses.toArray(new Pose2d[0]));
Logger.recordOutput("PathPlanner/Path", pathPoses.toArray(new Pose2d[0]));
});
PathPlannerLogging.setLogTargetPoseCallback((pose) -> Logger.recordOutput("TargetPPPose", pose));
PathPlannerLogging.setLogTargetPoseCallback((pose) -> Logger.recordOutput("PathPlanner/TargetPose", pose));
}

/**
Expand Down

0 comments on commit cb9f33d

Please sign in to comment.