Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sensors test #38

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open

Sensors test #38

wants to merge 24 commits into from

Conversation

tomtzook
Copy link
Member

@tomtzook tomtzook commented Feb 8, 2025

No description provided.

Copy link
Member Author

@tomtzook tomtzook left a comment

Choose a reason for hiding this comment

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

Code is kind of a mess guys, Please organize it so we won't have problems

@@ -79,37 +80,60 @@ public void robotInit() {
}, Set.of(algaeArm));
algaeArm.setDefaultCommand(checkIfAlgaeRetract);

Command checkIfLow = Commands.defer(()-> {
/* Command checkIfLow = Commands.defer(()-> {
Copy link
Member Author

Choose a reason for hiding this comment

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

Delete all the commented-out code that is no longer necessary

@@ -141,6 +165,7 @@ public void disabledExit() {

@Override
public void teleopInit() {
compressor.enableAnalog(RobotMap.MIN_PRESSURE,RobotMap.MAX_PRESSURE);
Copy link
Member Author

Choose a reason for hiding this comment

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

this is already done in robotInit. Why again here?


public class CollectCoral extends Command {
public CoralGripper coralGripper;
Instant previousTime = null;
Copy link
Member Author

Choose a reason for hiding this comment

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

don't use Instant as it uses the less trusty system clock. Use Timer.getFPGATimestamp() instead.

public class ReleaseAlgae extends Command {
private final AlgaeGripper algaeGripper;
Instant previousTime = null;
Copy link
Member Author

Choose a reason for hiding this comment

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

don't use Instant as it uses the less trusty system clock. Use Timer.getFPGATimestamp() instead.

public class ReleaseCoral extends Command {
public CoralGripper coralGripper;
Instant previousTime = null;
Copy link
Member Author

Choose a reason for hiding this comment

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

don't use Instant as it uses the less trusty system clock. Use Timer.getFPGATimestamp() instead.

}

public void raise() {
piston1.set(DoubleSolenoid.Value.kForward);
piston2.set(DoubleSolenoid.Value.kForward);
//piston2.set(DoubleSolenoid.Value.kForward);
Copy link
Member Author

Choose a reason for hiding this comment

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

delete

@@ -30,6 +31,7 @@ public class CoralGripper extends SubsystemBase {
public CoralGripper() {
motor = new TalonFX(RobotMap.CORAL_GRIPPER_MOTOR);
motor.getConfigurator().apply(new TalonFXConfiguration());
motor.setNeutralMode(NeutralModeValue.Brake);
Copy link
Member Author

Choose a reason for hiding this comment

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

don't set it like that, use the configuration

TalonFXConfiguration config = new TalonFXConfiguration();
config.MotorOutput.NeutralMode = NeutralModeValue.Brake;
motor.getConfigurator().apply(config);

}
return Optional.empty();
}

public Optional<Double> frontTargetAngle(){
Copy link
Member Author

Choose a reason for hiding this comment

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

what is this for?

LimelightHelpers.RawFiducial[] fiducials = LimelightHelpers.getRawFiducials(name);
if(fiducials.length >0)
return fiducials[0].distToRobot;
return 3;
Copy link
Member Author

Choose a reason for hiding this comment

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

why 3? that is a lie, but it may fool someone into thinking the real distance is 3, return a number indicating an invalid value.

Either a negative value, optional, or if you want your trick to still work, return Double.MAX_VALUE

algaeGripper.setDefaultCommand(checkAlgae);
algaeGripper.setDefaultCommand(checkAlgae);*/

new JoystickButton(xbox, XboxController.Button.kY.value)
Copy link
Member Author

Choose a reason for hiding this comment

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

not all the command groups are attached to buttons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants