Skip to content

Commit

Permalink
Merge pull request #23 from Team5430/auton-working
Browse files Browse the repository at this point in the history
Auton working
  • Loading branch information
Card-Box committed Oct 11, 2023
2 parents 75afd55 + 13d0308 commit 35f2d94
Show file tree
Hide file tree
Showing 15 changed files with 131 additions and 219 deletions.
31 changes: 8 additions & 23 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,25 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: build
macOs Intel:
macOs:

runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: build
macOs Silicon:

runs-on: macos-latest-xlarge

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
Expand All @@ -68,13 +53,13 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: build


1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This gitignore has been specially created by the WPILib team.
# If you remove items from this file, intellisense might break.

.idea
### C++ ###
# Prerequisites
*.d
Expand Down
1 change: 1 addition & 0 deletions .glass/glass.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
5 changes: 5 additions & 0 deletions .sysid/sysid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"SysId": {
"Analysis Type": "General Mechanism"
}
}
7 changes: 0 additions & 7 deletions .vscode/extensions.json

This file was deleted.

32 changes: 5 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ plugins {
id("maven-publish")
}

sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

def ROBOT_MAIN_CLASS = "frc.robot.Main"

Expand Down Expand Up @@ -49,6 +49,9 @@ def includeDesktopSupport = false
// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.
// Also defines JUnit 5.
dependencies {

implementation("com.google.guava:guava:31.1-jre")

implementation wpi.java.deps.wpilib()
implementation wpi.java.vendor.java()

Expand Down Expand Up @@ -98,28 +101,3 @@ wpi.java.configureTestTasks(test)
tasks.withType(JavaCompile) {
options.compilerArgs.add '-XDstringConcat=inline'
}
group='Team5430'
subprojects {
apply plugin: 'java'
apply plugin: "edu.wpi.first.GradleRIO" version "2023.4.3"
group='Team5430'
}

//publish config for github packages
publishing {
repositories {
maven {
name = "5430_uss_austin"
url = uri("https://maven.pkg.github.com/team5430/command-based-startoff")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("led-esma")
password = project.findProperty("gpr.key") ?: System.getenv("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")
}
}
}
publications {
gpr(MavenPublication) {
from(components.java)
}
}
}
46 changes: 18 additions & 28 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
import frc.robot.subsystems.extendSub;
import frc.robot.subsystems.gripperSub;
import frc.robot.subsystems.rotationSub;
import frc.robot.commands.Auto_one;
import frc.robot.commands.Auto_two;




Expand All @@ -30,8 +29,9 @@ public class Robot extends TimedRobot {
//making drivetrain as function for m_chooser
private final driveTrain mdrivetrain = new driveTrain();

private SequentialCommandGroup Auto_one;
private SequentialCommandGroup Auto_two;

private Command m_autonomousCommand;

private RobotContainer m_robotContainer;

public String m_autoselected;
Expand Down Expand Up @@ -67,10 +67,9 @@ public void robotInit() {

SmartDashboard.putData("Auton Choice", m_chooser);

m_chooser.addOption("Goal only", KGOALONLY);


/**
/*
* This function is called every 20 ms, no matter the mode. Use this for items like diagnostics
* that you want ran during disabled, autonomous, teleoperated and test.
*
Expand Down Expand Up @@ -99,6 +98,12 @@ public void disabledPeriodic() {}
@Override
public void autonomousInit() {
autoStatus = 0;
m_autonomousCommand = m_robotContainer.getAuton();

if(m_autonomousCommand != null){
m_autonomousCommand.schedule();
}



}
Expand All @@ -107,35 +112,20 @@ public void autonomousInit() {
@Override
public void autonomousPeriodic() {

m_autoselected = m_chooser.getSelected();

switch (m_autoselected){
//runs and autonmous regardless if a choice isn't set as to
default:
Auto_one.schedule();
break;

case KGOALONLY:
Auto_two.schedule();
break;

}

}


@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(Auto_one != null){
Auto_one.cancel();
}
// teleop starts running.
if(m_autonomousCommand != null){
m_autonomousCommand.cancel();
}



if(Auto_two != null){
Auto_two.cancel();
}
}

/** This function is called periodically during operator control. */
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
package frc.robot;

import frc.robot.Constants.OperatorConstants;
import frc.robot.commands.Auto_one;
import frc.robot.commands.Autos;
import frc.robot.subsystems.rotationSub;
import frc.robot.subsystems.driveTrain;
import frc.robot.subsystems.extendSub;
import frc.robot.subsystems.gripperSub;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.RunCommand;
Expand Down Expand Up @@ -48,7 +49,7 @@ public RobotContainer() {
new RunCommand(() -> m_DriveTrain.Drive(m_JoystickLeft.getY(), m_JoystickRight.getY()),m_DriveTrain));
//rotate arm
m_armSub.setDefaultCommand(
new RunCommand(() -> m_armSub.rotating(m_Controller0.getRawAxis(0)), m_armSub));
new RunCommand(() -> m_armSub.rotating(m_Controller0.getRawAxis(1)), m_armSub));
//gripper control
m_gripperSub.setDefaultCommand(
new RunCommand(() -> m_gripperSub.gripping(RobotContainer.m_Controller0.getRawAxis(2) - RobotContainer.m_Controller0.getRawAxis(3)), m_gripperSub));
Expand Down Expand Up @@ -79,6 +80,9 @@ private void configureBindings(){
zeroYaw.onTrue(new InstantCommand(m_DriveTrain:: gyro0Yaw));
}

public Command getAuton(){
return Autos.defaultAutonomous(m_DriveTrain);
}

}

Expand Down
59 changes: 0 additions & 59 deletions src/main/java/frc/robot/commands/Auto_one.java

This file was deleted.

43 changes: 0 additions & 43 deletions src/main/java/frc/robot/commands/Auto_two.java

This file was deleted.

20 changes: 20 additions & 0 deletions src/main/java/frc/robot/commands/Autos.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package frc.robot.commands;

import edu.wpi.first.wpilibj2.command.CommandBase;
import edu.wpi.first.wpilibj2.command.Commands;
import frc.robot.subsystems.driveTrain;
import frc.robot.subsystems.extendSub;
import frc.robot.subsystems.gripperSub;
import frc.robot.subsystems.rotationSub;

public class Autos {

public static CommandBase defaultAutonomous(driveTrain drive){
return Commands.sequence(rotationSub.C_rotateinTime(5,.3), extendSub.C_extendTime(2.5,.3), gripperSub.C_gripinTime(1,.3),
extendSub.C_extendTime(5, -.3), gripperSub.C_gripinTime(1, -.3), rotationSub.C_rotateinTime(5, -.3));
}
private Autos(){
throw new UnsupportedOperationException("This is where we contain our autos!");
}
}

Loading

0 comments on commit 35f2d94

Please sign in to comment.