-
Notifications
You must be signed in to change notification settings - Fork 1
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
Merge first (and second) competition code into master #26
Draft
TheBitEffect
wants to merge
88
commits into
master
Choose a base branch
from
first-comp
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 81 commits
Commits
Show all changes
88 commits
Select commit
Hold shift + click to select a range
c6d9c7d
Add Climbing.java
aidenpike f4050d8
Merge branch 'master' into climbing
6970b43
changed Climbing.java
aidenpike ebe30f5
Update Climbing.java
aidenpike 75e6903
Refactor LoggableTimer to accept name
aidenpike d5138db
Merge branch 'climbing' of https://github.com/RAR1741/RA22_RobotCode …
aidenpike ed360cf
Implement timer and cycle algorithm
aidenpike b7a0dc9
Add ClimbingSensors class
aidenpike 91f05a3
Implement ClimbingSensors
aidenpike b91979b
Add climberEnabled
aidenpike 0636f20
Declared climbing variables
HungryIronApple eca328d
Added setPower method
HungryIronApple 2261878
Add climber controls
HungryIronApple cbbb8af
Merge branch 'master' into climbing
dracco1993 5dfdd72
Merge branch 'master' into climbing
dracco1993 6fe4207
Merge branch 'master' into climbing
TheBitEffect fd60b36
Merge branch 'master' into climbing
TheBitEffect 95eab83
Merge branch 'master' into climbing
TheBitEffect 0dfb898
Merge branch 'master' into climbing
dracco1993 e432045
LoggableTimer formatting
dracco1993 801fc33
Climbing -> Climber and ClimbingSensors -> ClimberSensors
dracco1993 187354a
More auto formatting
dracco1993 5b9cd23
Move to passing the Solenoids into the climber
dracco1993 bf2571c
Add temporary manual climber driver controls
dracco1993 40ea3cc
Test Climber Controls
rar1741programmer a56be21
Fix possibly missing break statements in climber
TheBitEffect 42b8a1d
TEMP: Advance climber state manually
TheBitEffect c3810c5
Changed Idle Mode
rar1741programmer e2f28f8
Merge branch 'climbing' of https://github.com/RAR1741/RA22_RobotCode …
rar1741programmer dd21d55
add loggablegyro
kryllyxofficial01 d3da78b
whitespace
kryllyxofficial01 4a0bcaf
Add To-Do Reminder Comment
aidenpike 96284aa
Merge branch 'LoggableGyro' into climbing
kryllyxofficial01 8598fc5
Merge branch 'climbing' of https://github.com/RAR1741/RA22_RobotCode …
aidenpike af09047
add motorstates
kryllyxofficial01 755d9a0
Merge branch 'climbing' of https://github.com/RAR1741/RA22_RobotCode …
kryllyxofficial01 b84cf4d
add instances for motor states
kryllyxofficial01 21ce2b6
Formatting
dracco1993 2b32468
Add FirstOrderFilter
dracco1993 8b59184
remove extra motor state method
kryllyxofficial01 9699d1c
Fix LoggableFirstOrderFilter
dracco1993 a1d1bb7
Fix conflict in setMotorState
dracco1993 f7b6dea
Merge branch 'climbing' of https://github.com/RAR1741/RA22_RobotCode …
dracco1993 a53e235
Ops...
dracco1993 2495ead
Log both climber filters
dracco1993 cca5439
Add more manual controls for testing
sreeves750 8ec5aba
Merge branch 'climbing' of https://github.com/RAR1741/RA22_RobotCode …
sreeves750 e259f8a
Update climber logging
dracco1993 443f1d7
Redfine the ClimbingStates enum
dracco1993 9044350
Put touch sensors into the same class
sreeves750 d9c9e3c
Add more climbing states
dracco1993 1f34030
Merge branch 'climbing' of https://github.com/RAR1741/RA22_RobotCode …
dracco1993 56a384f
WIP on climbing states
dracco1993 1533de4
Add automatic current shutoff
dracco1993 811be51
Ad getNextClimbingState
dracco1993 67741c1
Update next step setup
dracco1993 c2b3fe6
Comment out old code
dracco1993 efaadf8
Add next state current detection
dracco1993 1ec7032
Add climbing photogates for pistons
sreeves750 526d996
Merge branch 'climbing' of https://github.com/RAR1741/RA22_RobotCode …
sreeves750 8f6b8aa
Fix climber variable naming
dracco1993 26b50e5
Merge branch 'climbing' of https://github.com/RAR1741/RA22_RobotCode …
dracco1993 b0a398a
change wpilib version
kryllyxofficial01 c0958e8
add simulation configs
kryllyxofficial01 efac58a
modify debug configs
kryllyxofficial01 6a13a8a
fix indenting
kryllyxofficial01 d02495c
change climbingstates formatting
kryllyxofficial01 60aa96f
Initial testing for using current to change states
rar1741programmer b8af89d
Merge branch 'climbing' of https://github.com/RAR1741/RA22_RobotCode …
rar1741programmer 2a7e5cf
Set motors to predetermined velocity when climbing
sreeves750 14a3aba
Add in automatic progression with climbing gates
sreeves750 461e060
Add automatic progression after swinging
sreeves750 3411dbb
Change resting piston positions
sreeves750 b7c0e41
Manually override formatting
dracco1993 90d6976
Merge branch 'climbing' of https://github.com/RAR1741/RA22_RobotCode …
dracco1993 7c3cc73
Remove old comment section
dracco1993 5f40e26
Add more allowed words
dracco1993 a2533ad
It worked 3 times in a row...
rar1741programmer 5a1d546
Comp Code
rar1741programmer 982f8ca
Tippy code featuring autobalancing & speed control
rar1741programmer 9af3b88
Merge branch 'master' into first-comp
TheBitEffect 4ced966
Remove Shooter code
TheBitEffect 6d5ed0a
Remove Climber from Robot.java
TheBitEffect 3572b0f
Start implimenting reworked climber execution plan
TheBitEffect c8faf9a
Fix left and right loggables erroring
TheBitEffect 2e47e3e
Merge branch 'master' into first-comp
TheBitEffect 740aae1
Push state comp code
rar1741programmer ff3a96a
Merge branch 'first-comp' of https://github.com/RAR1741/RA22_RobotCod…
rar1741programmer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,28 @@ | ||
{ | ||
"auto": [ | ||
{ | ||
"type": "drive", | ||
"unit": "SECONDS", | ||
"amount": 0.1, | ||
"args": [ | ||
-0.05, | ||
-0.05 | ||
] | ||
}, | ||
{ | ||
"type": "wait", | ||
"args": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"type": "turnDeg", | ||
"unit": "DEGREES", | ||
"amount": -90, | ||
"args": [ | ||
0.1, | ||
-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,13 @@ | ||
{ | ||
"auto": [ | ||
{ | ||
"type": "drive", | ||
"unit": "FEET", | ||
"amount": 3.00, | ||
"args": [ | ||
-0.1, | ||
-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,28 @@ | ||
{ | ||
"auto": [ | ||
{ | ||
"type": "drive", | ||
"unit": "CURRENT", | ||
"amount": 20, | ||
"args": [ | ||
0.05, | ||
0.05 | ||
] | ||
}, | ||
{ | ||
"type": "wait", | ||
"args": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"type": "drive", | ||
"unit": "FEET", | ||
"amount": 5, | ||
"args": [ | ||
-0.05, | ||
-0.05 | ||
] | ||
} | ||
] | ||
} |
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,76 @@ | ||
{ | ||
"auto": [ | ||
{ | ||
"type": "drive", | ||
"unit": "INCHES", | ||
"amount": 50, | ||
"args": [ | ||
-0.05, | ||
-0.05 | ||
] | ||
}, | ||
{ | ||
"type": "turnDeg", | ||
"unit": "DEGREES", | ||
"amount": 90, | ||
"args": [ | ||
-0.05, | ||
0.05 | ||
] | ||
}, | ||
{ | ||
"type": "drive", | ||
"unit": "INCHES", | ||
"amount": 50, | ||
"args": [ | ||
-0.05, | ||
-0.05 | ||
] | ||
}, | ||
{ | ||
"type": "turnDeg", | ||
"unit": "DEGREES", | ||
"amount": 90, | ||
"args": [ | ||
-0.05, | ||
0.05 | ||
] | ||
}, | ||
{ | ||
"type": "drive", | ||
"unit": "INCHES", | ||
"amount": 50, | ||
"args": [ | ||
-0.05, | ||
-0.05 | ||
] | ||
}, | ||
{ | ||
"type": "turnDeg", | ||
"unit": "DEGREES", | ||
"amount": 90, | ||
"args": [ | ||
-0.05, | ||
0.05 | ||
] | ||
}, | ||
{ | ||
"type": "drive", | ||
"unit": "INCHES", | ||
"amount": 50, | ||
"args": [ | ||
-0.05, | ||
-0.05 | ||
] | ||
}, | ||
{ | ||
"type": "turnDeg", | ||
"unit": "DEGREES", | ||
"amount": 90, | ||
"args": [ | ||
-0.05, | ||
0.05 | ||
] | ||
} | ||
] | ||
} |
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,17 @@ | ||
{ | ||
"auto": [ | ||
{ | ||
"type": "shoot", | ||
"unit": "SPEED", | ||
"args": [ | ||
1000 | ||
] | ||
}, | ||
{ | ||
"type": "wait", | ||
"args": [ | ||
5 | ||
] | ||
} | ||
] | ||
} |
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,5 @@ | ||
package frc.robot; | ||
|
||
public abstract class Autonomous { | ||
public abstract void run(); | ||
} |
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 |
---|---|---|
@@ -1,21 +1,21 @@ | ||
|
||
package frc.robot; | ||
|
||
public class BoostInput implements InputScaler | ||
{ | ||
private final double powerCap; | ||
private boolean enabled; | ||
public class BoostInput implements InputScaler { | ||
private final double powerCap; | ||
private double boostScale; | ||
|
||
public BoostInput(double powerCap) { | ||
this.powerCap = powerCap; | ||
this.enabled = false; | ||
} | ||
public BoostInput(double powerCap) { | ||
this.powerCap = powerCap; | ||
this.boostScale = 0; | ||
} | ||
|
||
public double scale(double input) { | ||
return enabled ? input : input * powerCap; | ||
} | ||
public double scale(double input) { | ||
double scale = (1 - powerCap) * boostScale; | ||
return input * (powerCap + scale); | ||
} | ||
|
||
public void setEnabled(boolean enabled) { | ||
this.enabled = enabled; | ||
} | ||
public void setScale(double boostScale) { | ||
this.boostScale = boostScale; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -44,16 +44,18 @@ enum MotorStates { | |
} | ||
|
||
public static double MAX_INSTANT_CURRENT = 200.0; | ||
public static double MAX_AVERAGE_CURRENT = 110.0; | ||
public static double MAX_AVERAGE_CURRENT = 120.0; | ||
public static double NEXT_AB_STATE_CURRENT = 65.0; | ||
public static double NEXT_BC_STATE_CURRENT = 45.0; | ||
public static int FILTER_FRAME_RANGE = 10; | ||
|
||
public static double TOUCH_A_POSITION = 0; // TBD | ||
public static double SWING_AB_POSITION = 0; // TBD | ||
public static double SWING_B_POSITION = 0; // TBD | ||
public static double SWING_BC_POSITION = 0; // TBD | ||
public static double SWING_MIN_VELOCITY = 1000; // TBD | ||
public static double TOUCH_A_POSITION = 144000; // TBD | ||
public static double SWING_AB_POSITION = 43000; // TBD | ||
public static double SWING_B_POSITION = 900; // TBD | ||
public static double SWING_BC_POSITION = 107000; // TBD | ||
public static double SWING_MIN_VELOCITY = 1500; // TBD | ||
|
||
private double motorSpeed; | ||
|
||
TalonFX climbingMotor; | ||
TalonFX secondaryClimbingMotor; | ||
|
@@ -133,8 +135,8 @@ public void update() { | |
// 00 RESTING: Default resting | ||
case RESTING: | ||
climberSolenoidA.set(false); | ||
climberSolenoidB1.set(true); | ||
climberSolenoidB2.set(true); | ||
climberSolenoidB1.set(false); | ||
climberSolenoidB2.set(false); | ||
climberSolenoidC.set(false); | ||
break; | ||
|
||
|
@@ -147,11 +149,12 @@ public void update() { | |
climberSolenoidB2.set(false); | ||
climberSolenoidC.set(true); | ||
// TODO: set motor target here | ||
// climbingMotor.set(ControlMode.Position, TOUCH_A_POSITION); | ||
setSpeed(motorSpeed); | ||
break; | ||
|
||
// 10 TOUCH_A: Pin A (button/sensor) | ||
case TOUCH_A: | ||
setSpeed(0); | ||
climberSolenoidA.set(false); | ||
climberSolenoidB1.set(true); | ||
climberSolenoidB2.set(false); | ||
|
@@ -167,16 +170,20 @@ public void update() { | |
case ROTATE_B: | ||
// TODO: set motor power here | ||
this.setSpeed(-0.4); | ||
if (climbingMotor.getStatorCurrent() > NEXT_AB_STATE_CURRENT | ||
|| secondaryClimbingMotor.getStatorCurrent() > NEXT_AB_STATE_CURRENT) { | ||
setClimbingState(ClimbingStates.TOUCH_AB); | ||
this.setSpeed(0); | ||
} | ||
climberSolenoidA.set(false); | ||
climberSolenoidB1.set(true); | ||
climberSolenoidB2.set(false); | ||
climberSolenoidC.set(true); | ||
// if (climbingMotor.getStatorCurrent() > NEXT_AB_STATE_CURRENT | ||
// || secondaryClimbingMotor.getStatorCurrent() > NEXT_AB_STATE_CURRENT) { | ||
// setClimbingState(ClimbingStates.TOUCH_AB); | ||
// this.setSpeed(0); | ||
// } | ||
break; | ||
|
||
// 20 TOUCH_AB: Pin B (high current/sensor) | ||
case TOUCH_AB: | ||
this.setSpeed(0); | ||
this.setSpeed(-0.05); | ||
climberSolenoidA.set(false); | ||
climberSolenoidB1.set(false); | ||
climberSolenoidB2.set(false); | ||
|
@@ -190,10 +197,9 @@ public void update() { | |
case ROTATE_AB_DOWN: | ||
this.setPower(0); | ||
// TODO: set motor target here | ||
if (Math.abs(climbingMotor.getSelectedSensorPosition() - SWING_AB_POSITION) < 500) {// Determine | ||
// tolerance | ||
if (climbingMotor.getSelectedSensorPosition() > SWING_AB_POSITION) {// Was less then when broken | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is longer than 100 characters (found 112). |
||
System.out.println("DONE SWINGING!"); | ||
// setClimbingState(ClimbingStates.RELEASE_A); | ||
setClimbingState(ClimbingStates.RELEASE_A); | ||
} | ||
break; | ||
|
||
|
@@ -206,18 +212,18 @@ public void update() { | |
climberSolenoidC.set(true); | ||
// TODO: set motor target here | ||
// if (!gates.getA()) { | ||
// setClimbingState(ClimbingStates.ROTATE_B_DOWN);; | ||
setClimbingState(ClimbingStates.ROTATE_B_DOWN);; | ||
// } | ||
break; | ||
|
||
// 35 ROTATE_B_DOWN: Wait for swinging (photogate) | ||
case ROTATE_B_DOWN: | ||
// TODO: set motor target here | ||
this.setPower(0); | ||
if (Math.abs(climbingMotor.getSelectedSensorPosition() - SWING_B_POSITION) < 500 | ||
if (Math.abs(climbingMotor.getSelectedSensorPosition() - SWING_B_POSITION) < 1000 | ||
&& Math.abs( | ||
climbingMotor.getSelectedSensorVelocity()) < SWING_MIN_VELOCITY) {// Determine | ||
// tolerance | ||
// tolerance | ||
System.out.println("DONE SWINGING!"); | ||
// setClimbingState(ClimbingStates.ROTATE_C); | ||
} | ||
|
@@ -226,7 +232,7 @@ public void update() { | |
// 40 ROTATE_C: Rotate to C bar (gyro/accel) | ||
case ROTATE_C: | ||
// TODO: set motor target here | ||
this.setSpeed(-0.2); | ||
this.setSpeed(-0.3); | ||
if (climbingMotor.getStatorCurrent() > NEXT_BC_STATE_CURRENT | ||
|| secondaryClimbingMotor.getStatorCurrent() > NEXT_BC_STATE_CURRENT) { | ||
setClimbingState(ClimbingStates.TOUCH_BC); | ||
|
@@ -251,8 +257,7 @@ public void update() { | |
case ROTATE_BC_DOWN: | ||
// TODO: set motor target here | ||
this.setPower(0); | ||
if (Math.abs(climbingMotor.getSelectedSensorPosition() - SWING_BC_POSITION) < 500) {// Determine | ||
// tolerance | ||
if (climbingMotor.getSelectedSensorPosition() < SWING_BC_POSITION) {// Determine tolerance | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is longer than 100 characters (found 106). |
||
System.out.println("DONE SWINGING!"); | ||
// setClimbingState(ClimbingStates.RELEASE_B); | ||
} | ||
|
@@ -302,6 +307,14 @@ public ClimbingStates getNextClimbingState() { | |
return ClimbingStates.values()[this.currentClimberState.ordinal() + 1]; | ||
} | ||
|
||
public ClimbingStates getPreviousClimbingState() { | ||
return ClimbingStates.values()[this.currentClimberState.ordinal() - 1]; | ||
} | ||
|
||
public int getClimberStateId() { | ||
return this.currentClimberState.ordinal(); | ||
} | ||
|
||
public void disableClimber() { | ||
// Stop the motors | ||
this.climbingMotor.set(ControlMode.PercentOutput, 0); | ||
|
@@ -397,7 +410,8 @@ public void setMotors(double value) { | |
break; | ||
|
||
case ACTIVE: | ||
setSpeed(value); | ||
motorSpeed = value; | ||
setSpeed(motorSpeed); | ||
break; | ||
|
||
default: | ||
|
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block of commented-out lines of code should be removed.