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

Create Autonomous #22

Draft
wants to merge 99 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 92 commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
065285c
Add basic shooter class
Jan 15, 2022
d4a02b5
modified build
kryllyxofficial01 Jan 18, 2022
3143bae
updated settings
kryllyxofficial01 Jan 18, 2022
1f98067
Merge branch 'master' into shooter
Jan 18, 2022
d6c08b4
Add Manipulation.java
NotMePipe Jan 19, 2022
4163e72
Implement Manipulation
NotMePipe Jan 19, 2022
d13ec9c
Begin documenting Manipulation
NotMePipe Jan 19, 2022
910d366
Document Manipulation methods
NotMePipe Jan 20, 2022
8699047
Remove Shoot method
NotMePipe Jan 21, 2022
0d3f789
Fix some errors in Robot.java
NotMePipe Jan 21, 2022
f9fce03
Fix initialization boolean from defaulting null
NotMePipe Jan 22, 2022
447dbcd
Fix potential intakeWheel bug
NotMePipe Jan 22, 2022
3a6203e
Remove redundant if statement in teleopPeriodic
NotMePipe Jan 22, 2022
f889ab7
Merge branch 'master' into shooter
TheBitEffect Jan 24, 2022
f70bebd
Merge branch 'master' into manipulation
dracco1993 Jan 24, 2022
7b908b0
...
Jan 25, 2022
a5e30f5
Merge branch 'shooter' of https://github.com/RAR1741/RA22_RobotCode i…
Jan 25, 2022
3e7f683
Merge branch 'master' into shooter
dracco1993 Jan 29, 2022
58c0640
...
kryllyxofficial01 Jan 29, 2022
0ead328
Merge branch 'master' into shooter
dracco1993 Jan 29, 2022
fb7984d
Merge branch 'master' into shooter
TheBitEffect Feb 5, 2022
345f3dc
Merge branch 'master' into shooter
TheBitEffect Feb 5, 2022
7642df2
Merge branch 'master' into shooter
TheBitEffect Feb 5, 2022
42c25a7
Merge branch 'master' into shooter
dracco1993 Feb 18, 2022
d6a928b
change wpilib version
Feb 19, 2022
17c55ea
Merge branch 'shooter' of into shooter
Feb 19, 2022
10d67ce
change wpilib version
Feb 19, 2022
abc8e71
Create Autonomous class
NotMePipe Feb 22, 2022
dd21d55
add loggablegyro
kryllyxofficial01 Feb 22, 2022
ba80b41
Create JsonAutonomous class
NotMePipe Feb 22, 2022
50877a4
Add Google Gson implementation
NotMePipe Feb 22, 2022
d3da78b
whitespace
kryllyxofficial01 Feb 22, 2022
6b97889
Add navX to vendordeps
TheBitEffect Feb 23, 2022
a850459
Fix some of the imports and other assorted errors
TheBitEffect Feb 23, 2022
30d7e07
Add some example methods
TheBitEffect Feb 23, 2022
68013f0
Fix refrences to old swerve drive code
TheBitEffect Feb 23, 2022
6d9d9ed
Add methods to get sensor information
NotMePipe Feb 23, 2022
b55dfc0
Add turning methods
GingerJakeDaBoi Feb 23, 2022
f8fddd1
Add driving methods
NotMePipe Feb 23, 2022
d76985f
Merge branch 'autonomous' of https://github.com/RAR1741/RA22_Robotcod…
NotMePipe Feb 23, 2022
f32142e
Ran Robot Simulation
GingerJakeDaBoi Feb 26, 2022
16d804f
Add Loggable
GingerJakeDaBoi Feb 26, 2022
b0ec1ab
change wpilib version
kryllyxofficial01 Mar 1, 2022
27c7c7e
change wpilib version
kryllyxofficial01 Mar 1, 2022
ed28d4c
Implement JsonAutonomous into Robot.java
NotMePipe Mar 1, 2022
ce304e5
Add line to run autonomous
NotMePipe Mar 1, 2022
c75b07b
Update WPILib to version 2022.4.1
NotMePipe Mar 1, 2022
fa37c81
Add test auto sequence
NotMePipe Mar 1, 2022
786d2ac
Fix NullPointerException
GingerJakeDaBoi Mar 4, 2022
e2c7614
Fix the double space (cure my ocd)
GingerJakeDaBoi Mar 4, 2022
7abdb6b
Fix redundant methods
NotMePipe Mar 8, 2022
0c87dcb
delete unused sim files
kryllyxofficial01 Mar 8, 2022
94db2bf
Test autonomous
rar1741programmer Mar 9, 2022
7e6006a
Implement autonomous logging
NotMePipe Mar 9, 2022
e883298
Tell the robot to actually run the autonomous
NotMePipe Mar 9, 2022
aa60c2d
Merge branch 'autonomous' of https://github.com/RAR1741/RA22_Robotcod…
NotMePipe Mar 9, 2022
a62c2ce
Merge branch 'autonomous' of https://github.com/RAR1741/RA22_RobotCod…
rar1741programmer Mar 9, 2022
2f7cd59
Fix waiting and turning issues
NotMePipe Mar 11, 2022
3057d27
Find tick values with Parsec
NotMePipe Mar 11, 2022
69e82ee
Add distance-test instructions
NotMePipe Mar 12, 2022
f959c27
Merge branch 'LoggableGyro' into autonomous
GingerJakeDaBoi Mar 12, 2022
d30837c
Merge branch 'autonomous' of https://github.com/RAR1741/RA22_Robotcod…
NotMePipe Mar 12, 2022
80716b0
Update gyro class to LoggableGyro
NotMePipe Mar 12, 2022
15d4349
Make class simpler to construct
GingerJakeDaBoi Mar 12, 2022
630e8aa
Add Shooter initialization
GingerJakeDaBoi Mar 12, 2022
8fdf05e
Merge branch 'shooter' of https://github.com/RAR1741/RA22_RobotCode i…
GingerJakeDaBoi Mar 12, 2022
2e5c672
Remove redundant import
NotMePipe Mar 12, 2022
b9f8868
Merge branch 'Shooter' into autonomous
NotMePipe Mar 12, 2022
cc4ee80
Add unmerged code
NotMePipe Mar 12, 2022
50af188
Merge branch 'Manipulation' into autonomous
GingerJakeDaBoi Mar 12, 2022
4da141a
Merge branch 'autonomous' of https://github.com/RAR1741/RA22_RobotCod…
GingerJakeDaBoi Mar 12, 2022
7db143c
Add getAverageCurrent method and fix getEncoder
NotMePipe Mar 12, 2022
7c623ec
Add shooter-test.json
NotMePipe Mar 12, 2022
17a568e
Merge branch 'autonomous' of https://github.com/RAR1741/RA22_Robotcod…
NotMePipe Mar 12, 2022
a590436
Add shooter functionality
NotMePipe Mar 12, 2022
23c4c7d
Bug fixes
NotMePipe Mar 15, 2022
9c9ee56
Fix wall detection
NotMePipe Mar 15, 2022
b2f234e
Create current-test.json
NotMePipe Mar 15, 2022
3e902ee
Update motor currents during auto
NotMePipe Mar 15, 2022
99a48e0
Remove print lines
NotMePipe Mar 15, 2022
9da9673
Remove unused JsonParser variable
NotMePipe Mar 15, 2022
920e519
Begin autonomous sequence (Shooter broken)
NotMePipe Mar 18, 2022
7ac1e22
Make amount a Double
GingerJakeDaBoi Mar 22, 2022
abbc681
Check if args exists before adding items from it
GingerJakeDaBoi Mar 22, 2022
10123cd
Auto-format
GingerJakeDaBoi Mar 22, 2022
0ad994e
Throw more descriptive error if type is missing
GingerJakeDaBoi Mar 22, 2022
ca96607
Fix wait method
GingerJakeDaBoi Mar 22, 2022
a9bafeb
Remove debug print statements
GingerJakeDaBoi Mar 22, 2022
ff4d886
Configure shooter for Parsec for auto testing
GingerJakeDaBoi Mar 22, 2022
1a46ce6
Add Shooter TeleOp functionality (setSpeed broken)
NotMePipe Mar 22, 2022
e79bcbc
Merge branch 'shooter' into autonomous
NotMePipe Mar 23, 2022
609dec8
Add method to get path of auto file
GingerJakeDaBoi Mar 23, 2022
b490579
Finalize autonomous (not tested yet)
NotMePipe Mar 24, 2022
2f4c8f5
Merge branch 'master' of https://github.com/RAR1741/RA22_RobotCode in…
GingerJakeDaBoi Apr 9, 2022
6f6d66c
fix drivetrain merge breaking
GingerJakeDaBoi Apr 9, 2022
4940807
Merge branch 'autonomous' of https://github.com/RAR1741/RA22_RobotCod…
GingerJakeDaBoi Apr 9, 2022
96ebcc6
Remove Parsec configuration
NotMePipe Apr 9, 2022
20c463b
Get rid of useless TODOs
GingerJakeDaBoi Apr 9, 2022
94bf62c
Update Solenoid IDs
NotMePipe Apr 9, 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
12 changes: 9 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,24 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"type": "java",
"name": "Launch Main",
"request": "launch",
"mainClass": "frc.robot.Main",
"projectName": "RA22_RobotCode"
},
{
"type": "wpilib",
"name": "WPILib Desktop Debug",
"request": "launch",
"desktop": true,
"desktop": true
},
{
"type": "wpilib",
"name": "WPILib roboRIO Debug",
"request": "launch",
"desktop": false,
"desktop": false
}
]
}
4 changes: 3 additions & 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.3.1"
id "edu.wpi.first.GradleRIO" version "2022.4.1"
id "jacoco"
}

Expand Down Expand Up @@ -53,6 +53,8 @@ def includeDesktopSupport = true
dependencies {
implementation wpi.java.deps.wpilib()
implementation wpi.java.vendor.java()

implementation 'com.google.code.gson:gson:2.9.0'

roborioDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.roborio)
roborioDebug wpi.java.vendor.jniDebug(wpi.platforms.roborio)
Expand Down
26 changes: 26 additions & 0 deletions src/main/deploy/autos/auto-test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"auto": [
{
"type": "drive",
"unit": "SECONDS",
"amount": 0.1,
"args": [
-0.05,
-0.05
]
},
{
"type": "wait",
"amount": 1
},
{
"type": "turnDeg",
"unit": "DEGREES",
"amount": -90,
"args": [
0.1,
-0.1
]
}
]
}
26 changes: 26 additions & 0 deletions src/main/deploy/autos/autonomous.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"auto": [
{
"type": "drive",
"unit": "CURRENT",
"amount": 35,
"args": [
0.1,
0.1
]
},
{
"type": "wait",
"amount": 1
},
{
"type": "drive",
"unit": "FEET",
"amount": 6.75,
"args": [
-0.1,
-0.1
]
}
]
}
26 changes: 26 additions & 0 deletions src/main/deploy/autos/current-test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"auto": [
{
"type": "drive",
"unit": "CURRENT",
"amount": 20,
"args": [
0.05,
0.05
]
},
{
"type": "wait",
"amount": 1
},
{
"type": "drive",
"unit": "FEET",
"amount": 5,
"args": [
-0.05,
-0.05
]
}
]
}
76 changes: 76 additions & 0 deletions src/main/deploy/autos/distance-test.json
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
]
}
]
}
13 changes: 13 additions & 0 deletions src/main/deploy/autos/shooter-test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"auto": [
{
"type": "shoot",
"unit": "SPEED",
"amount": 1000
},
{
"type": "wait",
"amount": 5
}
]
}
5 changes: 5 additions & 0 deletions src/main/java/frc/robot/Autonomous.java
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();
}
13 changes: 13 additions & 0 deletions src/main/java/frc/robot/DriveModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public void setSpeed(double speed) {
main.set(TalonFXControlMode.Velocity, speed * 22000);
}

public void setPower(double power) {
main.set(TalonFXControlMode.PercentOutput, power);
}

/**
* Get the velocity of the module.
*
Expand All @@ -92,6 +96,15 @@ public double getSpeed() {
return main.getSelectedSensorVelocity();// * VELOCITY_COEFFICIENT;
}

/**
* Get the main sensor position (in raw sensor units).
*
* @return Position of selected sensor (in raw sensor units).
*/
public double getDriveEnc() {
return main.getSelectedSensorPosition();
}

/**
* Gets the average current drawn.
*
Expand Down
28 changes: 23 additions & 5 deletions src/main/java/frc/robot/Drivetrain.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,14 @@ public class Drivetrain implements Loggable {
* @param leftSpeed The speed of the left motors
* @param rightSpeed The speed of the right motors
*/
public void drive(double leftSpeed, double rightSpeed) { // Probably implement deadbands later
left.setSpeed(leftSpeed);
right.setSpeed(rightSpeed);
public void drive(double leftValue, double rightValue, boolean power) { // Probably implement deadbands later
Copy link

Choose a reason for hiding this comment

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

Line is longer than 100 characters (found 113).

if(power) {
left.setPower(leftValue);
right.setPower(rightValue);
} else {
left.setSpeed(leftValue);
right.setSpeed(rightValue);
}
}

/**
Expand All @@ -49,7 +54,7 @@ public void drive(double leftSpeed, double rightSpeed) { // Probably implement d
* @param speedInput The speed to drive
*/
public void arcadeDrive(double turnInput, double speedInput) {
this.drive(speedInput - turnInput, speedInput + turnInput);
this.drive(speedInput - turnInput, speedInput + turnInput, false);
}

/**
Expand All @@ -59,7 +64,7 @@ public void arcadeDrive(double turnInput, double speedInput) {
* @param rightDrive The speed to set the right motors
*/
public void tankDrive(double leftDrive, double rightDrive) {
this.drive(leftDrive, rightDrive);
this.drive(leftDrive, rightDrive, false);
}

/**
Expand All @@ -80,6 +85,19 @@ public boolean getShifter() {
return shifter.get();
}

/**
* Gets the encoder information for the left DriveModule
*
* @return Position of left sensor (in raw sensor units).
*/
public double getEncoder() {
return (left.getDriveEnc() + right.getDriveEnc()) / 2;
}

public double getAverageCurrent() {
return (left.getAverageCurrent() + right.getAverageCurrent()) / 2;
}

/**
* Shifts gears based on current.
*/
Expand Down
Loading