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

one motor indexer #14

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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"
}

sourceCompatibility = JavaVersion.VERSION_11
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/org/usfirst/frc4904/robot/RobotMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import edu.wpi.first.wpilibj2.command.Subsystem;
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.subsystems.motor.Motor;

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

public static class CANMotor {
public static final int indexerMotor = -1; // TODO: set port
}

public static class PWM {
Expand Down Expand Up @@ -51,6 +54,8 @@ public static class Turn {
}

public static class Component {
public static Motor indexerMotor;
public static Motor motor;
}

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

Component.indexerMotor = new Motor("indexerMotor", false, new CANTalonFX(Port.CANMotor.indexerMotor));
Copy link
Contributor

Choose a reason for hiding this comment

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

Add comment at the end of this line:
// TODO: Need to check motor inversion

}
}
}
21 changes: 21 additions & 0 deletions src/main/java/org/usfirst/frc4904/robot/commands/IndexerOff.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.usfirst.frc4904.robot.commands;

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

public class IndexerOff extends MotorIdle {

/**
* Set motor speed to zero
*
* @param motor The motor to manipulate
*/
public IndexerOff(Motor motor) {
super(motor, 0.0);
Copy link
Contributor

Choose a reason for hiding this comment

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

First argument in super() call needs to be the name of the command

}

public IndexerOff() {
super(RobotMap.Component.motor, 0.0);
Copy link
Contributor

Choose a reason for hiding this comment

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

First argument in super() call needs to be the name of the command

}
}
11 changes: 11 additions & 0 deletions src/main/java/org/usfirst/frc4904/robot/commands/IndexerOn.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.usfirst.frc4904.robot.commands;

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

public class IndexerOn extends MotorConstant {
public final static double DEFAULT_INTAKE_MOTOR_SPEED = 0.5; //TODO: needs value
public IndexerOn() {
super("IndexerOn", RobotMap.Component.motor, DEFAULT_INTAKE_MOTOR_SPEED);
}
}
Empty file.