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

Indexer two motors (belt) #19

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 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
17 changes: 14 additions & 3 deletions src/main/java/org/usfirst/frc4904/robot/RobotMap.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package org.usfirst.frc4904.robot;

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;
import org.usfirst.frc4904.robot.subsystems.Indexer;


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

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

}

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

public static class Component {
public static Indexer indexer;
public static Motor motor;
}

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

Component.indexer = new Indexer(new Motor("Indexer 1", false, new CANTalonFX(Port.CANMotor.indexerMotor1)), new Motor("Indexer 2", false, new CANTalonFX(Port.CANMotor.indexerMotor2)));



}
}
}

This file was deleted.

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

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

import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;


public class IndexerOff extends ParallelCommandGroup {

/**
* Set indexer motor speed to zero
*/
public IndexerOff() {
this.addCommands(
new MotorIdle(RobotMap.Component.indexer.indexerMotor1),
Copy link
Contributor

Choose a reason for hiding this comment

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

inconsistent indentation amount—4 spaces per tab is probably better here than two spaces per tab

new MotorIdle(RobotMap.Component.indexer.indexerMotor2)
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.usfirst.frc4904.robot.commands.indexer;

import org.usfirst.frc4904.robot.subsystems.Indexer;

public class IndexerOn extends IndexerSet {
public IndexerOn() {
super(Indexer.DEFAULT_INDEXER_SPEED, Indexer.DEFAULT_INDEXER_SPEED);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.usfirst.frc4904.robot.commands.indexer;
import org.usfirst.frc4904.robot.RobotMap;
import org.usfirst.frc4904.standard.commands.motor.MotorConstant;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;


public class IndexerSet extends ParallelCommandGroup {
public IndexerSet(double speed1, double speed2) {
this.addCommands(
new MotorConstant(RobotMap.Component.indexer.indexerMotor1, speed1),
new MotorConstant(RobotMap.Component.indexer.indexerMotor2, speed2)
);
}
}

This file was deleted.

19 changes: 19 additions & 0 deletions src/main/java/org/usfirst/frc4904/robot/subsystems/Indexer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package org.usfirst.frc4904.robot.subsystems;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import org.usfirst.frc4904.standard.subsystems.motor.Motor;


public class Indexer extends SubsystemBase {

public static final double DEFAULT_INDEXER_SPEED = .5; //TODO: Set value
Copy link
Contributor

Choose a reason for hiding this comment

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

0.5 is probably better than .5.

public final Motor indexerMotor1;
public final Motor indexerMotor2;
public Indexer(Motor indexerMotor1, Motor indexerMotor2) {
this.indexerMotor1 = indexerMotor1;
this.indexerMotor2 = indexerMotor2;
Copy link
Contributor

Choose a reason for hiding this comment

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

check indentation here

}
}