Skip to content

Commit

Permalink
Merge pull request #3 from SciBorgs/ground-intake
Browse files Browse the repository at this point in the history
Ground intake
  • Loading branch information
Unclesdad authored Jan 25, 2025
2 parents 6e5f172 + d64a24d commit e2ecbd1
Show file tree
Hide file tree
Showing 16 changed files with 548 additions and 92 deletions.
43 changes: 12 additions & 31 deletions simgui-ds.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,23 @@
{
"FMS": {
"window": {
"visible": false
}
},
"Keyboard 0 Settings": {
"window": {
"visible": true
}
},
"keyboardJoysticks": [
{
"axisConfig": [
{
"decKey": 83,
"incKey": 87
},
{
"decKey": 65,
"incKey": 68
},
{
"decKey": 87,
"incKey": 83
},
{
"decKey": 69,
"decayRate": 0.0,
"incKey": 82,
"keyRate": 0.009999999776482582
},
{},
{
"decKey": 74,
"incKey": 75
}
],
"axisCount": 6,
"axisCount": 3,
"buttonCount": 4,
"buttonKeys": [
90,
Expand All @@ -56,12 +41,16 @@
},
{
"axisConfig": [
{},
{
"decKey": 73
"decKey": 74,
"incKey": 76
},
{
"decKey": 73,
"incKey": 75
}
],
"axisCount": 4,
"axisCount": 2,
"buttonCount": 4,
"buttonKeys": [
77,
Expand Down Expand Up @@ -99,13 +88,5 @@
"buttonCount": 0,
"povCount": 0
}
],
"robotJoysticks": [
{
"guid": "Keyboard1"
},
{
"guid": "Keyboard0"
}
]
}
20 changes: 12 additions & 8 deletions simgui.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@
"/FMSInfo": "FMSInfo",
"/Faults/Active Faults": "Alerts",
"/Faults/Total Faults": "Alerts",
<<<<<<< HEAD
"/Robot/arm/armCanvas": "Mechanism2d",
"/Robot/arm/fb": "ProfiledPIDController",
=======
>>>>>>> main
"/Robot/autos": "String Chooser",
"/Robot/drive/field2d": "Field2d",
"/Robot/drive/frontLeft/driveFeedback": "PIDController",
"/Robot/drive/frontLeft/turnFeedback": "PIDController",
"/Robot/drive/frontRight/driveFeedback": "PIDController",
"/Robot/drive/frontRight/turnFeedback": "PIDController",
"/Robot/drive/rearLeft/driveFeedback": "PIDController",
"/Robot/drive/rearLeft/turnFeedback": "PIDController",
"/Robot/drive/rearRight/driveFeedback": "PIDController",
"/Robot/drive/rearRight/turnFeedback": "PIDController",
"/Robot/drive/rotationController": "PIDController",
"/Robot/drive/translationController": "ProfiledPIDController",
"/Robot/elevator/measurement/mech": "Mechanism2d",
Expand All @@ -37,6 +34,8 @@
"/SmartDashboard/Alerts": "Alerts",
"/SmartDashboard/Scheduler": "Scheduler",
"/SmartDashboard/VisionSystemSim-main/Sim Field": "Field2d",
<<<<<<< HEAD
=======
"/SmartDashboard/drive dynamic backward": "Command",
"/SmartDashboard/drive dynamic forward": "Command",
"/SmartDashboard/drive quasistatic backward": "Command",
Expand All @@ -45,6 +44,7 @@
"/SmartDashboard/pivot dynamic forward": "Command",
"/SmartDashboard/pivot quasistatic backward": "Command",
"/SmartDashboard/pivot quasistatic forward": "Command",
>>>>>>> main
"/SmartDashboard/rotation dynamic backward": "Command",
"/SmartDashboard/rotation dynamic forward": "Command",
"/SmartDashboard/rotation quasistatic backward": "Command",
Expand Down Expand Up @@ -202,7 +202,11 @@
0.0,
0.8500000238418579
],
<<<<<<< HEAD
"height": 0,
=======
"height": 405,
>>>>>>> main
"series": [
{
"color": [
Expand Down
33 changes: 28 additions & 5 deletions src/main/java/org/sciborgs1155/lib/SimpleMotor.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,51 @@

import com.ctre.phoenix6.configs.TalonFXConfiguration;
import com.ctre.phoenix6.hardware.TalonFX;
import com.revrobotics.spark.SparkBase;
import java.util.function.DoubleConsumer;

/**
* Simple Motor that utilizes a {@link DoubleConsumer} for setting power and provides no feedback.
* Can work with {@link TalonFX}'s and {@link SparkBase}'s. Can be closed with the specified {@link
* Runnable}.
*/
public class SimpleMotor {
/** Function for setting motor power. */
private final DoubleConsumer set;

/** Function for closing the motor. */
private final Runnable close;

/**
* Constructor.
*
* @param set : {@link DoubleConsumer} for setting motor power.
* @param close : {@link Runnable} interface for the motor.
*/
public SimpleMotor(DoubleConsumer set, Runnable close) {
this.set = set;
this.close = close;
}

public static SimpleMotor talon(TalonFX talon, TalonFXConfiguration config) {
FaultLogger.register(talon);
TalonUtils.addMotor(talon);
talon.getConfigurator().apply(config);
return new SimpleMotor(talon::set, talon::close);
/**
* @return Returns a new {@link SimpleMotor} that controls a {@link TalonFX} motor. The motor is
* registered with {@link TalonUtils} and {@link FaultLogger}.
* @param motor : {@link TalonFX} controller instance with device ID.
* @param config : {@link TalonFXConfiguration} to apply to the motor.
*/
public static SimpleMotor talon(TalonFX motor, TalonFXConfiguration config) {
FaultLogger.register(motor);
TalonUtils.addMotor(motor);
motor.getConfigurator().apply(config);
return new SimpleMotor(motor::set, motor::close);
}

/** Returns a new {@link SimpleMotor} that does absolutely nothing. */
public static SimpleMotor none() {
return new SimpleMotor(v -> {}, () -> {});
}

/** Passes power into the '{@link #set}' consumer specified in the constructor. */
public void set(double power) {
set.accept(power);
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/org/sciborgs1155/robot/Ports.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ public static final class Drive {
public static final int REAR_RIGHT_TURNING = 17;
}

public static final class GroundIntake {
public static final int ARM_MOTOR = 18;
public static final int ROLLER_MOTOR = 19;
public static final int CANCODER = 2; // TODO change i think
}

public static final class Elevator {
public static final int LEADER = -1;
public static final int FOLLOWER = -1;
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/org/sciborgs1155/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import static edu.wpi.first.units.Units.Seconds;
import static edu.wpi.first.wpilibj2.command.button.RobotModeTriggers.*;
import static org.sciborgs1155.robot.Constants.*;
import static org.sciborgs1155.robot.Constants.DEADBAND;
import static org.sciborgs1155.robot.Constants.Field.*;
import static org.sciborgs1155.robot.Constants.PERIOD;
import static org.sciborgs1155.robot.drive.DriveConstants.*;

import edu.wpi.first.wpilibj.DataLogManager;
Expand All @@ -30,7 +32,9 @@
import org.sciborgs1155.lib.InputStream;
import org.sciborgs1155.lib.Test;
import org.sciborgs1155.robot.Ports.OI;
import org.sciborgs1155.robot.arm.Arm;
import org.sciborgs1155.robot.commands.Autos;
import org.sciborgs1155.robot.coroller.Coroller;
import org.sciborgs1155.robot.drive.Drive;
import org.sciborgs1155.robot.elevator.Elevator;
import org.sciborgs1155.robot.led.LEDStrip;
Expand All @@ -53,6 +57,8 @@ public class Robot extends CommandRobot implements Logged {
// SUBSYSTEMS
private final Drive drive = Drive.create();
private final Vision vision = Vision.create();
private final Arm arm = Arm.create();
private final Coroller coroller = Coroller.create();
private final LEDStrip led = new LEDStrip();
private final Elevator elevator = Elevator.create();
private final Scoral scoral = Scoral.create();
Expand All @@ -71,7 +77,8 @@ public Robot() {

/** Configures basic behavior for different periods during the game. */
private void configureGameBehavior() {
// TODO: Add configs for all additional libraries, components, intersubsystem interaction
// TODO: Add configs for all additional libraries, components, intersubsystem
// interaction
// Configure logging with DataLogManager, Monologue, URCL, and FaultLogger
DataLogManager.start();
Monologue.setupMonologue(this, "/Robot", false, true);
Expand Down Expand Up @@ -153,6 +160,7 @@ private void configureBindings() {
.onFalse(Commands.runOnce(() -> speedMultiplier = Constants.FULL_SPEED_MULTIPLIER));

// TODO: Add any additional bindings.

}

/**
Expand Down
Loading

0 comments on commit e2ecbd1

Please sign in to comment.