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

Subsystems #16

Merged
merged 106 commits into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from 97 commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
8eef425
Recreate shooter branch from refactored Ethan code
ky28059 Jan 22, 2022
6b9795a
Skeleton `shoot()` method, some cleanup
ky28059 Jan 22, 2022
5a6a63c
Add hood SparkMax
ky28059 Jan 22, 2022
7869f26
Remember to add a constant :flushed:
ky28059 Jan 22, 2022
80c540f
PID testing
ky28059 Jan 24, 2022
95c6d92
editing jetson socket so it's using constants instead of bigdata
PinkBlueSky Nov 29, 2021
e964458
add networktables
PinkBlueSky Dec 4, 2021
60c0fe6
Add Jetson NT testing code
PinkBlueSky Dec 23, 2021
a838f10
Update NetworkTables data to match vision code
PinkBlueSky Jan 12, 2022
4e5d7d1
Clean up
PinkBlueSky Jan 12, 2022
a32be45
editing jetson socket so it's using constants instead of bigdata
PinkBlueSky Nov 29, 2021
e1c656e
Update NetworkTables data to match vision code
PinkBlueSky Jan 12, 2022
771a6d0
Clean up
PinkBlueSky Jan 12, 2022
1e228a5
Add httpcamera for testing camera stream
PinkBlueSky Jan 18, 2022
ea89429
Update Jetson stuff
PinkBlueSky Jan 24, 2022
b182dcc
Jetson refactoring
ky28059 Jan 24, 2022
ba229f8
Add velocity closed loop testing code
ky28059 Jan 24, 2022
aba0c35
Jetson restructuring, `periodic()` skeleton code
ky28059 Jan 25, 2022
3628ccc
Rename shooter to turret
ky28059 Jan 25, 2022
ec6c912
Jetson camera wrapper
e3l Apr 13, 2021
53ca0d9
added elevator and tank implementation
eggaskin Jul 18, 2021
6c354e8
Tank drive code, untested
e3l Jul 23, 2021
41947c4
add elevator config
Ayeeti Jul 24, 2021
ec1fb2e
reviewed added code, default commands added
eggaskin Jul 24, 2021
895a8ca
elevator commands and controller setup
eggaskin Jul 24, 2021
caf8876
Working tank and elevator subsystems
e3l Jul 24, 2021
86ff301
overhaul subsystem structure + overhaul config file
PinkBlueSky Nov 3, 2021
f6ccf16
fix end method in dtcommand
PinkBlueSky Nov 4, 2021
0580c63
improved handling of elevatorUpIsPositive const
PinkBlueSky Nov 4, 2021
d74c171
change elevator command structure
PinkBlueSky Nov 4, 2021
d6a74b3
put in config txt thing again
PinkBlueSky Nov 5, 2021
4801a91
Use `WPI_TalonSRX`, `DifferentialDrive`
ky28059 Nov 5, 2021
4284a6a
Use builtin `squareInput`
ky28059 Nov 5, 2021
c4b7f9b
Add third set of Talons
ky28059 Nov 6, 2021
c6bbf32
Remove `DifferentialDrive`
ky28059 Nov 6, 2021
7092ec8
Revert "Add third set of Talons"
ky28059 Nov 8, 2021
d2e69af
add joystick code
PinkBlueSky Nov 9, 2021
b4d3e6d
Add joystick capability
PinkBlueSky Nov 9, 2021
616ed2b
Add controller switching
PinkBlueSky Nov 10, 2021
63557e0
code for testing gyro, ecoder, limit switch, and color+distance senso…
Ippyb Nov 11, 2021
6113c80
sensor testing code
Ippyb Nov 12, 2021
618698e
skeleton code for internal subsystem. Includes 2 color sensors, a tal…
Ippyb Jan 25, 2022
85ab34f
Merge commit part 2
ky28059 Jan 25, 2022
6b76b7e
Internals refactoring
ky28059 Jan 25, 2022
9b31309
Initiate InternalSubsystem in RobotContainer
ky28059 Jan 25, 2022
0247322
shooter request updates
Ippyb Jan 25, 2022
928296d
added a skeleton method for launching ball into shooter
Ippyb Jan 25, 2022
00341fc
Add `turntableAligned()` for internals
ky28059 Jan 25, 2022
e324fda
Change initialization to constructor arguments
ky28059 Jan 25, 2022
efbf728
Skeleton climb code, cleanup
ky28059 Jan 26, 2022
faa7057
Intake skeleton
ky28059 Jan 26, 2022
1aff5e9
Use intake enum, add intake commands
ky28059 Jan 26, 2022
74f2034
Reformat to 4 spaces
ky28059 Jan 26, 2022
69ed17b
Initialize new subsystems in RobotContainer
ky28059 Jan 26, 2022
a3a550b
Fix tank spacing, better comments
ky28059 Jan 26, 2022
bf50f24
added motorport2 constant
Ippyb Jan 27, 2022
eb1efbd
added a ballDetected method, updated fields to include another motor,…
Ippyb Jan 27, 2022
cfa8232
Restructure intake position, PID constant splitting
ky28059 Jan 27, 2022
816ded7
Implement new climb design
ky28059 Jan 27, 2022
86ae2b9
updateBallCount
Ippyb Jan 27, 2022
32f2957
Intake / internals integration
ky28059 Jan 27, 2022
006ec8d
merge
Ippyb Jan 27, 2022
a3026e1
Ball count tracking code
ky28059 Jan 27, 2022
8b62eab
Jetson constants organization, better reject logic
ky28059 Jan 27, 2022
cf39104
Set up shuffleboard for PID testing
ky28059 Jan 27, 2022
a51be8d
Fix internals motor flow
ky28059 Jan 29, 2022
f30735b
Use enum for turret mode
ky28059 Jan 29, 2022
6a0455f
got rid of TODOs
Ippyb Jan 29, 2022
4eb635c
Roughly implement the climb plan
ky28059 Jan 29, 2022
9f938d6
775 instead of NEO for turret hood
ky28059 Jan 30, 2022
0cfb1d7
Update internals with IR sensors
ky28059 Jan 30, 2022
e44aa10
Use command groups for climb
ky28059 Jan 30, 2022
6b04bdf
Implement module states for turret
ky28059 Jan 31, 2022
1567ebb
Final-ish button bindings
ky28059 Jan 31, 2022
e7457fd
Final rebase commit
ky28059 Feb 5, 2022
78304f7
`GRTSubsystem` changes, subsystem implementation
ky28059 Feb 5, 2022
fafe085
Implement driver intake running
ky28059 Feb 5, 2022
3756f47
Non-conflicting motor ports
ky28059 Feb 5, 2022
d84a257
New constants, third tank NEO
ky28059 Feb 6, 2022
c423b78
Turntable blind spot logic, soft limits
ky28059 Feb 8, 2022
ec5d32b
Degree conversion constant stubs
ky28059 Feb 8, 2022
13e7218
Remove mjpg prefix in jetson
ky28059 Feb 10, 2022
8aec56b
Working vision :D
PinkBlueSky Feb 10, 2022
6d121d4
merge w/ shooter
PinkBlueSky Feb 10, 2022
5696781
Temporary intake + DT testing code
ky28059 Feb 11, 2022
925c376
Replace exit with staging sensor
ky28059 Feb 11, 2022
02a8938
Testing of subsystems, lowered periodic loop times, moved localizatio…
e3l Feb 12, 2022
83e6dce
Enforce style
ky28059 Feb 12, 2022
5cdf834
Better `ModuleState` names
ky28059 Feb 12, 2022
0ce7f0a
Jetson reformatting
ky28059 Feb 12, 2022
de26a40
Fix internals current drawn method
ky28059 Feb 12, 2022
3b0c672
More subsystem testing and some refactoring
e3l Feb 12, 2022
7f98e7c
Enforce style again.
ky28059 Feb 12, 2022
4f72785
Attempt turret `r` and `theta` state system
ky28059 Feb 12, 2022
236f2aa
Bare bones intake testing
PinkBlueSky Feb 12, 2022
45a8e75
Internals color sensor thread
e3l Feb 13, 2022
14852ea
Measure color constants, reduce IO waste
ky28059 Feb 13, 2022
4723954
More testing setup
ky28059 Feb 15, 2022
440fd45
Upgrade to WPILib 2022.3.1
e3l Feb 15, 2022
4bf42d8
Update encoder value; comment out internals
PinkBlueSky Feb 15, 2022
9a63384
Button binding fix, use integrated encoders for DT
ky28059 Feb 15, 2022
4a37533
Intake, internals, turret testing
ky28059 Feb 16, 2022
e5dacb3
Boolean state for storage rejection checking
ky28059 Feb 16, 2022
550318e
More internals testing
ky28059 Feb 16, 2022
f42e420
Internals testing part 2 -- dummy shoot method
ky28059 Feb 16, 2022
6b3fead
Shooter testing
ky28059 Feb 17, 2022
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 src/main/deploy/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ outtake_speed=.9

# limit switch variables (currently hardcoded, ignore these)
top_switch=0
bottom_switch=1
bottom_switch=1
55 changes: 47 additions & 8 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

package frc.robot;

import edu.wpi.first.wpilibj.util.Color;

/**
* The Constants class provides a convenient place for teams to hold robot-wide
* numerical or boolean constants. This class should not be used for any other
Expand All @@ -16,17 +18,54 @@
*/
public final class Constants {
public static final class TankConstants {
public static final int fLeftMotorPort = 14;
public static final int bLeftMotorPort = 15;
public static final int fLeftMotorPort = 4;
public static final int mLeftMotorPort = 5;
public static final int bLeftMotorPort = 6;

public static final int fRightMotorPort = 9;
public static final int mRightMotorPort = 8;
public static final int bRightMotorPort = 7;
}

public static final class TurretConstants {
public static final int turntablePort = 17;
public static final int hoodPort = 16;
public static final int flywheelPort = 15;
}

public static final class InternalConstants {
public static final double RAISE_POW = 0.8;

public static final int motorPortBottom = 13;
public static final int motorPortTop = 14;

public static final int fRightMotorPort = 2;
public static final int bRightMotorPort = 1;
public static final int entranceIRPort = 0;
public static final int exitIRPort = 3;
}

public static final class ElevatorConstants {
public static final int mainMotorPort = 5;
public static final int followMotorPort = 6;
public static final class IntakeConstants {
public static final int intakePort = 12;
public static final int deploymentPort = 11;
}

public static final class ClimbConstants {
public static final int sixMotorPort = 0;
public static final int sixBrakePort = 1;

public static final int tenMotorPort = 3;
public static final int tenBrakePort = 2;

public static final int tenLeftSolenoidPort = 18;
public static final int tenRightSolenoidPort = 18;

public static final int fifteenLeftPort = 10;
public static final int fifteenRightPort = 19;
}

public static final boolean elevatorUpIsPositive = true;
public static final class JetsonConstants {
public static final int turretCameraPort = 1181;
public static final int intakeCameraPort = 1182;
public static final int jetsonPort = 1337;
public static final String jetsonIP = "10.1.92.94";
}
}
18 changes: 4 additions & 14 deletions src/main/java/frc/robot/GRTSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@
* A convenience class wrapping SubsystemBase for brownout and other shared subsystem logic.
*/
public abstract class GRTSubsystem extends SubsystemBase {
protected int currentLimit;
protected final double minCurrent;

/**
* Creates a GRTSubsystem from a given initial current limit and minimum current.
* @param currentLimit The initial (maximum) current limit.
* Creates a GRTSubsystem from the given minimum current.
* @param minCurrent The minimum current.
*/
public GRTSubsystem(int currentLimit, double minCurrent) {
this.currentLimit = currentLimit;
public GRTSubsystem(double minCurrent) {
this.minCurrent = minCurrent;
}

Expand All @@ -27,14 +24,6 @@ public double getMinCurrent() {
return minCurrent;
}

/**
* Gets the subsystem's current current limit.
* @return The current limit.
*/
public int getCurrentLimit() {
return currentLimit;
}

/**
* Gets the total current being drawn by the subsystem. Implementers should use `PowerController.getCurrentDrawnFromPDH`
* with all the subsystem's motor controller ports.
Expand All @@ -43,7 +32,8 @@ public int getCurrentLimit() {
abstract public double getTotalCurrentDrawn();

/**
* Sets the subsystem's current limit.
* Sets the subsystem's current limit. Implementers should split the subsystem's limit between their motor controllers and
* call `setSmartCurrentLimit()` or the Talon equivalent to enforce the limit.
* @param limit The current limit (in amps) for the subsystem.
*/
abstract public void setCurrentLimit(double limit);
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/frc/robot/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
* call.
*/
public final class Main {
private Main() {}
private Main() {}

/**
* Main initialization function. Do not perform any initialization here.
*
* <p>If you change your main robot class, change the parameter type.
*/
public static void main(String... args) {
RobotBase.startRobot(Robot::new);
}
/**
* Main initialization function. Do not perform any initialization here.
*
* <p>If you change your main robot class, change the parameter type.
*/
public static void main(String... args) {
RobotBase.startRobot(Robot::new);
}
}
150 changes: 75 additions & 75 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,84 +15,84 @@
* project.
*/
public class Robot extends TimedRobot {
private Command autonomousCommand;

private RobotContainer robotContainer;

/**
* This function is run when the robot is first started up and should be used for any
* initialization code.
*/
@Override
public void robotInit() {
// Instantiate our RobotContainer. This will perform all our button bindings, and put our
// autonomous chooser on the dashboard.
robotContainer = new RobotContainer();
}

/**
* This function is called every robot packet, no matter the mode. Use this for items like
* diagnostics that you want ran during disabled, autonomous, teleoperated and test.
*
* <p>This runs after the mode specific periodic functions, but before LiveWindow and
* SmartDashboard integrated updating.
*/
@Override
public void robotPeriodic() {
// Runs the Scheduler. This is responsible for polling buttons, adding newly-scheduled
// commands, running already-scheduled commands, removing finished or interrupted commands,
// and running subsystem periodic() methods. This must be called from the robot's periodic
// block in order for anything in the Command-based framework to work.
CommandScheduler.getInstance().run();

// Calculate current limits for subsystems
robotContainer.getPowerController().calculateLimits();
}

/** This function is called once each time the robot enters Disabled mode. */
@Override
public void disabledInit() {}

@Override
public void disabledPeriodic() {}

/** This autonomous runs the autonomous command selected by your {@link RobotContainer} class. */
@Override
public void autonomousInit() {
autonomousCommand = robotContainer.getAutonomousCommand();

// schedule the autonomous command (example)
if (autonomousCommand != null) {
autonomousCommand.schedule();
private Command autonomousCommand;

private RobotContainer robotContainer;

/**
* This function is run when the robot is first started up and should be used for any
* initialization code.
*/
@Override
public void robotInit() {
// Instantiate our RobotContainer. This will perform all our button bindings, and put our
// autonomous chooser on the dashboard.
robotContainer = new RobotContainer();
}
}

/** This function is called periodically during autonomous. */
@Override
public void autonomousPeriodic() {}

@Override
public void teleopInit() {
// This makes sure that the autonomous stops running when
// teleop starts running. If you want the autonomous to
// continue until interrupted by another command, remove
// this line or comment it out.
if (autonomousCommand != null) {
autonomousCommand.cancel();

/**
* This function is called every robot packet, no matter the mode. Use this for items like
* diagnostics that you want ran during disabled, autonomous, teleoperated and test.
*
* <p>This runs after the mode specific periodic functions, but before LiveWindow and
* SmartDashboard integrated updating.
*/
@Override
public void robotPeriodic() {
// Runs the Scheduler. This is responsible for polling buttons, adding newly-scheduled
// commands, running already-scheduled commands, removing finished or interrupted commands,
// and running subsystem periodic() methods. This must be called from the robot's periodic
// block in order for anything in the Command-based framework to work.
CommandScheduler.getInstance().run();

// Calculate current limits for subsystems
robotContainer.getPowerController().calculateLimits();
}
}

/** This function is called periodically during operator control. */
@Override
public void teleopPeriodic() {}
/** This function is called once each time the robot enters Disabled mode. */
@Override
public void disabledInit() {}

@Override
public void disabledPeriodic() {}

/** This autonomous runs the autonomous command selected by your {@link RobotContainer} class. */
@Override
public void autonomousInit() {
autonomousCommand = robotContainer.getAutonomousCommand();

// schedule the autonomous command (example)
if (autonomousCommand != null) {
autonomousCommand.schedule();
}
}

@Override
public void testInit() {
// Cancels all running commands at the start of test mode.
CommandScheduler.getInstance().cancelAll();
}
/** This function is called periodically during autonomous. */
@Override
public void autonomousPeriodic() {}

@Override
public void teleopInit() {
// This makes sure that the autonomous stops running when
// teleop starts running. If you want the autonomous to
// continue until interrupted by another command, remove
// this line or comment it out.
if (autonomousCommand != null) {
autonomousCommand.cancel();
}
}

/** This function is called periodically during operator control. */
@Override
public void teleopPeriodic() {}

@Override
public void testInit() {
// Cancels all running commands at the start of test mode.
CommandScheduler.getInstance().cancelAll();
}

/** This function is called periodically during test mode. */
@Override
public void testPeriodic() {}
/** This function is called periodically during test mode. */
@Override
public void testPeriodic() {}
}
Loading