Skip to content

Commit

Permalink
added switch to field oriented where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
cherriae committed Mar 14, 2024
1 parent 7fa007d commit c9c691a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void robotInit() {
// FIRST THING THAT HAPPENS
addPeriodic(() -> AllianceHelper.getInstance().updateAlliance(DriverStation.getAlliance()), 0.5);

CameraServer.startAutomaticCapture();
// CameraServer.startAutomaticCapture();

// Instantiate our RobotContainer. This will perform all our button bindings,
// and put our
Expand Down Expand Up @@ -63,7 +63,7 @@ public void robotPeriodic() {
// block in order for anything in the Command-based framework to work.
CommandScheduler.getInstance().run();

CameraServer.putVideo("INTAKE CAM", 1080, 920);
// CameraServer.putVideo("INTAKE CAM", 1080, 920);
}

/** This function is called once each time the robot enters Disabled mode. */
Expand Down Expand Up @@ -96,6 +96,7 @@ public void teleopInit() {
// teleop starts running. If you want the autonomous to
// continue until interrupted by another command, remove
// this line or comment it out.
m_robotContainer.teleopInit();

if (m_autonomousCommand != null) {
m_autonomousCommand.cancel();
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ private void configureBindings() {
);
}

/**
* Updates all subsystems on teleop init.
*/
public void teleopInit() {
_swerveSubsystem.fieldOriented = true;
}

/** @return The Command to schedule for auton. */
public Command getAutonCommand() {
_swerveSubsystem.fieldOriented = false; // make sure swerve is robot-relative for pathplanner to work
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/frc/robot/commands/shooter/AutoAim.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ public AutoAim(
// Called when the command is initially scheduled.
@Override
public void initialize() {
_swerve.fieldOriented = true;

_reachedSwerveHeading = false;
_reachedShooterAngle = false;
_reachedElevatorHeight = false;
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/frc/robot/commands/swerve/TeleopDrive.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ public TeleopDrive(SwerveDriveSubsystem swerveDrive, DoubleSupplier xSpeed, Doub

// Called when the command is initially scheduled.
@Override
public void initialize() {
_swerveDrive.fieldOriented = true;
}
public void initialize() {}

// Called every time the scheduler runs while the command is scheduled.
@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/subsystems/ShooterSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public ShooterSubsystem() {
softLimits.ForwardSoftLimitThreshold = 55 * Constants.Physical.SHOOTER_ANGLE_GEAR_RATIO / 360;
softLimits.ReverseSoftLimitThreshold = -25 * Constants.Physical.SHOOTER_ANGLE_GEAR_RATIO / 360;

softLimits.ForwardSoftLimitEnable = true;
softLimits.ReverseSoftLimitEnable = true;
softLimits.ForwardSoftLimitEnable = false;
softLimits.ReverseSoftLimitEnable = false;

_angleMotor.getConfigurator().apply(softLimits);

Expand Down

0 comments on commit c9c691a

Please sign in to comment.