generated from Team5430/CommandBasedTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drivetrain speeds changed, PID intensity altered
- Loading branch information
Showing
14 changed files
with
594 additions
and
362 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package com.team5430.util; | ||
|
||
import com.ctre.phoenix.motorcontrol.StickyFaults; | ||
import com.ctre.phoenix.motorcontrol.can.TalonSRX; | ||
import com.ctre.phoenix6.hardware.TalonFX; | ||
|
||
import edu.wpi.first.wpilibj2.command.WaitCommand; | ||
|
||
public class log { | ||
|
||
public log() { | ||
} | ||
|
||
public void println(String printing) { | ||
System.out.println(printing); | ||
} | ||
|
||
public void motor(TalonSRX name) { | ||
StickyFaults errors = new StickyFaults(); | ||
|
||
name.getStickyFaults(errors); | ||
|
||
String motorName = name.toString(); | ||
|
||
double startup = 0; | ||
|
||
if (errors.APIError == true) { | ||
println(motorName + ": API Error, check firmware"); | ||
} else if (errors.HardwareESDReset == true) { | ||
println(motorName + ": Not used."); | ||
} else if (errors.RemoteLossOfSignal == true) { | ||
println(motorName + ": RemoteSensor lost conection."); | ||
} else if (errors.ResetDuringEn == true) { | ||
println(motorName + ": Has been turned on while enabled, or reset, please check wiring."); | ||
} else if (errors.SensorOutOfPhase == true) { | ||
println(motorName + ": Sensor is not aligned properly."); | ||
} else if (errors.SensorOverflow == true) { | ||
println(motorName + ": Sensor Overflow."); | ||
} else if (errors.SupplyOverV == true) { | ||
println(motorName + ": voltage is above rated voltage."); | ||
} else if (errors.SupplyUnstable == true) { | ||
println(motorName + ": voltage is fluctuating too much, check battery"); | ||
} else if (errors.UnderVoltage == true) { | ||
println(motorName + ": voltage is under 6.5V"); | ||
} else if (errors.HardwareESDReset == false && startup >= 1) { | ||
println(motorName + ": [✓]"); | ||
startup++; | ||
} | ||
new WaitCommand(1); | ||
} | ||
|
||
public void motor(TalonFX name) { | ||
String motorName = name.toString(); | ||
double startup = 0; | ||
if (name.getStickyFault_ProcTemp().getValue() == true) { | ||
println(motorName + ": Temperature exceeded limit."); | ||
} else if (name.getStickyFault_MissingDifferentialFX().getValue() == true) { | ||
println(motorName + ": Not used."); | ||
} else if (name.getStickyFault_RemoteSensorDataInvalid().getValue() == true) { | ||
println(motorName + ": RemoteSensor lost conection, data may not be accurate any"); | ||
} else if (name.getStickyFault_Hardware().getValue() == true) { | ||
println(motorName + ": Hardware fault occured."); | ||
} else if (name.getStickyFault_FusedSensorOutOfSync().getValue() == true) { | ||
println(motorName + ": Sensor is not in sync."); | ||
} else if (name.getStickyFault_RemoteSensorPosOverflow().getValue() == true) { | ||
println(motorName + ": Sensor Overflow."); | ||
} else if (name.getStickyFault_OverSupplyV().getValue() == true) { | ||
println(motorName + ": voltage is above rated voltage."); | ||
} else if (name.getStickyFault_UnstableSupplyV().getValue() == true) { | ||
println(motorName + ": voltage is fluctuating too much, check battery"); | ||
} else if (name.getStickyFault_Undervoltage().getValue() == true) { | ||
println(motorName + ": voltage is under 6.5V"); | ||
} else if (name.getStickyFault_BootDuringEnable().getValue() == false && startup >= 1) { | ||
println(motorName + ": [✓]"); | ||
startup++; | ||
} | ||
new WaitCommand(1); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.driveTrain; | ||
|
||
public class DriveToDistance extends Command{ | ||
|
||
private driveTrain _drive; | ||
|
||
private double Inches; | ||
|
||
public DriveToDistance(driveTrain drive, double inches){ | ||
_drive = drive; | ||
addRequirements(_drive); | ||
Inches = inches; | ||
} | ||
|
||
@Override | ||
public void initialize(){ | ||
_drive.driveininches(Inches); | ||
} | ||
|
||
@Override | ||
public boolean isFinished(){ | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.intakeSub; | ||
import frc.robot.subsystems.intakeSub.Value; | ||
|
||
public class IntakeNote extends Command { | ||
|
||
private intakeSub _intake; | ||
|
||
// require the intake subsystem to run this command | ||
public IntakeNote(intakeSub intake) { | ||
intake = _intake; | ||
addRequirements(intake); | ||
} | ||
|
||
// runs when command is called initally | ||
@Override | ||
public void initialize() { | ||
new setPos(Value.FLOOR, _intake); | ||
new IntakeSet(Value.INTAKE, _intake); | ||
new TransversalSet(Value.INTAKE, _intake); | ||
System.out.println("HELLO"); | ||
} | ||
|
||
// Miguel was here | ||
|
||
// runs when command ends | ||
@Override | ||
public void end(boolean isFinished) { | ||
new IntakeSet(Value.STOP, _intake); | ||
new TransversalSet(Value.STOP, _intake); | ||
new setPos(Value.SPEAKER, _intake); | ||
} | ||
|
||
// tells scheduler that this command runs once* | ||
@Override | ||
public boolean isFinished() { | ||
return true; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.intakeSub; | ||
import frc.robot.subsystems.intakeSub.Value;; | ||
|
||
public class IntakeSet extends Command { | ||
|
||
private intakeSub _intake; | ||
|
||
// no intake required as to allow running at any point | ||
public IntakeSet(final Value value, intakeSub intake) { | ||
_intake = intake; | ||
addRequirements(_intake); | ||
_intake.intakeSet(value); | ||
} | ||
|
||
} |
Oops, something went wrong.