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

Changes to Intake also Juicy 3 #4

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
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 build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import edu.wpi.first.gradlerio.deploy.roborio.RoboRIO

plugins {
id "java"
id "edu.wpi.first.GradleRIO" version "2022.1.1"
id "edu.wpi.first.GradleRIO" version "2022.2.1"
Copy link
Contributor

Choose a reason for hiding this comment

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

Make sure that this matches the version on the driver station—probably leave it as 2022.1.1 for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't worry about changing this at the moment, though.

}

sourceCompatibility = JavaVersion.VERSION_11
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/org/usfirst/frc4904/robot/RobotMap.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
package org.usfirst.frc4904.robot;

import edu.wpi.first.wpilibj.PneumaticsModuleType;
import edu.wpi.first.wpilibj2.command.Subsystem;

import org.usfirst.frc4904.standard.custom.PCMPort;
import org.usfirst.frc4904.standard.custom.controllers.CustomJoystick;
import org.usfirst.frc4904.standard.custom.controllers.CustomXbox;
import org.usfirst.frc4904.standard.custom.motioncontrollers.CANTalonFX;
import org.usfirst.frc4904.standard.custom.motioncontrollers.CANTalonSRX;
import org.usfirst.frc4904.standard.subsystems.SolenoidSubsystem.SolenoidState;
import org.usfirst.frc4904.standard.subsystems.SolenoidSubsystem;
import org.usfirst.frc4904.standard.subsystems.motor.Motor;
import org.usfirst.frc4904.robot.subsystems.Intake;


public class RobotMap {
public static class Port {
Expand All @@ -12,6 +22,7 @@ public static class HumanInput {
}

public static class CANMotor {
public static final int AXLE_INTAKE_MOTOR = -1; //TODO: set port for axel intake motor
}

public static class PWM {
Expand All @@ -21,6 +32,7 @@ public static class CAN {
}

public static class Pneumatics {
public static final PCMPort DRAWBRIDGE_INTAKE_SOLENOID = new PCMPort(-1, PneumaticsModuleType.CTREPCM, -1, -1); //TODO: set port for drawbridge intake motor
Copy link
Contributor

Choose a reason for hiding this comment

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

No longer a motor (in the comment) :)

}

public static class Digital {
Expand Down Expand Up @@ -51,6 +63,9 @@ public static class Turn {
}

public static class Component {
public static Intake intake;
public static Motor intakeAxleMotor;
public static SolenoidSubsystem intakeDrawbridgeSolenoid;
}

public static class Input {
Expand All @@ -70,5 +85,7 @@ public RobotMap() {
HumanInput.Driver.xbox = new CustomXbox(Port.HumanInput.xboxController);
HumanInput.Operator.joystick = new CustomJoystick(Port.HumanInput.joystick);

Component.intakeDrawbridgeSolenoid = new SolenoidSubsystem("Intake Drawbridge Solenoid", false, SolenoidState.RETRACT, Port.Pneumatics.DRAWBRIDGE_INTAKE_SOLENOID.buildDoubleSolenoid()); //TODO: check if CANTalonFX or SRX
Component.intakeAxleMotor = new Motor("Intake Motor", false, new CANTalonFX(Port.CANMotor.AXLE_INTAKE_MOTOR)); //TODO: check if CANTalonFX or SRX
b-cho marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

Also this is a CANTalonFX—confirmed with the intake people on design.

Copy link
Member

Choose a reason for hiding this comment

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

great

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.usfirst.frc4904.robot.commands.intake;

import org.usfirst.frc4904.robot.RobotMap;
import org.usfirst.frc4904.standard.commands.motor.MotorIdle;

public class AxleIntakeOff extends MotorIdle {
public AxleIntakeOff() {
super("Stop Axle Intake", RobotMap.Component.intakeAxleMotor);
Copy link
Contributor

Choose a reason for hiding this comment

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

Generally the name argument should be in camel caps without spaces.

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.usfirst.frc4904.robot.commands.intake;

import org.usfirst.frc4904.robot.RobotMap;
import org.usfirst.frc4904.standard.commands.motor.MotorConstant;

public class AxleIntakeOn extends MotorConstant {
public AxleIntakeOn() {
super("Axel Intake On", RobotMap.Component.intakeAxleMotor, 0.5); // todo: needs motor speed
Copy link
Contributor

Choose a reason for hiding this comment

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

Generally the name argument should be in camel caps without spaces (see other).

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.usfirst.frc4904.robot.commands.intake;

import org.usfirst.frc4904.robot.RobotMap;
import org.usfirst.frc4904.standard.commands.solenoid.SolenoidExtend;

public class ExtendIntake extends SolenoidExtend { //It extends the drawbridge which has the intake mechanism attached to it.
Copy link
Contributor

Choose a reason for hiding this comment

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

Comments probably should go above the first line of the class, like this

// It extends the drawbridge which has the intake mechanism attached to it.
public class ExtendIntake extends SolenoidExtend {
    ...

public ExtendIntake() {
super("Extend Intake Drawbridge", RobotMap.Component.intakeDrawbridgeSolenoid);
Copy link
Contributor

Choose a reason for hiding this comment

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

Name argument should be in camel caps without spaces.

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.usfirst.frc4904.robot.commands.intake;

import org.usfirst.frc4904.robot.RobotMap;
import org.usfirst.frc4904.standard.commands.solenoid.SolenoidRetract;

public class RetractIntake extends SolenoidRetract { //It extends the drawbridge which has the intake mechanism attached to it.
public RetractIntake() {
super("Retract Intake Drawbridge", RobotMap.Component.intakeDrawbridgeSolenoid);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as before—the name argument should be in camel caps without spaces.

}
}
17 changes: 17 additions & 0 deletions src/main/java/org/usfirst/frc4904/robot/subsystems/Intake.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.usfirst.frc4904.robot.subsystems;
import org.usfirst.frc4904.standard.subsystems.SolenoidSubsystem;
import org.usfirst.frc4904.standard.subsystems.motor.Motor;

public class Intake {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this extend SubsystemBase?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes—all subsystems should extend SubsystemBase.

public final static double DEFAULT_INTAKE_MOTOR_SPEED = 0.0; //needs value
// public final static double DEFAULT_DRAWBRIDGE_MOTOR_SPEED = 0.0; //needs value
public final static double DEFAULT_OFF_SPEED = 0.0;

public final SolenoidSubsystem drawbridgeSolenoid;
public final Motor axelMotor;

public Intake(Motor axelMotor, SolenoidSubsystem drawbridgeSolenoid) {
this.axelMotor = axelMotor;
this.drawbridgeSolenoid = drawbridgeSolenoid;
}
}