Skip to content

Commit

Permalink
Robot code that we know works (#104)
Browse files Browse the repository at this point in the history
* 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)
  • Loading branch information
kevinzwang authored and alexander-mcdowell committed Mar 22, 2019
1 parent fa32da8 commit b4b4578
Show file tree
Hide file tree
Showing 48 changed files with 2,567 additions and 168 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: java
script:
- cd Robot2019/
- ./gradlew check
jdk:
- oraclejdk11
env:
- TERM=dumb
27 changes: 27 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Debug (Launch) - Current File",
"request": "launch",
"mainClass": "${file}"
},
{
"type": "java",
"name": "Debug (Launch)-Main<Robot2019>",
"request": "launch",
"mainClass": "frc.robot.Main",
"projectName": "Robot2019"
},
{
"type": "java",
"name": "Debug (Launch)-DrivetrainCharacterization",
"request": "launch",
"mainClass": "DrivetrainCharacterization"
}
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "interactive"
}
6 changes: 6 additions & 0 deletions .wpilib/wpilib_preferences.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"currentLanguage": "none",
"enableCppIntellisense": false,
"projectYear": "none",
"teamNumber": 199
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# RobotCode2019
# RobotCode2019 [![Build Status](https://travis-ci.com/DeepBlueRobotics/RobotCode2019.svg?branch=dev)](https://travis-ci.com/DeepBlueRobotics/RobotCode2019)

Our code for 2019 FRC Build Season.
2 changes: 2 additions & 0 deletions Robot2019/.wpilib/wpilib_preferences.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"enableCppIntellisense": false,
"currentLanguage": "java",
"projectYear": "2019",
"teamNumber": 199
}
58 changes: 34 additions & 24 deletions Robot2019/build.gradle
Original file line number Diff line number Diff line change
@@ -1,54 +1,64 @@
plugins {
id "java"
id "edu.wpi.first.GradleRIO" version "2019.0.0-alpha-3"
id "edu.wpi.first.GradleRIO" version "2019.3.2"
}

def ROBOT_CLASS = "frc.robot.Robot"
def ROBOT_MAIN_CLASS = "frc.robot.Main"

// Define my targets (RoboRIO) and artifacts (deployable files)
// This is added by GradleRIO's backing project EmbeddedTools.
deploy {
targets {
target("roborio", edu.wpi.first.gradlerio.frc.RoboRIO) {
roboRIO("roborio") {
// Team number is loaded either from the .wpilib/wpilib_preferences.json
// or from command line. If not found an exception will be thrown.
// You can use getTeamOrDefault(team) instead of getTeamNumber if you
// want to store a team number in this file.
team = getTeamNumber()
team = frc.getTeamNumber()
}
}
artifacts {
artifact('frcJava', edu.wpi.first.gradlerio.frc.FRCJavaArtifact) {
frcJavaArtifact('frcJava') {
targets << "roborio"
// Debug can be overridden by command line, for use with VSCode
debug = getDebugOrDefault(false)
debug = frc.getDebugOrDefault(false)
}
// Built in artifact to deploy arbitrary files to the roboRIO.
fileTreeArtifact('frcStaticFileDeploy') {
// The directory below is the local directory to deploy
files = fileTree(dir: 'src/main/deploy')
// Deploy to RoboRIO target, into /home/lvuser/deploy
targets << "roborio"
directory = '/home/lvuser/deploy'
}
}
}

// Defining my dependencies. In this case, WPILib (+ friends), CTRE Toolsuite (Talon SRX)
// and NavX.
// Set this to true to enable desktop support.
def includeDesktopSupport = false

// Maven central needed for JUnit
repositories {
mavenCentral()
}

// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.
// Also defines JUnit 4.
dependencies {
compile wpilib()
compile ctre()
compile navx()
compile wpi.deps.wpilib()
compile wpi.deps.vendor.java()
nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio)
nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop)
testCompile 'junit:junit:4.12'
compile group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1'
compile group: 'org.apache.commons', name: 'commons-csv', version: '1.6'
}

// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar')
// in order to make them all available at runtime. Also adding the manifest so WPILib
// knows where to look for our Robot Class.
jar {
from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_CLASS)
}

// Force Java 8 Compatibility mode for deployed code, in case the develoment
// system is using Java 10.
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}

wrapper {
gradleVersion = '4.9'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS)
}
Binary file modified Robot2019/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 3 additions & 3 deletions Robot2019/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
distributionPath=permwrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=permwrapper/dists
2 changes: 1 addition & 1 deletion Robot2019/gradlew
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

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

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down
2 changes: 1 addition & 1 deletion Robot2019/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

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

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
19 changes: 19 additions & 0 deletions Robot2019/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
import org.gradle.internal.os.OperatingSystem

pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
String frcYear = '2019'
File frcHome
if (OperatingSystem.current().isWindows()) {
String publicFolder = System.getenv('PUBLIC')
if (publicFolder == null) {
publicFolder = "C:\\Users\\Public"
}
frcHome = new File(publicFolder, "frc${frcYear}")
} else {
def userFolder = System.getProperty("user.home")
frcHome = new File(userFolder, "frc${frcYear}")
}
def frcHomeMaven = new File(frcHome, 'maven')
maven {
name 'frcHome'
url frcHomeMaven
}
}
}
3 changes: 3 additions & 0 deletions Robot2019/src/main/deploy/example.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Files placed in this directory will be deployed to the RoboRIO into the
'deploy' directory in the home folder. Use the 'FileUtilities.getFilePath' wpilib function
to get a proper path relative to the deploy directory.
Loading

0 comments on commit b4b4578

Please sign in to comment.