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

Changes to Intake also Juicy 3 #4

wants to merge 6 commits into from

Conversation

rohtumm
Copy link

@rohtumm rohtumm commented Jan 17, 2022

Intake code to control the motor that the compliant wheels are on as well as the drawbridge motor.

@rohtumm rohtumm requested review from b-cho and zbuster05 January 17, 2022 18:03
@zbuster05 zbuster05 requested a review from FlyN-Nick January 17, 2022 18:05
@FlyN-Nick
Copy link
Member

What does the extend intake command do?

@FlyN-Nick
Copy link
Member

FlyN-Nick commented Jan 17, 2022

Lines 19 and 23 of Intake.java, I suggest using this.motorName for clarity

@FlyN-Nick
Copy link
Member

Lines 10 and 11 of Intake, should be public final.

@FlyN-Nick
Copy link
Member

Lines 37-39 of Intake.java, the comment is unnecessary.

@rohtumm
Copy link
Author

rohtumm commented Jan 17, 2022

What does the extend intake command do?

@rohtumm rohtumm closed this Jan 17, 2022
@rohtumm rohtumm reopened this Jan 17, 2022
@rohtumm
Copy link
Author

rohtumm commented Jan 17, 2022

What does the extend intake command do?

It extends the drawbridge which has the intake mechanism attached to it.

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

public Motor drawbridgeMotor;
Copy link
Member

Choose a reason for hiding this comment

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

add final

public final static double DEFAULT_OFF_SPEED = 0.0;

public Motor drawbridgeMotor;
public Motor axelMotor;
Copy link
Member

Choose a reason for hiding this comment

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

add final

}

public void setAxelIntakeSpeed(double speed) {
axelMotor.set(speed);
Copy link
Member

Choose a reason for hiding this comment

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

add this.

}

public void setDrawBridgeSpeed(double speed) {
drawbridgeMotor.set(speed);
Copy link
Member

Choose a reason for hiding this comment

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

add this.

public void stop() {
setSpeed(DEFAULT_OFF_SPEED, DEFAULT_OFF_SPEED); //maybe retract drawbridge?
}
// public void retractDrawBridge(double speed) {
Copy link
Member

Choose a reason for hiding this comment

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

delete comment


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 ExtendIntake(Intake intake, double targetSpeed) {
super();
this.intake = intake;
this.targetSpeed = targetSpeed;
Copy link
Member

Choose a reason for hiding this comment

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

You declare a variable targetSpeed, but you don't actually do anything with it. You need to call intake's setSpeed.

@@ -0,0 +1,16 @@
package org.usfirst.frc4904.robot.commands;
Copy link
Member

Choose a reason for hiding this comment

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

Preferably put this command in a subfolder of commands named "Intake".

public class ExtendIntake extends CommandBase {
protected final Intake intake;
protected double targetSpeed;
public ExtendIntake(Intake intake, double targetSpeed) {
Copy link
Member

Choose a reason for hiding this comment

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

The intake should not be a parameter of the constructor. Instead, use this.intake = RobotMap.Component.intake;. Additionally, for this to work, add the line addRequirements(RobotMap.Component.intake); as the last line of the constructor. You can checkout to the turret branch and look at the command TurnTurret as an example.

@b-cho b-cho linked an issue Jan 22, 2022 that may be closed by this pull request
9 tasks
Copy link
Contributor

@b-cho b-cho left a comment

Choose a reason for hiding this comment

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

Left some comments—please address and I can take another look.

build.gradle Outdated
@@ -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.

@@ -21,6 +32,7 @@
}

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 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.


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).


public class ExtendIntake extends SolenoidExtend { //It extends the drawbridge which has the intake mechanism attached to it.
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.

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 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.


import org.usfirst.frc4904.standard.subsystems.motor.Motor;

public class Intake {
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.

@@ -70,5 +83,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());
Component.intakeAxleMotor = new Motor("Intake Motor", false, new CANTalonFX(Port.CANMotor.AXLE_INTAKE_MOTOR)); //TODO: check if CANTalonFX or SRX
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

b-cho
b-cho previously approved these changes Jan 23, 2022
Copy link
Contributor

@b-cho b-cho left a comment

Choose a reason for hiding this comment

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

Looks good for now—leaving an approval here ✅

FlyN-Nick
FlyN-Nick previously approved these changes Jan 23, 2022
* Rotates the axle to intake the ball
*/
public class AxleIntakeOn extends MotorConstant {
public final static double DEFAULT_INTAKE_MOTOR_SPEED = 0.5; //TODO: needs value
Copy link
Member

Choose a reason for hiding this comment

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

Remember to add value

zbuster05
zbuster05 previously approved these changes Jan 29, 2022
Copy link
Member

@zbuster05 zbuster05 left a comment

Choose a reason for hiding this comment

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

Looks good for now. We'll make sure to adjust constants and then after design review we should be able to merge this.

@pluvii pluvii dismissed stale reviews from FlyN-Nick, zbuster05, and b-cho via c2b48e0 February 3, 2022 01:10
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.

Intake mechanism
10 participants