generated from StuyPulse/Phil
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from StuyPulse/se/elevator
Se/elevator
- Loading branch information
Showing
22 changed files
with
712 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
{ | ||
"keyboardJoysticks": [ | ||
{ | ||
"axisConfig": [ | ||
{ | ||
"decKey": 65, | ||
"incKey": 68 | ||
}, | ||
{ | ||
"decKey": 87, | ||
"incKey": 83 | ||
}, | ||
{ | ||
"decKey": 69, | ||
"decayRate": 0.0, | ||
"incKey": 82, | ||
"keyRate": 0.009999999776482582 | ||
} | ||
], | ||
"axisCount": 3, | ||
"buttonCount": 4, | ||
"buttonKeys": [ | ||
90, | ||
88, | ||
67, | ||
86 | ||
], | ||
"povConfig": [ | ||
{ | ||
"key0": 328, | ||
"key135": 323, | ||
"key180": 322, | ||
"key225": 321, | ||
"key270": 324, | ||
"key315": 327, | ||
"key45": 329, | ||
"key90": 326 | ||
} | ||
], | ||
"povCount": 1 | ||
}, | ||
{ | ||
"axisConfig": [ | ||
{ | ||
"decKey": 74, | ||
"incKey": 76 | ||
}, | ||
{ | ||
"decKey": 73, | ||
"incKey": 75 | ||
} | ||
], | ||
"axisCount": 2, | ||
"buttonCount": 4, | ||
"buttonKeys": [ | ||
77, | ||
44, | ||
46, | ||
47 | ||
], | ||
"povCount": 0 | ||
}, | ||
{ | ||
"axisConfig": [ | ||
{ | ||
"decKey": 263, | ||
"incKey": 262 | ||
}, | ||
{ | ||
"decKey": 265, | ||
"incKey": 264 | ||
} | ||
], | ||
"axisCount": 2, | ||
"buttonCount": 6, | ||
"buttonKeys": [ | ||
260, | ||
268, | ||
266, | ||
261, | ||
269, | ||
267 | ||
], | ||
"povCount": 0 | ||
}, | ||
{ | ||
"axisCount": 0, | ||
"buttonCount": 0, | ||
"povCount": 0 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"NTProvider": { | ||
"types": { | ||
"/FMSInfo": "FMSInfo", | ||
"/SmartDashboard/Autonomous": "String Chooser", | ||
"/SmartDashboard/Visualizers/Elevator": "Mechanism2d" | ||
}, | ||
"windows": { | ||
"/SmartDashboard/Visualizers/Elevator": { | ||
"window": { | ||
"visible": true | ||
} | ||
} | ||
} | ||
}, | ||
"NetworkTables": { | ||
"transitory": { | ||
"SmartDashboard": { | ||
"Elevator": { | ||
"open": true | ||
}, | ||
"open": true | ||
} | ||
} | ||
}, | ||
"NetworkTables Info": { | ||
"visible": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/java/com/stuypulse/robot/commands/elevator/ElevatorToBottom.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.stuypulse.robot.commands.elevator; | ||
|
||
import com.stuypulse.robot.constants.Constants.Elevator; | ||
|
||
public class ElevatorToBottom extends ElevatorToHeight{ | ||
public ElevatorToBottom(){ | ||
super(Elevator.MIN_HEIGHT_METERS); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/stuypulse/robot/commands/elevator/ElevatorToHandoff.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.stuypulse.robot.commands.elevator; | ||
|
||
import com.stuypulse.robot.constants.Settings.Elevator; | ||
|
||
public class ElevatorToHandoff extends ElevatorToHeight{ | ||
public ElevatorToHandoff() { | ||
super(Elevator.HANDOFF_HEIGHT_METERS); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/com/stuypulse/robot/commands/elevator/ElevatorToHeight.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.stuypulse.robot.commands.elevator; | ||
|
||
import com.stuypulse.robot.subsystems.elevator.Elevator; | ||
|
||
import edu.wpi.first.wpilibj2.command.InstantCommand; | ||
import edu.wpi.first.wpilibj2.command.WaitUntilCommand; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
|
||
public class ElevatorToHeight extends InstantCommand { | ||
|
||
public static Command untilDone(double height) { | ||
return new ElevatorToHeight(height) | ||
.andThen(new WaitUntilCommand(() -> Elevator.getInstance().atTargetHeight())); | ||
} | ||
|
||
private final Elevator elevator; | ||
private final double targetHeight; | ||
|
||
public ElevatorToHeight(double targetHeight){ | ||
elevator = Elevator.getInstance(); | ||
this.targetHeight = targetHeight; | ||
|
||
addRequirements(elevator); | ||
} | ||
|
||
public void initialize(){ | ||
elevator.setTargetHeight(targetHeight); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/stuypulse/robot/commands/elevator/ElevatorToLvl2Alt.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.stuypulse.robot.commands.elevator; | ||
|
||
import com.stuypulse.robot.constants.Settings.Elevator; | ||
|
||
public class ElevatorToLvl2Alt extends ElevatorToHeight{ | ||
public ElevatorToLvl2Alt(){ | ||
super(Elevator.ALT_L2_HEIGHT_METERS); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/stuypulse/robot/commands/elevator/ElevatorToLvl2Funnel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.stuypulse.robot.commands.elevator; | ||
|
||
import com.stuypulse.robot.constants.Settings.Elevator; | ||
|
||
public class ElevatorToLvl2Funnel extends ElevatorToHeight{ | ||
public ElevatorToLvl2Funnel(){ | ||
super(Elevator.FUNNEL_L2_HEIGHT_METERS); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/stuypulse/robot/commands/elevator/ElevatorToLvl3Alt.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.stuypulse.robot.commands.elevator; | ||
|
||
import com.stuypulse.robot.constants.Settings.Elevator; | ||
|
||
public class ElevatorToLvl3Alt extends ElevatorToHeight{ | ||
public ElevatorToLvl3Alt () { | ||
super(Elevator.ALT_L3_HEIGHT_METERS); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/stuypulse/robot/commands/elevator/ElevatorToLvl3Funnel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.stuypulse.robot.commands.elevator; | ||
|
||
import com.stuypulse.robot.constants.Settings.Elevator; | ||
|
||
public class ElevatorToLvl3Funnel extends ElevatorToHeight{ | ||
public ElevatorToLvl3Funnel() { | ||
super(Elevator.FUNNEL_L3_HEIGHT_METERS); | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/stuypulse/robot/commands/elevator/ElevatorToLvl4Alt.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.stuypulse.robot.commands.elevator; | ||
|
||
import com.stuypulse.robot.constants.Settings.Elevator; | ||
|
||
public class ElevatorToLvl4Alt extends ElevatorToHeight{ | ||
public ElevatorToLvl4Alt(){ | ||
super(Elevator.ALT_L4_HEIGHT_METERS); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/stuypulse/robot/commands/elevator/ElevatorToLvl4Funnel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.stuypulse.robot.commands.elevator; | ||
|
||
import com.stuypulse.robot.constants.Settings.Elevator; | ||
|
||
public class ElevatorToLvl4Funnel extends ElevatorToHeight{ | ||
public ElevatorToLvl4Funnel() { | ||
super(Elevator.FUNNEL_L4_HEIGHT_METERS); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/stuypulse/robot/commands/elevator/ElevatorToTop.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.stuypulse.robot.commands.elevator; | ||
|
||
import com.stuypulse.robot.constants.Constants; | ||
|
||
public class ElevatorToTop extends ElevatorToHeight{ | ||
public ElevatorToTop() { | ||
super(Constants.Elevator.MAX_HEIGHT_METERS); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/stuypulse/robot/constants/Constants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.stuypulse.robot.constants; | ||
|
||
import edu.wpi.first.math.util.Units; | ||
|
||
public class Constants { | ||
public interface Elevator { | ||
double MIN_HEIGHT_METERS = Units.inchesToMeters(9.09375); // FROM THE BOTTOM OF FIXED STAGE TO TOP OF CARRIAGE | ||
double MAX_HEIGHT_METERS = Units.inchesToMeters(77); // FROM THE BOTTOM OF FIXED STAGE TO TOP ELEVATOR | ||
|
||
double MASS_KG = 10.0; | ||
double DRUM_RADIUS_METERS = (MAX_HEIGHT_METERS / Encoders.NUM_ROTATIONS_TO_REACH_TOP * Encoders.GEARING) / 2 / Math.PI; | ||
|
||
public interface Encoders { | ||
double GEARING = 4.0; | ||
|
||
double NUM_ROTATIONS_TO_REACH_TOP = (6 + 9.0 / 24) * GEARING; // Number of rotations that the motor has to spin, NOT the gear | ||
|
||
double POSITION_CONVERSION_FACTOR = MAX_HEIGHT_METERS / NUM_ROTATIONS_TO_REACH_TOP; | ||
double VELOCITY_CONVERSION_FACTOR = MAX_HEIGHT_METERS / NUM_ROTATIONS_TO_REACH_TOP / 60; | ||
|
||
double DISTANCE_PER_ROTATION = 0.0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.