Skip to content

Commit b4b4578

Browse files
kevinzwangalexander-mcdowell
authored andcommitted
Robot code that we know works (#104)
* Change example items to drivetrain skeleton * Format using the formatting tool in VScode * Update FRC library version * Update WPILIB extension, add motorcontrollers, and resolve merge conflicts * Change example items to drivetrain (#2) * Change example items to drivetrain skeleton * Format using the formatting tool in VScode * Update WPILIB extension, add motorcontrollers, and resolve merge conflicts * Fix TeleopDrive * Fix TeleopDrive for arcade and tank * Fix Arcade Drive * Split TeleopDrive.java into Arcade and Tank Drive * Add SmartDashboard ports and Encoders * add continuous integration (#6) * add travis config and update README.md * Fix copyright typo introduced in earlier commit. * Add motor configuration methods for talons and victors * Add gyros (note: there are some errors - that's because AHRS has not been added) * Fix ArcadeDrive logic * initial changes * Add basic cargo syubsystem functionality * Add squared joystick functionality * clean up code and add comments * add correct port numbers for motor controllers * add correct port numbers for motor controllers (#8) * add correct port numbers for motor controllers * invert right motors drivetrain motors run the opposite direction on each side, the right motors run the incorrect direction * Update cargo code to match this year's robot, and OI complements. Can now intake/eject * Format and organize all changed files according to VSCode auto-formatter * Set distance per pulse of drivetrain encoders * add camera code * improvements to cargo code (#12) * add hatch code (#14) * Add Climber code * Remove test code (accidental commit) * Make joysticks negative; correctly square joysticks; initialize OI; put Encoder values to S.D (#20) * Add variable rollerPort for hasCargo() method. * Move cargoPDPPort to RobotMap * Move TODO statement to more relevant spot, formatted two documents * Work around copySign problem * Remove test prints and SmartDashboard * Comment and format * Add code for rails * make motor controller initialization compatible with both robots (#24) * Put piston state value to Smart Dashboard (#21) * Put piston state value to Smart Dashboard * Add default state for pistons * Fix unreachable statement error in HatchPanel.toggle() * Change names of pistonState * Enter correct hatch solenoid numbers (#26) * Cargo null error (#27) * Enter correct hatch solenoid numbers * Fix null error in cargo intake and eject * Update names and organization to match rest of code and use AHRS * Change climber code to reflect the use of the accelerometer to check climbing bounds * Implement accelerometer code for the climber * Fix logic, add rail button * Fix logic in climber code * Change climbing logic to single command * Fix syntax error * Fix additional syntax errors * fix compilation errors and clean up code * use navx instead of built in accelerometer * format code * requested changes * add climb button and fix drivetrain/oi stuff (#29) * add climb button and fix drivetrain/oi stuff * format code * Restructure climb into climb and retract, add manual override * Change climb logic to enum State * Make requested changes in climber * Organize up into state and if/elses into switch * add manipulator "enum" (#31) Java enums don't really map to ints so I'm just making a fake enum * Add encoder logic and clean up climbing logic * Make buttons more descriptive in OI.java (#32) * add manipulator "enum" Java enums don't really map to ints so I'm just making a fake enum * Make names in OI for buttons more descriptive * Update to 3.2 (#33) * Change climber port number to correct one * changes from on-robot testing (#35) * improvements to cargo code * fix merge errors * changes from on-robot testing * Fix syntax error in OI.java * Issue 38 (#40) * Add cargo status in SmartDashboard * Include accidentally unstaged change * Fix finished/interrupted logic in cargo * Address issue 37 by having the hatch stay out while intaking cargo (#41) * Address issue 37 by having the hatch stay out while intaking cargo * Make WaitMove only detect one-way movement * Fix incorrect subtraction logic * Add error checking (and printing) for the motor controller config statements (#47) * fix right arcade drive trigger (#44) * fix #43 * change default slow rotation value * Change climber ports (#48) * Add code to keep climber up (#53) * Add code to keep climber up * Remove extraneous variable, add to keepclimber logic * Fix climber logic (#54) * Fix climber logic * Change logic to reflect new priority of changing directions too much (from climbing too often) * Add resetting code to drivetrain encoders when they are created (#55) * add manual climb * update max climb height to be the height of the robot * Put correct port number in hasCargo() (#58) * Add wobbledrive capability * Drivetrain characterization (#25) * Copy drivetrain characterization code to Robot 2019 * Fix Dean's complaints and format * Replace SpeedController with WPI_TalonSRX * Merge IncreaseVoltageLinear and IncreaseVoltageStepwise into DrivetrainCharacterization Command. * Remove old IncreaseVoltage commands * Fix maxVoltage error * Add Drivetrain Characterization Analysis * Surround Scanner with Try-Catch in Drivetrain.java * Fix try-catch in Drivetrain.java * Reduce and simplify DrivetrainCharAnalysis.java * Resolve building issues associated with the last two branches * Resolve build changes in the last commit * Try-Catch FileReader and CSVReader in DrivetrainCharacterization.java * Add CharacterizedDrive capability * Make DrivetrainAnalysis a SmartDashboard button * Split kV, kA, vIntercept into left and right values * Split kv,ka,vIntercept into forward-left, forward-right, backward-left, and backward-right values * Fix parseCSV (now the code actually works!) * Fix Characterized Drive * Fix testing issues * Utilize acceleration term in drivetrain characterization formula * Fix CharDrive in TeleopDrive * Partial Changes the night of 2/18/19 * Remove absolute value from leftDV and rightDV * Fix turning issue with acceleration clipping * Invert right encoder * Change wobble to a whileHeld * Add button to switch between arcade drive and tank drive (#67) * Add button to switch between arcade drive and tank drive * Auto-format files * Add wobbledrive capability (#65) * Add wobbledrive capability * Change wobble to a whileHeld * Add early stop when drivetrain is stuck during wobbling * Add wobble reset when wobble button is released * Fix logic in wobble drive * Fix bug with wobbledrive looking at distance instead of rate * Initial commit * Fix cargo and climber ports * Fix logic in finishing wobble drive * Make wobble stop doing a finished side, fix logic * Add SmartDashboard output when wobble done * Catch singular matrix exception and dump X and Y matrices * Set climb speeds to proven values * Add timer to differentiate between climb levels * Fix getAngle function in climber * Fix getAngle function in climber * Add lights code * Fix bug calling wrong command from oi * Add lights color to smartdashboard * Replace timer with encoder to finish climb * Fix syntax error, edit constant to more reasonable value. * Update some TODO values with actual number * Reverse climber encoder logic (and rename variables) * Make requested change * Capitalize SmartDashboard values * different buttons for auto and manual climb * change climb buttons to be consistent (also because I'm adding hatch buttons but ignore that) * Solves issue-88 (#89) * add new hatch mech code (#86) * add new hatch mech code * minor changes and add comments * Change climber piston ports * change to manipulator controls for manual climbing (#96) * change to manipulator controls for climbing * im bad -kev * update hatch code (#97) * add new hatch mech code * minor changes and add comments * hardcode no delay for hatch eject * change naming for clarity * re-delete files from merge * delete the imports of removed files * Fix angles for climbing (#94) * Fix angles for climbing * Change climber piston ports * Use atan for climber angle * use pitch instead of accel calculations * change rails to toggle * Fix issue #98 (#102)
1 parent fa32da8 commit b4b4578

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2567
-168
lines changed

.travis.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: java
2+
script:
3+
- cd Robot2019/
4+
- ./gradlew check
5+
jdk:
6+
- oraclejdk11
7+
env:
8+
- TERM=dumb

.vscode/launch.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "java",
9+
"name": "Debug (Launch) - Current File",
10+
"request": "launch",
11+
"mainClass": "${file}"
12+
},
13+
{
14+
"type": "java",
15+
"name": "Debug (Launch)-Main<Robot2019>",
16+
"request": "launch",
17+
"mainClass": "frc.robot.Main",
18+
"projectName": "Robot2019"
19+
},
20+
{
21+
"type": "java",
22+
"name": "Debug (Launch)-DrivetrainCharacterization",
23+
"request": "launch",
24+
"mainClass": "DrivetrainCharacterization"
25+
}
26+
]
27+
}

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"java.configuration.updateBuildConfiguration": "interactive"
3+
}

.wpilib/wpilib_preferences.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"currentLanguage": "none",
3+
"enableCppIntellisense": false,
4+
"projectYear": "none",
5+
"teamNumber": 199
6+
}

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# RobotCode2019
1+
# RobotCode2019 [![Build Status](https://travis-ci.com/DeepBlueRobotics/RobotCode2019.svg?branch=dev)](https://travis-ci.com/DeepBlueRobotics/RobotCode2019)
2+
23
Our code for 2019 FRC Build Season.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2+
"enableCppIntellisense": false,
23
"currentLanguage": "java",
4+
"projectYear": "2019",
35
"teamNumber": 199
46
}

Robot2019/build.gradle

+34-24
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,64 @@
11
plugins {
22
id "java"
3-
id "edu.wpi.first.GradleRIO" version "2019.0.0-alpha-3"
3+
id "edu.wpi.first.GradleRIO" version "2019.3.2"
44
}
55

6-
def ROBOT_CLASS = "frc.robot.Robot"
6+
def ROBOT_MAIN_CLASS = "frc.robot.Main"
77

88
// Define my targets (RoboRIO) and artifacts (deployable files)
99
// This is added by GradleRIO's backing project EmbeddedTools.
1010
deploy {
1111
targets {
12-
target("roborio", edu.wpi.first.gradlerio.frc.RoboRIO) {
12+
roboRIO("roborio") {
1313
// Team number is loaded either from the .wpilib/wpilib_preferences.json
1414
// or from command line. If not found an exception will be thrown.
1515
// You can use getTeamOrDefault(team) instead of getTeamNumber if you
1616
// want to store a team number in this file.
17-
team = getTeamNumber()
17+
team = frc.getTeamNumber()
1818
}
1919
}
2020
artifacts {
21-
artifact('frcJava', edu.wpi.first.gradlerio.frc.FRCJavaArtifact) {
21+
frcJavaArtifact('frcJava') {
2222
targets << "roborio"
2323
// Debug can be overridden by command line, for use with VSCode
24-
debug = getDebugOrDefault(false)
24+
debug = frc.getDebugOrDefault(false)
25+
}
26+
// Built in artifact to deploy arbitrary files to the roboRIO.
27+
fileTreeArtifact('frcStaticFileDeploy') {
28+
// The directory below is the local directory to deploy
29+
files = fileTree(dir: 'src/main/deploy')
30+
// Deploy to RoboRIO target, into /home/lvuser/deploy
31+
targets << "roborio"
32+
directory = '/home/lvuser/deploy'
2533
}
2634
}
2735
}
2836

29-
// Defining my dependencies. In this case, WPILib (+ friends), CTRE Toolsuite (Talon SRX)
30-
// and NavX.
37+
// Set this to true to enable desktop support.
38+
def includeDesktopSupport = false
39+
40+
// Maven central needed for JUnit
41+
repositories {
42+
mavenCentral()
43+
}
44+
45+
// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.
46+
// Also defines JUnit 4.
3147
dependencies {
32-
compile wpilib()
33-
compile ctre()
34-
compile navx()
48+
compile wpi.deps.wpilib()
49+
compile wpi.deps.vendor.java()
50+
nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio)
51+
nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop)
52+
testCompile 'junit:junit:4.12'
53+
compile group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1'
54+
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1'
55+
compile group: 'org.apache.commons', name: 'commons-csv', version: '1.6'
3556
}
3657

3758
// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar')
3859
// in order to make them all available at runtime. Also adding the manifest so WPILib
3960
// knows where to look for our Robot Class.
4061
jar {
41-
from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
42-
manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_CLASS)
43-
}
44-
45-
// Force Java 8 Compatibility mode for deployed code, in case the develoment
46-
// system is using Java 10.
47-
compileJava {
48-
sourceCompatibility = 1.8
49-
targetCompatibility = 1.8
50-
}
51-
52-
wrapper {
53-
gradleVersion = '4.9'
62+
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
63+
manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS)
5464
}
1.3 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
2-
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
2+
distributionPath=permwrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
5-
zipStorePath=wrapper/dists
5+
zipStorePath=permwrapper/dists

Robot2019/gradlew

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ APP_NAME="Gradle"
2828
APP_BASE_NAME=`basename "$0"`
2929

3030
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31-
DEFAULT_JVM_OPTS=""
31+
DEFAULT_JVM_OPTS='"-Xmx64m"'
3232

3333
# Use the maximum available, or set MAX_FD != -1 to use that value.
3434
MAX_FD="maximum"

Robot2019/gradlew.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ set APP_BASE_NAME=%~n0
1414
set APP_HOME=%DIRNAME%
1515

1616
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17-
set DEFAULT_JVM_OPTS=
17+
set DEFAULT_JVM_OPTS="-Xmx64m"
1818

1919
@rem Find java.exe
2020
if defined JAVA_HOME goto findJavaFromJavaHome

Robot2019/settings.gradle

+19
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
1+
import org.gradle.internal.os.OperatingSystem
2+
13
pluginManagement {
24
repositories {
35
mavenLocal()
46
gradlePluginPortal()
7+
String frcYear = '2019'
8+
File frcHome
9+
if (OperatingSystem.current().isWindows()) {
10+
String publicFolder = System.getenv('PUBLIC')
11+
if (publicFolder == null) {
12+
publicFolder = "C:\\Users\\Public"
13+
}
14+
frcHome = new File(publicFolder, "frc${frcYear}")
15+
} else {
16+
def userFolder = System.getProperty("user.home")
17+
frcHome = new File(userFolder, "frc${frcYear}")
18+
}
19+
def frcHomeMaven = new File(frcHome, 'maven')
20+
maven {
21+
name 'frcHome'
22+
url frcHomeMaven
23+
}
524
}
625
}

Robot2019/src/main/deploy/example.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Files placed in this directory will be deployed to the RoboRIO into the
2+
'deploy' directory in the home folder. Use the 'FileUtilities.getFilePath' wpilib function
3+
to get a proper path relative to the deploy directory.

0 commit comments

Comments
 (0)