Skip to content
This repository has been archived by the owner on Oct 29, 2018. It is now read-only.

Fully tested. #31

Merged
merged 63 commits into from Oct 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
61586d7
Drive train controls.
NickStothard Jan 7, 2018
c242c65
Basic Teleop
BlakeFortin Jan 14, 2018
fed5e02
Good ol' Eclipse updates.
Jan 17, 2018
00677e2
Basic TeleOp
BlakeFortin Jan 20, 2018
8831cc4
Merge branch 'TeleOp' of https://github.com/FIRST-Team-6071/2018-Powe…
BlakeFortin Jan 20, 2018
858d1a7
Basic TeleOp v1.2
BlakeFortin Jan 20, 2018
ffa0711
Updated uniform variables.
Jan 20, 2018
bfa3bf3
Setup auton layout.
Jan 20, 2018
c13ef04
Basic TeleOp v1.3
BlakeFortin Jan 20, 2018
ed7c996
Merge pull request #14 from FIRST-Team-6071/Autonomous
Xeinix Jan 20, 2018
8368e85
I forgot to save.
Jan 20, 2018
24638e0
Merge branch 'Might-work.-But-we're-not-too-sure' into TeleOp
Xeinix Jan 20, 2018
4f2739a
Merge branch 'Might-work.-But-we're-not-too-sure' into TeleOp
Xeinix Jan 20, 2018
82677af
Merge pull request #15 from FIRST-Team-6071/TeleOp
Xeinix Jan 20, 2018
4a8b306
Merge branch 'Might-work.-But-we're-not-too-sure' into Autonomous
Xeinix Jan 20, 2018
26dc15d
Merge pull request #16 from FIRST-Team-6071/Autonomous
Xeinix Jan 20, 2018
1efdac0
TeleOp v0.0.4
BlakeFortin Jan 20, 2018
f24e75f
Update Robot.java
Xeinix Jan 20, 2018
a43f414
Update Robot.java
Xeinix Jan 23, 2018
c3920f1
Update Robot.java
Xeinix Jan 23, 2018
e315f88
Adding CTRE Phoenix libraries.
Jan 24, 2018
8fc829f
Setup CAN testing.
Jan 24, 2018
98038a1
Setup CAN Testing.
Jan 25, 2018
63d55bc
Remove testing code.
Jan 25, 2018
d18b005
Setup PWM based encoders.
Jan 25, 2018
44e53ac
Removed TeleOp code.
Jan 25, 2018
b0e1088
Copied encoder setup.
Jan 25, 2018
11b4c32
Setup DS check code.
Jan 25, 2018
6c6d07d
Forgot somthing.
Jan 25, 2018
63428ff
Setup driver override.
Jan 25, 2018
106f70d
Add in code to get Arcade layout.
Jan 25, 2018
983aec4
Merge branch 'TeleOp' of https://github.com/FIRST-Team-6071/2018-Powe…
BlakeFortin Feb 1, 2018
bd641f2
Merge branch 'TeleOp' of https://github.com/FIRST-Team-6071/2018-Powe…
BlakeFortin Feb 1, 2018
5d4bffa
Added in the solenoid code.
BlakeFortin Feb 3, 2018
083760f
Compresser and solenoid
BlakeFortin Feb 3, 2018
18b55b3
Compresser.
BlakeFortin Feb 3, 2018
533ab93
Cleanup and some Pneumatics stuff.
Feb 5, 2018
6fdb399
Trying to fix stuff.
Feb 5, 2018
5452861
Debug.
Feb 5, 2018
cafe8f5
More freaking debug stuff.
Feb 5, 2018
5d5a776
Hm. I'm lost.
Feb 12, 2018
3cd4c27
g
BlakeFortin Feb 16, 2018
f1dd3ab
Merge branch 'TeleOp' of https://github.com/FIRST-Team-6071/2018-Powe…
BlakeFortin Feb 16, 2018
859aa29
A lot of stuff.
Feb 17, 2018
d012da0
Merge branch 'TeleOp' of https://github.com/FIRST-Team-6071/2018-Powe…
Feb 17, 2018
72c1ac9
Some gay shit
Feb 17, 2018
6e9cdac
'Final code'
Feb 18, 2018
5e7ba3e
Merge branch 'Might-work.-But-we're-not-too-sure' into TeleOp
Xeinix Feb 18, 2018
a756ce8
Merge pull request #29 from FIRST-Team-6071/TeleOp
Xeinix Feb 18, 2018
c9d0deb
Nada
Feb 19, 2018
ca2f70d
test
Feb 19, 2018
3686d1a
:(
Feb 19, 2018
17da115
-_-
Feb 19, 2018
06c30e7
Testing, Again.
Feb 20, 2018
5361a42
Ok
Feb 20, 2018
a73d589
UGGGGGG
Feb 20, 2018
e02db79
wOOOOOOO
Feb 20, 2018
a24098c
:D
Feb 20, 2018
1a2ffd3
Merge branch 'Might-work.-But-we're-not-too-sure' into Autonomous
Xeinix Feb 20, 2018
f68091f
Merge pull request #30 from FIRST-Team-6071/Autonomous
Xeinix Feb 20, 2018
138415a
Merge branch 'Might-work.-But-we're-not-too-sure' of https://github.c…
Feb 20, 2018
adddaa6
Updated Josh for Bot Bash 2018
Oct 26, 2018
a57cfee
End of season final push.
Oct 28, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .classpath
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="PowerUp2018/src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -20,3 +20,4 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/bin/
17 changes: 17 additions & 0 deletions .project
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>2018-PowerUp-BackupDesign</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
4 changes: 4 additions & 0 deletions PowerUp2018/.classpath
Expand Up @@ -6,6 +6,10 @@
<classpathentry kind="var" path="opencv" sourcepath="opencv.sources"/>
<classpathentry kind="var" path="cscore" sourcepath="cscore.sources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="var" path="wpiutil" sourcepath="wpiutil.sources"/>
<classpathentry kind="var" path="USERLIBS_DIR/CTRE_Phoenix-sources.jar"/>
<classpathentry kind="var" path="USERLIBS_DIR/CTRE_Phoenix.jar"/>
<classpathentry kind="var" path="USERLIBS_DIR/navx_frc.jar"/>
<classpathentry kind="lib" path="C:/Users/Bot Central/wpilib/user/java/lib/CTRE_Phoenix.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
144 changes: 131 additions & 13 deletions PowerUp2018/src/org/usfirst/frc/team6071/robot/Robot.java
@@ -1,42 +1,160 @@
/*

* Power Up 2018.
* Version 0.0
* Version 0.1.3

*/

package org.usfirst.frc.team6071.robot;

import com.ctre.phoenix.motorcontrol.ControlMode;
import com.ctre.phoenix.motorcontrol.FeedbackDevice;
import com.ctre.phoenix.motorcontrol.StatusFrameEnhanced;
import com.ctre.phoenix.motorcontrol.can.TalonSRX;
import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Spark;


import edu.wpi.first.wpilibj.Talon;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

public class Robot extends IterativeRobot {

// Common Variables
final int joystickLeftPort = 0;
final int joystickRightPort = 1;

final Spark motorLeft0 = new Spark(0);
final Spark motorLeft1 = new Spark(1);
final Spark motorLeft2 = new Spark(2);
final Spark motorLeft3 = new Spark(3);

// Auton Variables.
final Spark mtrLeft = new Spark(1); // Left side gearbox controller.
final Spark mtrRight = new Spark(0); // Right side gearbox controller.
final Talon mtrLeftBox = new Talon(8);
final Talon mtrRightBox = new Talon(9);

final TalonSRX mtrElev = new TalonSRX(10);
final TalonSRX mtrArmRaise = new TalonSRX(20);


// TeleOp Variables.
final Encoder encMtrLeft = new Encoder(8, 9, false, Encoder.EncodingType.k4X); // Left side gearbox encoder.
final Encoder encMtrRight = new Encoder(6, 7, false, Encoder.EncodingType.k4X); // Right side gearbox encoder

// Auton Variables.
public int staNumber = 1;
public String arcadeLayout;
public boolean isOverride = false;
public String orChosenAuto;

public Timer timeAuto = new Timer();
public double autoMaxTime = 1.75D;

//Auton Choices
SendableChooser<String> chooser = new SendableChooser<>();
final String autoOverrideDisable = "Don't override";
boolean stepOne = true;
boolean stepTwo = false;
boolean stepThree = false;
boolean isDone = false;

// TeleOp Variables.

public Joystick leftJoy = new Joystick(0);
public Joystick rightJoy = new Joystick(1);

public void disabledInit() {
System.out.println("Josh is disabled.");
}

@Override
public void robotInit() {
encMtrLeft.setMaxPeriod(.1); // Sets the max amount of time (seconds) in which it deems the motor still moving.
encMtrLeft.setMinRate(10); // Sets the minimum amount of ticks in which it deems the motor stopped.
encMtrLeft.setDistancePerPulse(5); // Just, it's a number. I don't really get it tbh...
encMtrLeft.setReverseDirection(true); // Says if the encoder reads a backwards revolution as a positive or negative number.
encMtrLeft.setSamplesToAverage(7); // Again, don't entirely get it. So, yeah. Just make sure it's there.

encMtrRight.setMaxPeriod(.1);
encMtrRight.setMinRate(10);
encMtrRight.setDistancePerPulse(5);
encMtrRight.setReverseDirection(true);
encMtrRight.setSamplesToAverage(7);
}

@Override
public void autonomousInit() {
encMtrLeft.reset();
encMtrRight.reset();
timeAuto.start();
}

@Override
public void autonomousPeriodic() {
if(timeAuto.get() < autoMaxTime) {
mtrLeft.set(50);
mtrRight.set(-50);
}
else {
mtrRight.set(0);
mtrLeft.set(0);
}
}


@Override
public void teleopInit() {
}

@Override
public void teleopPeriodic() {
double leftJoyVal = leftJoy.getRawAxis(1); // Gets the y position's value from the left joystick.
double rightJoyVal = rightJoy.getRawAxis(1); // Gets the x position's value from the right joystick.

mtrRightBox.setInverted(true);

System.out.println("Left drivetrain: " + encMtrLeft.getRaw());
System.out.println("Right drivetrain: " + encMtrRight.getRaw());

// Drive
mtrLeft.setSpeed(-leftJoyVal);
mtrRight.setSpeed(rightJoyVal);

// Box input
if(leftJoy.getRawButton(1)){
mtrRightBox.set(25);
mtrLeftBox.set(25);
}
else if(rightJoy.getRawButton(1)){
mtrRightBox.set(-25);
mtrLeftBox.set(-25);;
}
else{
mtrRightBox.set(0);
mtrLeftBox.set(0);
}

//Box height
if(leftJoy.getRawButton(6)) {
mtrArmRaise.set(ControlMode.PercentOutput, 50);
}
else if(leftJoy.getRawButton(4)) {
mtrArmRaise.set(ControlMode.PercentOutput, -50);
}
else {
mtrArmRaise.set(ControlMode.PercentOutput, 0);
}

//Elevator height
if(rightJoy.getRawButton(5)) {
mtrElev.set(ControlMode.PercentOutput, 50);
}
else if(rightJoy.getRawButton(3)) {
mtrElev.set(ControlMode.PercentOutput, -50);
}
else{
mtrElev.set(ControlMode.PercentOutput, 0);
}


}

}