From a767c5c78e0dcac0eafc0618b93afe38a531dac3 Mon Sep 17 00:00:00 2001 From: KrishnaN2357 Date: Tue, 25 Jan 2022 17:27:14 -0800 Subject: [PATCH 01/16] Day 2 Romi --- .../java/com/github/mittyrobotics/Robot.java | 49 +++++++++++++++++-- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/github/mittyrobotics/Robot.java b/src/main/java/com/github/mittyrobotics/Robot.java index 63ba14c..6abd14c 100644 --- a/src/main/java/com/github/mittyrobotics/Robot.java +++ b/src/main/java/com/github/mittyrobotics/Robot.java @@ -1,9 +1,6 @@ package com.github.mittyrobotics; -import edu.wpi.first.wpilibj.DigitalInput; -import edu.wpi.first.wpilibj.Encoder; -import edu.wpi.first.wpilibj.Spark; -import edu.wpi.first.wpilibj.TimedRobot; +import edu.wpi.first.wpilibj.*; import edu.wpi.first.wpilibj.controller.PIDController; @@ -13,6 +10,13 @@ */ public class Robot extends TimedRobot { + Spark SparkLeft, SparkRight; + DigitalInput digitalInput1; + DigitalInput input2; + DigitalInput input3; + DigitalInput input4; + XboxController controller; + RomiGyro gyro; //Runs when the robot is first started up and should be used for any initialization code /* * INITIALIZE CLASSES HERE @@ -22,6 +26,15 @@ public class Robot extends TimedRobot { @Override public void robotInit() { + SparkLeft = new Spark(Constants.LEFT_MOTOR_ID; + SparkRight = new Spark(Constants.RIGHT_MOTOR_ID); + SparkLeft.setInverted(true); + digitalInput1 = new DigitalInput(0); + input2 = new DigitalInput(1); + input3 = new DigitalInput(2); + input4 = new DigitalInput(3); + controller = new XboxController(0); + gyro = new RomiGyro(); } @@ -32,7 +45,33 @@ public void robotInit() { */ @Override public void teleopPeriodic() { - + if(digitalInput1.get()) { + SparkLeft.set(0); + SparkRight.set(1); + } + else if(input2.get()){ + SparkLeft.set(1); + SparkRight.set(0); + } + else if(input3.get()){ + SparkLeft.set(1); + SparkRight.set(1); + } + else if(input4.get()) { + SparkLeft.set(-1); + SparkRight.set(-1); + } +/* if(controller.getAButton()){ + while(gyro.getAngleZ()<=45){ + SparkLeft.set(-0.5); + SparkRight.set(0.5); + } + } + */ + if(controller.getAButton() && gyro.getAngleZ() <= 45){ + SparkLeft.set(-0.5); + SparkRight.set(0.5); + } } //Runs when antonomous mode (robot runs on its own) first activated via the desktop application From 73b66741cc3b0ea87ab2c21b75c51b3f3f116422 Mon Sep 17 00:00:00 2001 From: KrishnaN2357 Date: Tue, 15 Feb 2022 15:38:21 -0800 Subject: [PATCH 02/16] Motion Profiles --- .idea/gradle.xml | 1 + .idea/jarRepositories.xml | 5 +++++ .idea/misc.xml | 2 +- .idea/modules.xml | 8 +++++++ .idea/runConfigurations.xml | 10 +++++++++ .idea/tko-romi.iml | 12 ++++++++++ .idea/workspace.xml | 17 +++++++++++++- .../java/com/github/mittyrobotics/Robot.java | 22 ++++++++++++++++++- 8 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 .idea/modules.xml create mode 100644 .idea/runConfigurations.xml create mode 100644 .idea/tko-romi.iml diff --git a/.idea/gradle.xml b/.idea/gradle.xml index ba1ec5c..611e7c8 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,5 +1,6 @@ + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 3e79c5f..5821b2f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,5 +4,5 @@ - + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..5fc49aa --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..797acea --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/tko-romi.iml b/.idea/tko-romi.iml new file mode 100644 index 0000000..394b345 --- /dev/null +++ b/.idea/tko-romi.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 682050b..334fa7d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,8 +5,11 @@ + + + - + - - - + + @@ -29,13 +28,25 @@ - + + + + + +