diff --git a/.gitignore b/.gitignore index ac314b5..61f25ce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,160 @@ -bin/ -build/ -dist/ +# Created by https://www.gitignore.io/api/c++,java,linux,macos,gradle,windows,visualstudiocode + +### C++ ### +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +### Java ### +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +# General .DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### Gradle ### +.gradle +/build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Cache of project +.gradletasknamecache + +# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 +# gradle/wrapper/gradle-wrapper.properties + +# # VS Code Specific Java Settings +.classpath +.project +.settings/ +bin/ + + +# End of https://www.gitignore.io/api/c++,java,linux,macos,gradle,windows,visualstudiocode diff --git a/.project b/.project deleted file mode 100644 index b956a8f..0000000 --- a/.project +++ /dev/null @@ -1,11 +0,0 @@ - - - RobotCode2018 - - - - - - - - diff --git a/AAAScripts/scripts.txt b/AAAScripts/scripts.txt index 9e220a6..de56173 100644 --- a/AAAScripts/scripts.txt +++ b/AAAScripts/scripts.txt @@ -1,378 +1,202 @@ -# Naming Conventions -# ------------------- -# 1. Robot's start position. R = right, C = center, L = left. -# 2. Switch information. R = going for the right plate, L = going for the left plate, x = not going for switch -# 3. Scale information. R = going for the right plate, L = going for the left plate, x = not going for scale -# 4. Exchange. E = going for the exchange, x = not going for exchange - -# 3.3(l) x 2.9(w) +#RIGHT SCRIPTS #Cross Auto Line Rxxx: - moveto (0,120) #Drive past auto line +moveto (0,120) #Drive past auto line -#------------------------------------------------- #Switch RRxx: - moveto (0,128.4) (-42.6,128.4) -90 #Drive directly forward to switch and then ram into switch - switch +moveto (0,148) -90 +switch 18 +moveto (-10, 220) +intake +moveto (-22, 205) RLxx: - moveto (0,188.4) (-210.6,188.4) (-210.6,128.4) (-186.6,128.4) 90 #Curve around switch and then "ram" into switch - switch - -#------------------------------------------------- - -#Scale -RxRx: - moveto (0,284.4) (-24.6,284.4) -90 #Drive directly forward and place at initial horizontal to scale - scale - -RxLx: - moveto (0,188.4) (-246.6,188.4) (-246.6,284.4) (-192.6,284.4) 90 #Curve around switch and drive to scale - scale +move 56 +turn -90 +move 170 +turn 90 +move 25 +switch -#------------------------------------------------- #Exchange RxxE: - moveto (0,188.4) (-210.6,188.4) (-210.6,44.4) (-123.6,44.4) (-123.6,-39.6) 180 #Curve around switch for baseline #then go to exchange - exchange - -#------------------------------------------------- - -#Switch and Scale -RRRx: - moveto (0,128.4) (-41.4,128.4) -90 #Drive directly forward then turn into switch - switch - moveto (0,128.4) #Back out from switch - moveto (0,80.4) (-9,80.4) #Drive toward cubes - intake - moveto (0,80.4) #Back out from cubes - moveto (0,284.4) (-24.6,284.4) -90 #Drive toward scale - scale - -RRLx: - moveto (0,128.4) (-41.4,128.4) -90 #Drive directly forward then turn into switch - switch - moveto (0,128.4) #Back out from switch - moveto (0,80.4) (-9,80.4) -90 #Drive toward cubes - intake - moveto (0,80.4) #Back out from cubes - moveto (0,188.4) (-246.6,188.4) (-246.6,284.4) (-192.6,284.4) 90 #Curve around switch + place at init distance to scale - scale - -RLRx: - moveto (0,284.4) (-24.6,284.4) -90 #Drive directly forward and place at initial horizontal to scale - scale - moveto (0,284.4) #Back out from switch - moveto (0,80.4) (-108,80.4) -90 #Drive toward cubes - intake - moveto (0,80.4) #Back out from cubes - moveto (0,188.4) (-210.6,188.4) (-210.6,128.4) (-186.6,128.4) #Drive toward switch - switch - -RLLx: - moveto (0,188.4) (-210.6,188.4) (-210.6,128.4) (-186.6,128.4) 90 #Curve around switch and then "ram" into switch - switch - moveto (-246.6,128.4) #Back out from switch - moveto (-246.6,80.4) (-144,80.4) #Drive toward cubes - intake - moveto (-246.6,80.4) #Back out from cubes - moveto (-246.6,284.4) (-192.6,284.4) 90 #Curve around switch + place at init distance to scale - scale +move 56 +turn -90 +move 145 +turn -90 +move 8 +exchange -#------------------------------------------------- #Switch and Exchange RRxE: - moveto (0,128.4) (-41.4,128.4) -90 #Drive directly forward then turn into switch - switch - moveto (0,128.4) (0,80.4) (-144,80.4) #Back out from switch - intake - moveto (0, 80.4) #Back out from cubes - moveto (0,188.4) (-210.6,188.4) (-210.6,44.4) (-123.6,44.4) 180 #Curve around switch for baseline #then go to - exchange +moveto (0,155) +turn -90 +switch +turn -90 +move 105 +turn 90 +move 105 +turn 90 +move 12 +intake +turn -90 +move 25 +turn -90 +move 12 +exchange RLxE: - moveto (0,188.4) (-210.6,188.4) (-210.6,128.4) (-186.6,128.4) 90 #Curve around switch and then "ram" into switch - switch - moveto (-246.6,128.4) #Back out from switch - moveto (-246.6,80.4) (-12, 80.4) #Drive toward cubes - #intake - moveto (-246.6,80.4) #Back out from cubes - moveto (-246.6,44.4) (-123.6,44.4) (-123.6,-39.6) #Drive toward exchange - exchange +move 56 +turn -90 +move 170 +turn 90 +move 25 +switch +move -40 +turn 90 +move 55 +turn -90 +move 12 +intake +turn -90 +move 25 +turn -90 +move 12 +exchange -# Naming Conventions -# ------------------- -# 1. Robot's start position. R = right, C = center, L = left. -# 2. Switch information. R = going for the right plate, L = going for the left plate, x = not going for switch -# 3. Scale information. R = going for the right plate, L = going for the left plate, x = not going for scale -# 4. Exchange. E = going for the exchange, x = not going for exchange -# 3.3(l) x 2.9(w) +#LEFT SCRIPTS #Cross Auto Line Lxxx: - moveto (0, 120) #Drive past auto line - -#------------------------------------------------- +moveto (0, 120) #Drive past auto line #Switch LLxx: - moveto (0, 129.8) (42.6, 129.8) 90 #Drive directly forward to switch and then ram into switch - switch +moveto (0,148) 90 +switch 18 +moveto (10, 220) +intake +moveto (22, 205) LRxx: - moveto (0, 188.4) (210.6,188.4) (210.6, 129.8) (186.6, 129.8) -90 #Curve around switch and then "ram" into switch - switch - -#------------------------------------------------- - -#Scale -LxLx: - moveto (0, 284.4) (24.6, 284.4) 90 #Drive directly forward and place at initial horizontal to scale - scale - -LxRx: - moveto (0, 188.4) (246.6, 188.4) (246.6, 284.4) (216.05, 284.4) -90 #Curve around switch + place at init distance to scale - scale +move 56 +turn 90 +move 170 +turn -90 +move 25 +switch -#------------------------------------------------- #Exchange LxxE: - moveto (0, 188.4) (210.6, 188.4) (210.6, 3.7) (124.8, 3.7) (124.8, -3.3) 180 #Curve around switch for baseline then go to exchange - exchange - -#------------------------------------------------- - -#Switch and Scale -LRRx: - moveto (0, 188.4) (210.6,188.4) (210.6, 129.8) (186.6, 129.8) -90 #Curve around switch and then "ram" into switch - switch - moveto (246.6, 129.8) #Back out from switch - moveto (246.6, 80.4) (12, 80.4) #Drive toward cubes - intake - moveto (246.6, 80.4) #Back out from cubes - moveto (246.6, 284.4) (16.05, 284.4) -90 #Curve around switch + place at init distance to scale - scale - -LRLx: - moveto (0, 284.4) (24.6, 284.4) -90 #Drive directly forward and place at initial horizontal to scale - scale - moveto (0, 284.4) #Back out from switch - moveto (0, 80.4) (108, 80.4) -90 #Drive toward cubes - intake - moveto (0, 80.4) #Back out from cubes - moveto (0, 188.4) (210.6,188.4) (210.6, 129.8) (186.6, 129.8) 90 #Drive toward switch - switch - -LLRx: - moveto (0, 129.8) (42.6, 129.8) 90 #Drive directly forward then turn into switch - switch - moveto (0, 129.8) #Back out from switch - moveto (0, 80.4) (108, 80.4) 90 #Drive toward cubes - intake - moveto (0, 80.4) #Back out from cubes - moveto (0, 188.4) (246.6, 188.4) (246.6, 284.4) (192.6, 284.4) -90 #Curve around switch and drive to scale - scale - -LLLx: - moveto (0, 129.8) (42.6, 129.8) 90 #Drive directly forward then turn into switch - switch - moveto (0, 129.8) #Back out from switch - moveto (0, 80.4) (108, 80.4) 90 #Drive toward cubes - intake - moveto (0, 80.4) #Back out from cubes - moveto (0, 284.4) (24.6, 284.4) 90 #Drive toward scale - scale +move 56 +turn 90 +move 85 +turn 90 +move 8 +exchange -#------------------------------------------------- #Switch and Exchange -LRxE: - moveto (0, 188.4) (210.6,188.4) (210.6, 129.8) (186.6, 129.8) -90 #Curve around switch and then "ram" into switch - switch - moveto (246.6, 129.8) #Back out from switch - moveto (246.6, 80.4) (12, 80.4) #Drive toward cubes - intake - moveto (246.6, 80.4) #Back out from cubes - moveto (246.6, 3.7) (124.8, 3.7) 180 #Drive toward exchange - exchange - LLxE: - moveto (0, 129.8) (42.6, 129.8) 90 #Drive directly forward then turn into switch - switch - moveto (0, 129.8) #Back out from switch - moveto (102, 80.4) 90 #Drive toward cubes - intake - moveto (0, 80.4) #Back out from cubes - moveto (0, 36) (96,36) 180 #Go to exchange - exchange - -# moveto -# turn -# move -# switch -# scale -# exchange -# wait -# intake -# jump -# end - - - -# 1. Robot's start position. R = right, C = center, L = left. -# 2. Switch information. R = going for the right plate, L = going for the left plate, x = not going for # switch -# 3. Scale information. R = going for the right plate, L = going for the left plate, x = not going for # scale -# 4. Exchange. E = going for the exchange, x = not going for exchange - - -# Location of Robot: rightmost next to exchange - -# Cross Auto Line -Cxxx: -moveto (48,80.375) #cross baseline - - -# Switch -CRxx: - -moveto (0,60) (48,60) (-48,104.375)#5 feet forward, 4 right, 7 forward -switch #deploy switch - -CLxx: -moveto (0,60) (-48,60) (-48,104.375)#5 feet forward, 4 left, 7 forward -switch #deploy switch - -# Scale -CxRx: -moveto (0,60) (114,60)#5 feet forward, 9.5 right +move 150 +turn 90 +switch +turn 90 +move 95 turn -90 -move 224.375 #22 feet forward, compensating for robot length -turn -90 #turn to face the switch -scale #deploy scale - +move 103 +turn -90 +move 6 +intake +turn -90 +move 25 +turn -90 +move 12 +exchange -CxLx: -moveto (0,60) (-90,60) #5 feet forward, 90in left +LRxE: +move 56 turn 90 -move 224.375 #22 feet forward, compensating for robot length -turn 90 #turn to face the switch -scale #deploy scale - - -# Switch and Scale -CRLx: -moveto (0,60) (48,60) (48,104.375) #5 feet forward, 4 right, 7 forward -switch #deploy switch -move -39 #move 39 inches back -turn -90 #turn -90 degrees -move 48 #move 4 feet forward -intake #intake -turn -90 #turn -90 -move 45 # move 45 in. forward -turn -90 #turn 90 -moveto (-90,60)#7.5 feet left +move 170 +turn -90 +move 25 +switch +move -40 +turn -90 +move 55 turn 90 -move 264 #22 feet forward -turn 90 #turn to face the switch -scale #deploy scale2 - - - -CRRx: -moveto (0,60) (48,60) (48,104.375)#5 feet forward, 4 right, 7 forward -switch #deploy switch -move -39 #move 39 inches back -turn -90 #turn -90 degrees -move 48 #move 4 feet forward intake -turn -90 #turn -90 -move 45 # move 45 in. forward -turn -90 #turn -90 degrees -moveto (114, 60)#9.5 feet right turn -90 -move 264 #22 feet forward -turn -90 #turn to face the switch -scale #deploy scale - - - -CLRx: - -moveto (0,60) (-48,60) (-48,104.375) #5 feet forward, 4 left, 7 for -switch #deploy switch -move -39 #move 39 inches back -turn -90 #turn -90 degrees -move 48 #move 4 feet forward -intake #intake -turn 90 #turn 90 -move 45 # move 45 in. forward -turn 90 #turn 90 degrees -moveto (114, 60)#9.5 feet right +move 25 turn -90 -move 264 #22 feet forward -turn -90 #turn to face the switch -scale #deploy scale - +move 12 +exchange -CLLx: +#CENTER SCRIPTS -moveto (0,60) (-48,60) (-48,104.375) #5 feet forward, 4 left, 7 forward -switch #deploy switch -move -39 #move 39 inches back -turn 90 #turn 90 degrees -move 48 #move 4 feet forward -intake #intake -turn 90 #turn -90 -move 45 # move 45 in. forward -turn 90 #turn 90 -moveto (-90,60)#7.5 feet right -turn -90 -move 264 #22 feet forward -turn 90 #turn to face the switch -scale #deploy scale2 +# Cross Auto Line +Cxxx: +moveto (0, 12) (40, 88) +# Switch +CRxx: +moveto (0,15) (50,80) 0 +switch 16 +move -40 +intake +moveto (20, 65) +CLxx: +moveto (0,15) (-60,80) 0 +switch 16 +move -40 +intake +moveto (-30, 65) # Switch and Exchange CRxE: - -moveto (0,60) (48,60) (48,104.375)#5 feet forward, 4 right, 7 forward +moveto (0,50) (48,50) (48,85) switch #deploy switch -move -24 # 2 feet back +move -48 # 3 feet back turn -90 -move 12 # 1 ft forward +move 53 +turn 90 +move 6 intake turn -90 -move 72 #move 6 feet forwards -turn 90 -move 60 #move 5 feet forward -turn -90 #turn to face the exchange +move 25 +turn -90 exchange -CLxE: -moveto (0,60) (-48,60) (-48,104.375)#5 feet forward, 4 left, 7 forward -switch #deploy switch -move -24 +CLxE: +moveto (0,50) (-56,50) (-56,85) +switch #deploy switch +move -48 # 3 feet back turn 90 -move 24 +move 53 +turn -90 +move 6 intake -turn 90 -move -84 #move 7 feet back -turn 180 #turn 180 degrees to face the exchange +turn -90 +move 25 +turn -90 exchange # Exchange CxxE: -moveto (0,60) (-48,60) (-48,104.375) #5 feet forward, 3 left, 7 feet forward until against switch enclosure,compensating for robot length -move -96 #move 8 feet back -turn 180 #turn 180 degrees to face the exchange +move 50 +turn -90 +move 30 +turn -90 exchange + + diff --git a/CompSD.xml b/CompSD.xml index d252b62..f7eed51 100644 --- a/CompSD.xml +++ b/CompSD.xml @@ -1,72 +1,364 @@ - - - 93 - 78 - - - - 529 - 399 - - - - 502 - 383 + + 552 + 403 + - - + + + + + + + + + 118 + 59 + + + + 96 + 30 + + + + 113 + 44 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - 284 - 205 + + + + + + + + + + + + + 105 + 53 + - - - - - - + + + + + + + + + - + - - - 159 + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + 338 + 974 + + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + + + 305 + 323 + - - - - - - - - - - - - - \ No newline at end of file diff --git a/Robot2018/.classpath b/Robot2018/.classpath index 9278f52..e16509f 100644 --- a/Robot2018/.classpath +++ b/Robot2018/.classpath @@ -1,20 +1,12 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + diff --git a/Robot2018/.gitignore b/Robot2018/.gitignore new file mode 100644 index 0000000..61f25ce --- /dev/null +++ b/Robot2018/.gitignore @@ -0,0 +1,160 @@ +# Created by https://www.gitignore.io/api/c++,java,linux,macos,gradle,windows,visualstudiocode + +### C++ ### +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +### Java ### +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### Gradle ### +.gradle +/build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Cache of project +.gradletasknamecache + +# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 +# gradle/wrapper/gradle-wrapper.properties + +# # VS Code Specific Java Settings +.classpath +.project +.settings/ +bin/ + + +# End of https://www.gitignore.io/api/c++,java,linux,macos,gradle,windows,visualstudiocode diff --git a/Robot2018/.project b/Robot2018/.project index ccb0af9..b8cc0e5 100644 --- a/Robot2018/.project +++ b/Robot2018/.project @@ -1,7 +1,7 @@ Robot2018 - + Project RobotCode2018 created by Buildship. @@ -10,9 +10,14 @@ + + org.eclipse.buildship.core.gradleprojectbuilder + + + org.eclipse.jdt.core.javanature - edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature + org.eclipse.buildship.core.gradleprojectnature diff --git a/Robot2018/.vscode/launch.json b/Robot2018/.vscode/launch.json new file mode 100644 index 0000000..c9c9713 --- /dev/null +++ b/Robot2018/.vscode/launch.json @@ -0,0 +1,21 @@ +{ + // 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": "wpilib", + "name": "WPILib Desktop Debug", + "request": "launch", + "desktop": true, + }, + { + "type": "wpilib", + "name": "WPILib roboRIO Debug", + "request": "launch", + "desktop": false, + } + ] +} diff --git a/Robot2018/.vscode/settings.json b/Robot2018/.vscode/settings.json new file mode 100644 index 0000000..dc084a0 --- /dev/null +++ b/Robot2018/.vscode/settings.json @@ -0,0 +1,13 @@ +{ + "java.configuration.updateBuildConfiguration": "automatic", + "files.exclude": { + "**/.git": true, + "**/.svn": true, + "**/.hg": true, + "**/CVS": true, + "**/.DS_Store": true, + "bin/": true, + ".classpath": true, + ".project": true + } +} diff --git a/Robot2018/.wpilib/wpilib_preferences.json b/Robot2018/.wpilib/wpilib_preferences.json new file mode 100644 index 0000000..a7431db --- /dev/null +++ b/Robot2018/.wpilib/wpilib_preferences.json @@ -0,0 +1,6 @@ +{ + "enableCppIntellisense": false, + "currentLanguage": "java", + "projectYear": "2019", + "teamNumber": 199 +} \ No newline at end of file diff --git a/Robot2018/build.gradle b/Robot2018/build.gradle new file mode 100644 index 0000000..b797961 --- /dev/null +++ b/Robot2018/build.gradle @@ -0,0 +1,64 @@ +plugins { + id "java" + id "edu.wpi.first.GradleRIO" version "2019.2.1" +} + +sourceCompatibility = JavaVersion.VERSION_11 +targetCompatibility = JavaVersion.VERSION_11 + +def ROBOT_MAIN_CLASS = "org.usfirst.frc.team199.Robot2018.Main" + +// Define my targets (RoboRIO) and artifacts (deployable files) +// This is added by GradleRIO's backing project EmbeddedTools. +deploy { + targets { + 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 = frc.getTeamNumber() + } + } + artifacts { + frcJavaArtifact('frcJava') { + targets << "roborio" + // Debug can be overridden by command line, for use with VSCode + 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' + } + } +} + +// Set this to true to enable desktop support. +def includeDesktopSupport = true + +// Maven central needed for JUnit +repositories { + mavenCentral() +} + +// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. +// Also defines JUnit 4. +dependencies { + 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' +} + +// 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_MAIN_CLASS) +} diff --git a/Robot2018/build.properties b/Robot2018/build.properties deleted file mode 100644 index 38864c0..0000000 --- a/Robot2018/build.properties +++ /dev/null @@ -1,14 +0,0 @@ -# Project specific information -package=org.usfirst.frc.team199.Robot2018 -robot.class=${package}.Robot -simulation.world.file=/usr/share/frcsim/worlds/GearsBotDemo.world - -# Tell the FRC Plugin to look for third-party libs (*.jar, and *.so) in the -# "lib" directory instead of in ${user.home}/wpilib/user/java/lib -# so that those libs can be versioned with the code and don't need to -# be manually installed on each developer's machine. The FRC plugin -# will automatically add all jars in the "lib" directory to the -# classpath and will deploy the jars and .so files to the roboRIO along -# with our code. -# NOTE: The libs need to be directly in the "lib" dir, not in a subdir. -userLibs.dir=lib diff --git a/Robot2018/build.xml b/Robot2018/build.xml deleted file mode 100644 index 76fd29a..0000000 --- a/Robot2018/build.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Robot2018/gradle/wrapper/gradle-wrapper.jar b/Robot2018/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..457aad0 Binary files /dev/null and b/Robot2018/gradle/wrapper/gradle-wrapper.jar differ diff --git a/Robot2018/gradle/wrapper/gradle-wrapper.properties b/Robot2018/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..d08253c --- /dev/null +++ b/Robot2018/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=permwrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=permwrapper/dists diff --git a/Robot2018/gradlew b/Robot2018/gradlew new file mode 100755 index 0000000..af6708f --- /dev/null +++ b/Robot2018/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +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='"-Xmx64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/Robot2018/gradlew.bat b/Robot2018/gradlew.bat new file mode 100644 index 0000000..6d57edc --- /dev/null +++ b/Robot2018/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +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="-Xmx64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/Robot2018/lib/.gitignore b/Robot2018/lib/.gitignore deleted file mode 100644 index 7dda1be..0000000 --- a/Robot2018/lib/.gitignore +++ /dev/null @@ -1 +0,0 @@ -User_Libraries.properties diff --git a/Robot2018/lib/CTRE_Phoenix-sources.jar b/Robot2018/lib/CTRE_Phoenix-sources.jar deleted file mode 100644 index f7c14b7..0000000 Binary files a/Robot2018/lib/CTRE_Phoenix-sources.jar and /dev/null differ diff --git a/Robot2018/lib/CTRE_Phoenix.jar b/Robot2018/lib/CTRE_Phoenix.jar deleted file mode 100644 index 4690574..0000000 Binary files a/Robot2018/lib/CTRE_Phoenix.jar and /dev/null differ diff --git a/Robot2018/lib/LICENSE-Pathfinder b/Robot2018/lib/LICENSE-Pathfinder deleted file mode 100644 index 048cf40..0000000 --- a/Robot2018/lib/LICENSE-Pathfinder +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jaci R - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Robot2018/lib/LICENSE-byte-buddy b/Robot2018/lib/LICENSE-byte-buddy deleted file mode 100644 index e06d208..0000000 --- a/Robot2018/lib/LICENSE-byte-buddy +++ /dev/null @@ -1,202 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/Robot2018/lib/LICENSE-mockito b/Robot2018/lib/LICENSE-mockito deleted file mode 100644 index e0840a4..0000000 --- a/Robot2018/lib/LICENSE-mockito +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License - -Copyright (c) 2007 Mockito contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/Robot2018/lib/LICENSE-objenesis b/Robot2018/lib/LICENSE-objenesis deleted file mode 100644 index d645695..0000000 --- a/Robot2018/lib/LICENSE-objenesis +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/Robot2018/lib/NOTICE-objenesis b/Robot2018/lib/NOTICE-objenesis deleted file mode 100644 index 728d636..0000000 --- a/Robot2018/lib/NOTICE-objenesis +++ /dev/null @@ -1,9 +0,0 @@ -// ------------------------------------------------------------------ -// NOTICE file corresponding to the section 4d of The Apache License, -// Version 2.0, in this case for Objenesis -// ------------------------------------------------------------------ - -Objenesis -Copyright 2006-2017 Joe Walnes, Henri Tremblay, Leonardo Mesquita - - diff --git a/Robot2018/lib/Pathfinder-Java-1.8.jar b/Robot2018/lib/Pathfinder-Java-1.8.jar deleted file mode 100644 index 9054e2b..0000000 Binary files a/Robot2018/lib/Pathfinder-Java-1.8.jar and /dev/null differ diff --git a/Robot2018/lib/README.md b/Robot2018/lib/README.md deleted file mode 100644 index 3ac8390..0000000 --- a/Robot2018/lib/README.md +++ /dev/null @@ -1,10 +0,0 @@ -Place all third-party libraries (*.jar and *.so) directly in this directory, -not a subdirectory. - -The `userLibs.dir` property in `../build.properties` is set to point to -this directory so that the FRC plugin will look here for third-party libs -(*.jar, and *.so) instead of in `${user.home}/wpilib/user/java/lib`. This -ensures that those libs can be versioned with the code and don't need to -be manually installed on each developer's machine. The FRC plugin will -automatically add all jars in this directory to the classpath and will -deploy the jars and .so files to the roboRIO along with our code. \ No newline at end of file diff --git a/Robot2018/lib/byte-buddy-1.7.9-javadoc.jar b/Robot2018/lib/byte-buddy-1.7.9-javadoc.jar deleted file mode 100644 index a60e9ab..0000000 Binary files a/Robot2018/lib/byte-buddy-1.7.9-javadoc.jar and /dev/null differ diff --git a/Robot2018/lib/byte-buddy-1.7.9-javadoc.jar.asc b/Robot2018/lib/byte-buddy-1.7.9-javadoc.jar.asc deleted file mode 100644 index d7d8015..0000000 --- a/Robot2018/lib/byte-buddy-1.7.9-javadoc.jar.asc +++ /dev/null @@ -1,6 +0,0 @@ ------BEGIN PGP SIGNATURE----- - -iEYEABECAAYFAloA2gkACgkQuykUwfoIEcO7kQCg2V8IwP8xAi/OKrvTujX+p4a0 -ZjcAn3T73GEpiXA8NdmDeHgl5dV8X7iX -=omHA ------END PGP SIGNATURE----- diff --git a/Robot2018/lib/byte-buddy-1.7.9.jar b/Robot2018/lib/byte-buddy-1.7.9.jar deleted file mode 100644 index a348888..0000000 Binary files a/Robot2018/lib/byte-buddy-1.7.9.jar and /dev/null differ diff --git a/Robot2018/lib/libpathfinderjava.so b/Robot2018/lib/libpathfinderjava.so deleted file mode 100644 index 0e10023..0000000 Binary files a/Robot2018/lib/libpathfinderjava.so and /dev/null differ diff --git a/Robot2018/lib/mockito-core-2.13.3-javadoc.jar b/Robot2018/lib/mockito-core-2.13.3-javadoc.jar deleted file mode 100644 index e958db1..0000000 Binary files a/Robot2018/lib/mockito-core-2.13.3-javadoc.jar and /dev/null differ diff --git a/Robot2018/lib/mockito-core-2.13.3-sources.jar b/Robot2018/lib/mockito-core-2.13.3-sources.jar deleted file mode 100644 index b9f1601..0000000 Binary files a/Robot2018/lib/mockito-core-2.13.3-sources.jar and /dev/null differ diff --git a/Robot2018/lib/mockito-core-2.13.3.jar b/Robot2018/lib/mockito-core-2.13.3.jar deleted file mode 100644 index 1dba556..0000000 Binary files a/Robot2018/lib/mockito-core-2.13.3.jar and /dev/null differ diff --git a/Robot2018/lib/navx_frc.jar b/Robot2018/lib/navx_frc.jar deleted file mode 100644 index 32d6298..0000000 Binary files a/Robot2018/lib/navx_frc.jar and /dev/null differ diff --git a/Robot2018/lib/objenesis-2.6-javadoc.jar b/Robot2018/lib/objenesis-2.6-javadoc.jar deleted file mode 100644 index 3af58ea..0000000 Binary files a/Robot2018/lib/objenesis-2.6-javadoc.jar and /dev/null differ diff --git a/Robot2018/lib/objenesis-2.6-sources.jar b/Robot2018/lib/objenesis-2.6-sources.jar deleted file mode 100644 index aeaf9d8..0000000 Binary files a/Robot2018/lib/objenesis-2.6-sources.jar and /dev/null differ diff --git a/Robot2018/lib/objenesis-2.6.jar b/Robot2018/lib/objenesis-2.6.jar deleted file mode 100644 index db739d3..0000000 Binary files a/Robot2018/lib/objenesis-2.6.jar and /dev/null differ diff --git a/Robot2018/settings.gradle b/Robot2018/settings.gradle new file mode 100644 index 0000000..b0f4d48 --- /dev/null +++ b/Robot2018/settings.gradle @@ -0,0 +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 + } + } +} diff --git a/Robot2018/src/main/deploy/example.txt b/Robot2018/src/main/deploy/example.txt new file mode 100644 index 0000000..bb82515 --- /dev/null +++ b/Robot2018/src/main/deploy/example.txt @@ -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 'Filesystem.getDeployDirectory' wpilib function +to get a proper path relative to the deploy directory. \ No newline at end of file diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/Listener.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/Listener.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/Listener.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/Listener.java diff --git a/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/Main.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/Main.java new file mode 100644 index 0000000..c9f7c69 --- /dev/null +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/Main.java @@ -0,0 +1,29 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) 2018 FIRST. All Rights Reserved. */ +/* Open Source Software - may be modified and shared by FRC teams. The code */ +/* must be accompanied by the FIRST BSD license file in the root directory of */ +/* the project. */ +/*----------------------------------------------------------------------------*/ + +package org.usfirst.frc.team199.Robot2018; + +import edu.wpi.first.wpilibj.RobotBase; + +/** + * Do NOT add any static variables to this class, or any initialization at all. + * Unless you know what you are doing, do not modify this file except to + * change the parameter class to the startRobot call. + */ +public final class Main { + private Main() { + } + + /** + * Main initialization function. Do not perform any initialization here. + * + *

If you change your main robot class, change the parameter type. + */ + public static void main(String... args) { + RobotBase.startRobot(Robot::new); + } +} diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/OI.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/OI.java similarity index 64% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/OI.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/OI.java index 3e7d808..3ff300f 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/OI.java +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/OI.java @@ -8,23 +8,20 @@ package org.usfirst.frc.team199.Robot2018; import org.usfirst.frc.team199.Robot2018.commands.AutoLift; -import org.usfirst.frc.team199.Robot2018.commands.CloseIntake; import org.usfirst.frc.team199.Robot2018.commands.FindTurnTimeConstant; import org.usfirst.frc.team199.Robot2018.commands.IntakeCube; +import org.usfirst.frc.team199.Robot2018.commands.InvertDrivetrain; import org.usfirst.frc.team199.Robot2018.commands.MoveLift; import org.usfirst.frc.team199.Robot2018.commands.MoveLiftWithPID; -import org.usfirst.frc.team199.Robot2018.commands.OpenIntake; import org.usfirst.frc.team199.Robot2018.commands.OuttakeCube; import org.usfirst.frc.team199.Robot2018.commands.PIDMove; import org.usfirst.frc.team199.Robot2018.commands.PIDTurn; import org.usfirst.frc.team199.Robot2018.commands.ResetEncoders; import org.usfirst.frc.team199.Robot2018.commands.SetDistancePerPulse; -import org.usfirst.frc.team199.Robot2018.commands.ShiftDriveType; import org.usfirst.frc.team199.Robot2018.commands.ShiftHighGear; import org.usfirst.frc.team199.Robot2018.commands.ShiftLowGear; import org.usfirst.frc.team199.Robot2018.commands.StopIntake; -import org.usfirst.frc.team199.Robot2018.commands.ToggleLeftIntake; -import org.usfirst.frc.team199.Robot2018.commands.ToggleRightIntake; +import org.usfirst.frc.team199.Robot2018.commands.ToggleIntake; import org.usfirst.frc.team199.Robot2018.commands.UpdatePIDConstants; import org.usfirst.frc.team199.Robot2018.subsystems.LiftInterface.LiftHeight; @@ -46,7 +43,7 @@ public class OI { public Joystick rightJoy; private JoystickButton shiftLowGearButton; private JoystickButton shiftHighGearButton; - private JoystickButton shiftDriveTypeButton; + // private JoystickButton shiftDriveTypeButton; private JoystickButton pIDMoveButton; private JoystickButton pIDTurnButton; private JoystickButton resetEncButton; @@ -58,6 +55,7 @@ public class OI { private JoystickButton findTurnTimeConstantButton; private JoystickButton updatePIDConstantsButton; private JoystickButton updateEncoderDPPButton; + private JoystickButton invertDTButton; public Joystick manipulator; private JoystickButton closeIntakeButton; @@ -68,6 +66,7 @@ public class OI { private JoystickButton outakeCubeButton; private JoystickButton toggleLeftIntakeButton; private JoystickButton toggleRightIntakeButton; + private JoystickButton toggleIntakeButton; private JoystickButton stopIntakeButton; public int getButton(String key, int def) { @@ -82,28 +81,28 @@ public int getButton(String key, int def) { public OI(Robot robot) { leftJoy = new Joystick(0); - shiftDriveTypeButton = new JoystickButton(leftJoy, getButton("Shift Drive Type", 2)); - shiftDriveTypeButton.whenPressed(new ShiftDriveType()); + // shiftDriveTypeButton = new JoystickButton(leftJoy, getButton("Shift Drive + // Type", 2)); + // shiftDriveTypeButton.whenPressed(new ShiftDriveType()); - pIDMoveButton = new JoystickButton(leftJoy, getButton("PID Move", 7)); - pIDMoveButton - .whenPressed(new PIDMove(Robot.sd.getConst("Move Targ", 24), Robot.dt, Robot.sd, RobotMap.distEncAvg)); - pIDTurnButton = new JoystickButton(leftJoy, getButton("PID Turn", 8)); - pIDTurnButton - .whenReleased(new PIDTurn(Robot.getConst("Turn Targ", 90), Robot.dt, Robot.sd, RobotMap.fancyGyro)); + invertDTButton = new JoystickButton(leftJoy, getButton("Invert Drivetrain", 3)); + invertDTButton.whenPressed(new InvertDrivetrain()); - resetEncButton = new JoystickButton(leftJoy, getButton("Reset Dist Enc", 10)); - resetEncButton.whenPressed(new ResetEncoders()); + // commented out for safety reasons + // pIDMoveButton = new JoystickButton(leftJoy, getButton("PID Move", 7)); + // pIDMoveButton + // .whenPressed(new PIDMove(Robot.sd.getConst("Move Targ", 24), Robot.dt, Robot.sd, RobotMap.distEncAvg)); + // pIDTurnButton = new JoystickButton(leftJoy, getButton("PID Turn", 8)); + // pIDTurnButton + // .whenReleased(new PIDTurn(Robot.getConst("Turn Targ", 90), Robot.dt, Robot.sd, RobotMap.fancyGyro)); - findTurnTimeConstantButton = new JoystickButton(leftJoy, getButton("Find Turn Time Constant", 11)); - // the command will only run in test mode - findTurnTimeConstantButton - .whenPressed(new FindTurnTimeConstant(robot, Robot.dt, Robot.rmap.fancyGyro, Robot.sd)); + // resetEncButton = new JoystickButton(leftJoy, getButton("Reset Dist Enc", 10)); + // resetEncButton.whenPressed(new ResetEncoders()); - moveLiftPIDUpButton = new JoystickButton(leftJoy, getButton("Run Lift PID Up", 3)); - moveLiftPIDUpButton.whileHeld(new MoveLiftWithPID(Robot.lift, true)); - moveLiftPIDDownButton = new JoystickButton(leftJoy, getButton("Run Lift PID Down", 4)); - moveLiftPIDDownButton.whileHeld(new MoveLiftWithPID(Robot.lift, false)); + // findTurnTimeConstantButton = new JoystickButton(leftJoy, getButton("Find Turn Time Constant", 11)); + // the command will only run in test mode + // findTurnTimeConstantButton + // .whenPressed(new FindTurnTimeConstant(robot, Robot.dt, Robot.rmap.fancyGyro, Robot.sd)); testLiftPID = new JoystickButton(leftJoy, getButton("Test Lift PID", 5)); testLiftPID.whenPressed( @@ -120,38 +119,48 @@ public OI(Robot robot) { updateEncoderDPPButton = new JoystickButton(rightJoy, getButton("Get Encoder Dist Per Pulse", 9)); updateEncoderDPPButton.whenPressed(new SetDistancePerPulse()); - moveLiftUpButton = new JoystickButton(rightJoy, getButton("Run Lift Motor Up", 10)); - moveLiftUpButton.whileHeld(new MoveLift(Robot.lift, true)); - moveLiftDownButton = new JoystickButton(rightJoy, getButton("Run Lift Motor Down", 11)); - moveLiftDownButton.whileHeld(new MoveLift(Robot.lift, false)); + // moveLiftUpButton = new JoystickButton(rightJoy, getButton("Run Lift Motor Up", 10)); + // moveLiftUpButton.whileHeld(new MoveLift(Robot.lift, true)); + // moveLiftDownButton = new JoystickButton(rightJoy, getButton("Run Lift Motor Down", 11)); + // moveLiftDownButton.whileHeld(new MoveLift(Robot.lift, false)); - stopIntakeButton = new JoystickButton(rightJoy, getButton("Stop Intake Button", 6)); + manipulator = new Joystick(2); + // if (manipulator.getButtonCount() == 0) { + // System.err.println( + // "ERROR: manipulator does not appear to be plugged in. Disabling intake code. + // Restart code with manipulator plugged in to enable intake code"); + // } else { + + // closeIntakeButton = new JoystickButton(manipulator, getButton("Close Intake + // Button", 1)); + // closeIntakeButton.whenPressed(new CloseIntake()); + // openIntakeButton = new JoystickButton(manipulator, getButton("Open Intake + // Button", 2)); + // openIntakeButton.whenPressed(new OpenIntake()); + + System.out.println("New code yay :D"); + moveLiftPIDUpButton = new JoystickButton(manipulator, 4); + moveLiftPIDUpButton.whileHeld(new MoveLiftWithPID(Robot.lift, true)); + moveLiftPIDDownButton = new JoystickButton(manipulator, getButton("Run Lift PID Down", 1)); + moveLiftPIDDownButton.whileHeld(new MoveLiftWithPID(Robot.lift, false)); + + toggleIntakeButton = new JoystickButton(manipulator, getButton("Toggle Intake Button", 2)); + toggleIntakeButton.whenPressed(new ToggleIntake()); + + stopIntakeButton = new JoystickButton(manipulator, getButton("Stop Intake Button", 3)); stopIntakeButton.whenPressed(new StopIntake()); - manipulator = new Joystick(2); - if (manipulator.getButtonCount() == 0) { - System.err.println( - "ERROR: manipulator does not appear to be plugged in. Disabling intake code. Restart code with manipulator plugged in to enable intake code"); - } else { - closeIntakeButton = new JoystickButton(manipulator, getButton("Close Intake Button", 1)); - closeIntakeButton.whenPressed(new CloseIntake()); - openIntakeButton = new JoystickButton(manipulator, getButton("Open Intake Button", 2)); - openIntakeButton.whenPressed(new OpenIntake()); - // raiseIntake = new JoystickButton(manipulator, getButton("Raise Intake - // Button", 3)); - // raiseIntake.whenPressed(new RaiseIntake()); - // lowerIntake = new JoystickButton(manipulator, getButton("Lower Intake - // Button", 4)); - // lowerIntake.whenPressed(new LowerIntake()); - intakeCubeButton = new JoystickButton(manipulator, getButton("Intake Button", 5)); - intakeCubeButton.whenPressed(new IntakeCube()); - outakeCubeButton = new JoystickButton(manipulator, getButton("Outake Button", 6)); - outakeCubeButton.whenPressed(new OuttakeCube()); - toggleLeftIntakeButton = new JoystickButton(manipulator, getButton("Toggle Left Intake Button", 3)); - toggleLeftIntakeButton.whenPressed(new ToggleLeftIntake()); - toggleRightIntakeButton = new JoystickButton(manipulator, getButton("Toggle Right Intake Button", 4)); - toggleRightIntakeButton.whenPressed(new ToggleRightIntake()); - } + intakeCubeButton = new JoystickButton(manipulator, getButton("Intake Button", 5)); + intakeCubeButton.whenPressed(new IntakeCube()); + outakeCubeButton = new JoystickButton(manipulator, getButton("Outake Button", 6)); + outakeCubeButton.whenPressed(new OuttakeCube()); + // toggleLeftIntakeButton = new JoystickButton(manipulator, getButton("Toggle + // Left Intake Button", 3)); + // toggleLeftIntakeButton.whenPressed(new ToggleLeftIntake()); + // toggleRightIntakeButton = new JoystickButton(manipulator, getButton("Toggle + // Right Intake Button", 4)); + // toggleRightIntakeButton.whenPressed(new ToggleRightIntake()); + // } } diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/Robot.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/Robot.java similarity index 97% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/Robot.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/Robot.java index 80897aa..269ee8c 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/Robot.java +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/Robot.java @@ -49,11 +49,14 @@ public class Robot extends IterativeRobot { public static RobotMap rmap; public static Drivetrain dt; public static Listener listen; + public static Robot robot; public static OI oi; public static Map> autoScripts; + public static boolean stopIntake = false; + Command autonomousCommand; SendableChooser posChooser = new SendableChooser(); Map> stratChoosers = new HashMap>(); @@ -149,6 +152,7 @@ public static boolean getBool(String key, boolean def) { */ @Override public void robotInit() { + robot = this; rmap = new RobotMap(); climber = new Climber(); climberAssist = new ClimberAssist(); @@ -181,8 +185,8 @@ public void robotInit() { listen = new Listener(); lift.resetEnc(); - CameraServer.getInstance().startAutomaticCapture(0); - CameraServer.getInstance().startAutomaticCapture(1); + // CameraServer.getInstance().startAutomaticCapture(0); + CameraServer.getInstance().startAutomaticCapture((int) Robot.getConst("Camera Port", 1)); } /** diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/RobotMap.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/RobotMap.java similarity index 99% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/RobotMap.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/RobotMap.java index bb50606..5e1d83b 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/RobotMap.java +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/RobotMap.java @@ -178,6 +178,9 @@ public RobotMap() { rightEncRate.setDistancePerPulse(Robot.getConst("DPP", DIST_PER_PULSE_RATIO)); rightEncRate.setReverseDirection(true); + leftEncDist.setReverseDirection(false); + rightEncDist.setReverseDirection(false); + dtRightMaster = new WPI_TalonSRX(getPort("RightTalonSRXMaster", 4)); configSRX(dtRightMaster); dtRightSlave = new WPI_VictorSPX(getPort("RightVictorSPXSlave", 3)); diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/SmartDashboardInterface.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/SmartDashboardInterface.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/SmartDashboardInterface.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/SmartDashboardInterface.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/AutoUtils.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/AutoUtils.java similarity index 88% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/AutoUtils.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/AutoUtils.java index 4dd28da..8e17b25 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/AutoUtils.java +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/AutoUtils.java @@ -109,7 +109,7 @@ public static boolean isValidCommand(String instruction, String args, int lineNu // moveto takes in a set of points, and the last arg can be a number if (instruction.equals("moveto")) { if (args == "") { - logError(lineNumber, "The command `moveto` requires at least one argument."); + logError(lineNumber, "The command `" + instruction + "` requires at least one argument."); return false; } @@ -117,13 +117,13 @@ public static boolean isValidCommand(String instruction, String args, int lineNu for (int i = 0; i < splitArgs.length - 1; i++) { if (!isPoint(splitArgs[i])) { logError(lineNumber, - "The arguments for command `moveto` should be points formatted like this: " + "`(x,y)`."); + "The arguments for command `" + instruction + "` should be points formatted like this: " + "`(x,y)`."); return false; } } if (!isDouble(splitArgs[splitArgs.length - 1]) && !isPoint(splitArgs[splitArgs.length - 1])) { - logError(lineNumber, "The last argument for command `moveto` should be a number, or a point " + logError(lineNumber, "The last argument for command `" + instruction + "` should be a number, or a point " + "formatted like this: `(x,y)`."); return false; } @@ -132,32 +132,32 @@ public static boolean isValidCommand(String instruction, String args, int lineNu // turn can take a number or point else if (instruction.equals("turn")) { if (args.contains(" ")) { - logError(lineNumber, "Command `turn` only accepts one argument."); + logError(lineNumber, "Command `" + instruction + "` only accepts one argument."); return false; } if (!isDouble(args) && !isPoint(args)) { - logError(lineNumber, "The argument for command `turn` should be a number or a point formatted like " + logError(lineNumber, "The argument for command `" + instruction + "` should be a number or a point formatted like " + "this: `(x,y)`."); return false; } } - // move and wait can take only a number - else if (instruction.equals("move") || instruction.equals("wait")) { + // these can take only a number + else if (instruction.equals("move") || instruction.equals("wait") || instruction.equals("switch") || instruction.equals("scale")) { if (args.contains(" ")) { - logError(lineNumber, "Command `move` only accepts one argument."); + logError(lineNumber, "Command `" + instruction + "` only accepts one argument."); return false; } if (!isDouble(args)) { - logError(lineNumber, "The argument for command `move` should be a number."); + logError(lineNumber, "The argument for command `" + instruction + "` should be a number."); return false; } } // switch, scale, exchange, intake, and end all don't have any args - else if (instruction.equals("switch") || instruction.equals("scale") || instruction.equals("exchange") + else if (instruction.equals("exchange") || instruction.equals("intake") || instruction.equals("end")) { if (!args.equals("")) { logError(lineNumber, "Command `" + instruction + "` does not accept any arguments."); @@ -168,7 +168,7 @@ else if (instruction.equals("switch") || instruction.equals("scale") || instruct // Jump only takes one argument else if (instruction.equals("jump")) { if (args.contains(" ")) { - logError(lineNumber, "Command `jump` only accepts one argument."); + logError(lineNumber, "Command `" + instruction + "` only accepts one argument."); return false; } } diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/PIDSourceAverage.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/PIDSourceAverage.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/PIDSourceAverage.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/PIDSourceAverage.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/PIDSourceFromTalon.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/PIDSourceFromTalon.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/PIDSourceFromTalon.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/PIDSourceFromTalon.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/State.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/State.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/State.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/State.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/TalonVelocityController.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/TalonVelocityController.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/TalonVelocityController.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/TalonVelocityController.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/VelocityPIDController.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/VelocityPIDController.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/VelocityPIDController.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/VelocityPIDController.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/aaa-reference.md b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/aaa-reference.md similarity index 90% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/aaa-reference.md rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/aaa-reference.md index 608c17f..03c51a9 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/aaa-reference.md +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/aaa-reference.md @@ -50,7 +50,7 @@ Ex: | jump | Jumps to the specified script and continues the current script when finished. (Doesn’t make the robot go up.) | `jump MoveToRScale` | move | Move forward or backwards for the specified amount in inches, relative to the current position. | `move 24` | | moveto | Move to 1 or more points, sequentially, with an optional last value having a final angle to face towards, all relative to the starting position. | `moveto (12,0) (36,12)`
`moveto (0,12) 90` | -| scale | Place a cube at scale height. | `scale` | -| switch | Place a cube at switch height. | `switch` | +| scale | Place a cube at scale height after moving forward by the specified amount with the lift up, and after moves 12 inches back. | `scale 24` | +| switch | Place a cube at switch height after moving forward by the specified amount with the lift up, and after moves 12 inches back. | `switch 24` | | turn | Turn towards a relative point or rotate clockwise by an angle in degrees, relative to the current position.
Negative angle for counterclockwise. | `turn (36,48)`
`turn 45` | | wait | Waits for the number of seconds before proceeding to next command. | `wait 5` | diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/scriptupload/requirements.txt b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/scriptupload/requirements.txt similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/scriptupload/requirements.txt rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/scriptupload/requirements.txt diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/scriptupload/scriptupload.py b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/scriptupload/scriptupload.py similarity index 96% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/scriptupload/scriptupload.py rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/scriptupload/scriptupload.py index 948a80f..54c95b1 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/scriptupload/scriptupload.py +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/autonomous/scriptupload/scriptupload.py @@ -2,7 +2,7 @@ from networktables import NetworkTables import __future__ import time -NetworkTables.initialize(server='10.1.99.2') +NetworkTables.initialize(server='172.22.11.2') prefs = NetworkTables.getTable("Preferences") go = False #true when file has been successfully read diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/AutoLift.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/AutoLift.java similarity index 75% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/AutoLift.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/AutoLift.java index fb3fdbc..4615dc3 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/AutoLift.java +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/AutoLift.java @@ -13,9 +13,7 @@ public class AutoLift extends CommandGroup { public AutoLift(Lift lift, String height) { if (height.equals("GROUND")) { addSequential(new LiftToPosition(lift, LiftHeight.toLH("HOLD_CUBE"))); - addSequential(new LiftToPosition(lift, LiftHeight.toLH(height))); - } else { - addSequential(new LiftToPosition(lift, LiftHeight.toLH(height))); } + addSequential(new LiftToPosition(lift, LiftHeight.toLH(height))); } } diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/AutoMoveTo.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/AutoMoveTo.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/AutoMoveTo.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/AutoMoveTo.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/Autonomous.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/Autonomous.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/Autonomous.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/Autonomous.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/AutonomousInterface.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/AutonomousInterface.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/AutonomousInterface.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/AutonomousInterface.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/CloseIntake.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/CloseIntake.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/CloseIntake.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/CloseIntake.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/DefaultIntake.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/DefaultIntake.java similarity index 63% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/DefaultIntake.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/DefaultIntake.java index c7e7372..7ef26e7 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/DefaultIntake.java +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/DefaultIntake.java @@ -18,36 +18,44 @@ public DefaultIntake() { } // Called just before this Command runs the first time + @Override protected void initialize() { - try { - Robot.oi.manipulator.getRawAxis(1); - } catch (NullPointerException e) { - System.err.println("[ERROR] Manipulator not plugged in."); - manipulatorPluggedIn = false; - } + // try { + // Robot.oi.manipulator.getRawAxis(1); + // } catch (NullPointerException e) { + // System.err.println("[ERROR] Manipulator not plugged in."); + // manipulatorPluggedIn = false; + // } } // Called repeatedly when this Command is scheduled to run + @Override protected void execute() { // 1 and 5 represent the axes' index in driver station - if (manipulatorPluggedIn) { - Robot.intakeEject.runLeftIntake(Robot.oi.manipulator.getRawAxis(1)); - Robot.intakeEject.runRightIntake(Robot.oi.manipulator.getRawAxis(5)); - } + // if (manipulatorPluggedIn) { + // Robot.intakeEject.runLeftIntake(Robot.oi.manipulator.getRawAxis(1)); + // Robot.intakeEject.runRightIntake(Robot.oi.manipulator.getRawAxis(5)); + // } + Robot.intakeEject.runLeftIntake(Robot.getConst("Intake Holding Speed", 0.15)); + Robot.intakeEject.runRightIntake(Robot.getConst("Intake Holding Speed", 0.15)); + } // Make this return true when this Command no longer needs to run execute() + @Override protected boolean isFinished() { return false; } // Called once after isFinished returns true + @Override protected void end() { Robot.intakeEject.runIntake(0); } // Called when another command which requires one or more of the same // subsystems is scheduled to run + @Override protected void interrupted() { end(); } diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/EjectToExchange.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/EjectToExchange.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/EjectToExchange.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/EjectToExchange.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/EjectToScale.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/EjectToScale.java similarity index 61% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/EjectToScale.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/EjectToScale.java index 43da132..3a7fa9f 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/EjectToScale.java +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/EjectToScale.java @@ -9,12 +9,11 @@ */ public class EjectToScale extends CommandGroup { - public EjectToScale() { + public EjectToScale(double dist) { addSequential(new AutoLift(Robot.lift, "SCALE")); - addSequential( - new PIDMove(Robot.getConst("Auto Scale Move Dist", 12), Robot.dt, Robot.sd, Robot.dt.getDistEncAvg())); + addSequential(new PIDMove(dist, Robot.dt, Robot.sd, Robot.dt.getDistEncAvg())); addSequential(new OuttakeCube()); - addSequential(new PIDMove(-1 * Robot.getConst("Auto Scale Move Dist", 12), Robot.dt, Robot.sd, + addSequential(new PIDMove(-1 * Robot.getConst("Scale move back dist", 12), Robot.dt, Robot.sd, Robot.dt.getDistEncAvg())); addSequential(new AutoLift(Robot.lift, "GROUND")); } diff --git a/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/EjectToSwitch.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/EjectToSwitch.java new file mode 100644 index 0000000..a4cd840 --- /dev/null +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/EjectToSwitch.java @@ -0,0 +1,20 @@ +package org.usfirst.frc.team199.Robot2018.commands; + +import org.usfirst.frc.team199.Robot2018.Robot; + +import edu.wpi.first.wpilibj.command.CommandGroup; + +/** + * + */ +public class EjectToSwitch extends CommandGroup { + + public EjectToSwitch(double dist) { +// addSequential(new AutoLift(Robot.lift, "SWITCH")); + addSequential(new PIDMove(dist, Robot.dt, Robot.sd, Robot.dt.getDistEncAvg())); + addSequential(new OuttakeCube()); + addSequential(new PIDMove(-1 * Robot.getConst("Switch move back dist", 12), Robot.dt, Robot.sd, + Robot.dt.getDistEncAvg())); + addParallel(new AutoLift(Robot.lift, "GROUND")); + } +} diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/FindTurnTimeConstant.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/FindTurnTimeConstant.java similarity index 97% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/FindTurnTimeConstant.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/FindTurnTimeConstant.java index 2bc12e7..8ab8730 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/FindTurnTimeConstant.java +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/FindTurnTimeConstant.java @@ -53,10 +53,10 @@ public FindTurnTimeConstant(Robot robot, DrivetrainInterface dt, AHRS gyro, Smar // Called just before this Command runs the first time protected void initialize() { System.out.println("FindTurnTimeConstant is in init()"); - // if (!robot.isTest()) { - // System.out.println("but you're not in test mode."); - // return; - // } + if (!robot.isTest()) { + System.out.println("but you're not in test mode."); + return; + } // this should be done in low gear Robot.dt.shiftGears(false); diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/IntakeCube.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/IntakeCube.java similarity index 72% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/IntakeCube.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/IntakeCube.java index c08f053..368a156 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/IntakeCube.java +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/IntakeCube.java @@ -1,9 +1,11 @@ package org.usfirst.frc.team199.Robot2018.commands; import org.usfirst.frc.team199.Robot2018.Robot; +import org.usfirst.frc.team199.Robot2018.subsystems.LiftInterface.LiftHeight; import edu.wpi.first.wpilibj.Timer; import edu.wpi.first.wpilibj.command.Command; +import edu.wpi.first.wpilibj.command.Scheduler; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; /** @@ -17,6 +19,7 @@ public class IntakeCube extends Command { public IntakeCube() { // Use requires() here to declare subsystem dependencies // eg. requires(chassis); + // requires(Robot.intakeEject); tim = new Timer(); } @@ -26,16 +29,18 @@ protected void initialize() { tim.reset(); // tim.start(); overDraw = false; + Robot.stopIntake = false; } // Called repeatedly when this Command is scheduled to run @Override protected void execute() { - Robot.intakeEject.runIntake(1); + Robot.intakeEject.runIntake(-1); SmartDashboard.putBoolean("Has Cube", Robot.intakeEject.hasCube()); if (Robot.intakeEject.hasCube()) { if (!overDraw) { overDraw = true; + // tim.reset(); tim.start(); } } else { @@ -48,17 +53,23 @@ protected void execute() { // Make this return true when this Command no longer needs to run execute() @Override protected boolean isFinished() { - return tim.get() > Robot.getConst("Has Cube Timeout", 0.5); + return (tim.get() > Robot.getConst("Has Cube Timeout", 0.5)) || Robot.stopIntake; } // Called once after isFinished returns true @Override protected void end() { + Robot.intakeEject.stopIntake(); + Robot.stopIntake = true; + if (Robot.robot.isAutonomous()) { + Scheduler.getInstance().add(new LiftToPosition(Robot.lift, LiftHeight.SWITCH)); + } } // Called when another command which requires one or more of the same // subsystems is scheduled to run @Override protected void interrupted() { + end(); } } diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/StopIntake.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/InvertDrivetrain.java similarity index 77% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/StopIntake.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/InvertDrivetrain.java index ec6075c..8701825 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/StopIntake.java +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/InvertDrivetrain.java @@ -7,9 +7,9 @@ /** * */ -public class StopIntake extends InstantCommand { +public class InvertDrivetrain extends InstantCommand { - public StopIntake() { + public InvertDrivetrain() { // Use requires() here to declare subsystem dependencies // eg. requires(chassis); super(); @@ -18,6 +18,6 @@ public StopIntake() { // Called just before this Command runs the first time @Override protected void initialize() { - Robot.intakeEject.stopIntake(); + Robot.dt.reverseDT(); } } diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/LiftToPosition.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/LiftToPosition.java similarity index 85% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/LiftToPosition.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/LiftToPosition.java index 528a6d8..8056170 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/LiftToPosition.java +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/LiftToPosition.java @@ -24,8 +24,9 @@ public LiftToPosition(Lift lift, LiftHeight goal) { // Called just before this Command runs the first time @Override protected void initialize() { - lift.getPIDController().setPID(Robot.getConst("LiftkP", 0.1), Robot.getConst("LiftkI", 0), - Robot.getConst("LiftkD", 0), Robot.getConst("LiftkF", 0.1)); + // lift.getPIDController().setPID(Robot.getConst("LiftkP", 0.1), + // Robot.getConst("LiftkI", 0), + // Robot.getConst("LiftkD", 0), Robot.getConst("LiftkF", 0.1)); double setpoint = lift.getDesiredDistFromPos(pos); lift.setSetpoint(setpoint); System.out.println("Target Height: " + setpoint); @@ -46,6 +47,7 @@ protected boolean isFinished() { // Called once after isFinished returns true @Override protected void end() { + System.out.println("Reached lift targ: " + pos); } // Called when another command which requires one or more of the same diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/MoveLift.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/MoveLift.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/MoveLift.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/MoveLift.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/MoveLiftWithPID.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/MoveLiftWithPID.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/MoveLiftWithPID.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/MoveLiftWithPID.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/OpenIntake.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/OpenIntake.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/OpenIntake.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/OpenIntake.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/OuttakeCube.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/OuttakeCube.java similarity index 89% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/OuttakeCube.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/OuttakeCube.java index ffbdcc6..bb77c8f 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/OuttakeCube.java +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/OuttakeCube.java @@ -15,6 +15,7 @@ public class OuttakeCube extends Command { public OuttakeCube() { // Use requires() here to declare subsystem dependencies // eg. requires(chassis); + requires(Robot.intakeEject); } // Called just before this Command runs the first time @@ -28,7 +29,7 @@ protected void initialize() { // Called repeatedly when this Command is scheduled to run @Override protected void execute() { - Robot.intakeEject.runIntake(-1); + Robot.intakeEject.runIntake(1); } // Make this return true when this Command no longer needs to run execute() @@ -41,6 +42,8 @@ protected boolean isFinished() { @Override protected void end() { Robot.intakeEject.runIntake(0); + Robot.stopIntake = true; + System.out.println("Outtake done"); } // Called when another command which requires one or more of the same diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/PIDMove.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/PIDMove.java similarity index 98% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/PIDMove.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/PIDMove.java index b2897cb..5bf87a0 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/PIDMove.java +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/PIDMove.java @@ -23,6 +23,7 @@ public class PIDMove extends Command implements PIDOutput { private SmartDashboardInterface sd; private double[] point; private boolean absolute; + private boolean hasInitialized = false; /** * Constructs this command with a new PIDController. Sets all of the @@ -120,6 +121,7 @@ public PIDMove(double[] point, DrivetrainInterface dt, SmartDashboardInterface s */ @Override public void initialize() { + hasInitialized = true; if (absolute) { double dx = point[0] - AutoUtils.state.getX(); double dy = point[1] - AutoUtils.state.getY(); @@ -174,7 +176,7 @@ protected boolean isFinished() { @Override protected void end() { moveController.disable(); - System.out.println("End"); + System.out.println("PIDMove End"); // moveController.free(); double angle = Math.toRadians(AutoUtils.state.getRot()); @@ -212,6 +214,9 @@ protected void interrupted() { */ @Override public void pidWrite(double output) { + if (!hasInitialized) { + return; + } dt.arcadeDrive(output, 0); sd.putNumber("Move PID Output", output); } diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/PIDTurn.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/PIDTurn.java similarity index 95% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/PIDTurn.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/PIDTurn.java index 10b348c..2016480 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/PIDTurn.java +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/PIDTurn.java @@ -28,6 +28,9 @@ public class PIDTurn extends Command implements PIDOutput { private double[] point; private boolean turnToPoint; private boolean absoluteRotation; + private boolean hasInitialized = false; + + private double setpoint; /** * Constructs this command with a new PIDController. Sets all of the @@ -57,12 +60,12 @@ public class PIDTurn extends Command implements PIDOutput { public PIDTurn(double target, double[] point, DrivetrainInterface dt, SmartDashboardInterface sd, PIDSource ahrs, boolean absoluteRotation, boolean turnToPoint) { this.target = target; + System.out.println(this.target); this.point = point; this.dt = dt; this.ahrs = ahrs; this.sd = sd; this.turnToPoint = turnToPoint; - this.target = target; this.absoluteRotation = absoluteRotation; if (Robot.dt != null) { @@ -148,6 +151,7 @@ public PIDTurn(double[] point, DrivetrainInterface dt, SmartDashboardInterface s */ @Override protected void initialize() { + hasInitialized = true; // calculate pid constants // max turn speed from FindTurnTimeConstant, converted to degrees @@ -201,6 +205,8 @@ protected void initialize() { System.out.println("set point = " + newSetPoint); turnController.setSetpoint(newSetPoint); + setpoint = newSetPoint; + turnController.enable(); System.out.println("initialize finished"); // tim.start(); @@ -216,6 +222,7 @@ protected void initialize() { protected void execute() { System.out.println("execute"); System.out.println("Angle: " + dt.getAHRSAngle()); + System.out.println("Targ: " + setpoint); // if (tim.get() > lastTime + Robot.getConst("Update Time", 1)) { // SmartDashboard.putNumber("Angle", dt.getAHRSAngle()); // lastTime = tim.get(); @@ -231,8 +238,12 @@ protected void execute() { */ @Override protected boolean isFinished() { - System.out.println("isFinished"); - return (turnController.onTarget() && Math.abs(dt.getGyroRate()) < 1); + // System.out.println("isFinished"); + double gyroRate = Math.abs(dt.getGyroRate()); + System.out.println("Rate: " + gyroRate); + boolean done = turnController.onTarget(); + System.out.println("On targ: " + done); + return (done && gyroRate < 1); // return turnController.onTarget() // && Math.abs(dt.getLeftEncRate()) <= Robot.getConst("Maximum Velocity When // Stop", 1) @@ -248,7 +259,7 @@ protected boolean isFinished() { @Override protected void end() { turnController.disable(); - System.out.println("end"); + System.out.println("PIDTurn end"); sd.putNumber("Turn PID Result", turnController.get()); sd.putNumber("Turn PID Error", turnController.getError()); // turnController.free(); @@ -279,6 +290,9 @@ protected void interrupted() { */ @Override public void pidWrite(double output) { + if (!hasInitialized) { + return; + } dt.arcadeDrive(0, output); SmartDashboard.putNumber("Turn PID Output", output); } diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/README.md b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/README.md similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/README.md rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/README.md diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/ResetEncoders.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/ResetEncoders.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/ResetEncoders.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/ResetEncoders.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/RunScript.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/RunScript.java similarity index 89% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/RunScript.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/RunScript.java index e4946c4..ef36b8c 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/RunScript.java +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/RunScript.java @@ -21,6 +21,8 @@ public RunScript(String scriptName) { System.err.println("[ERROR] auto scripts file does not contain script `" + scriptName + "`."); return; } + + addParallel(new AutoLift(Robot.lift, "SWITCH")); outerloop: for (String[] cmd : script) { String cmdName = cmd[0]; @@ -44,10 +46,10 @@ public RunScript(String scriptName) { addSequential(new PIDMove(distance, Robot.dt, Robot.sd, Robot.dt.getDistEncAvg())); break; case "switch": - addSequential(new EjectToSwitch()); + addSequential(new EjectToSwitch(Double.parseDouble(cmdArgs))); break; case "scale": - addSequential(new EjectToScale()); + addSequential(new EjectToScale(Double.parseDouble(cmdArgs))); break; case "exchange": addSequential(new EjectToExchange()); @@ -56,7 +58,7 @@ public RunScript(String scriptName) { addSequential(new WaitCommand(Double.parseDouble(cmdArgs))); break; case "intake": - addSequential(new IntakeCube()); + addParallel(new IntakeCube()); break; case "jump": addSequential(new RunScript(cmdArgs)); diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/SetDistancePerPulse.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/SetDistancePerPulse.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/SetDistancePerPulse.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/SetDistancePerPulse.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/ShiftDriveType.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/ShiftDriveType.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/ShiftDriveType.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/ShiftDriveType.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/ShiftHighGear.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/ShiftHighGear.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/ShiftHighGear.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/ShiftHighGear.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/ShiftLowGear.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/ShiftLowGear.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/ShiftLowGear.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/ShiftLowGear.java diff --git a/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/StopIntake.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/StopIntake.java new file mode 100644 index 0000000..b613243 --- /dev/null +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/StopIntake.java @@ -0,0 +1,41 @@ +package org.usfirst.frc.team199.Robot2018.commands; + +import org.usfirst.frc.team199.Robot2018.Robot; + +import edu.wpi.first.wpilibj.Timer; +import edu.wpi.first.wpilibj.command.Command; + +/** + * + */ +public class StopIntake extends Command { + + private Timer tim; + + public StopIntake() { + // Use requires() here to declare subsystem dependencies + // eg. requires(chassis); + super(); + // requires(Robot.intakeEject); + } + + // Called just before this Command runs the first time + @Override + protected void initialize() { + Robot.stopIntake = true; + tim = new Timer(); + tim.reset(); + tim.start(); + } + + @Override + protected void execute() { + // Robot.intakeEject.stopIntake(); + } + + @Override + protected boolean isFinished() { + // TODO Auto-generated method stub + return tim.get() > 3; + } +} diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/TalonDrive.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/TalonDrive.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/TalonDrive.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/TalonDrive.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/TeleopDrive.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/TeleopDrive.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/TeleopDrive.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/TeleopDrive.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/TestAuto.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/TestAuto.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/TestAuto.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/TestAuto.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/TestAutoInterface.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/TestAutoInterface.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/TestAutoInterface.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/TestAutoInterface.java diff --git a/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/ToggleIntake.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/ToggleIntake.java new file mode 100644 index 0000000..f266c32 --- /dev/null +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/ToggleIntake.java @@ -0,0 +1,23 @@ +package org.usfirst.frc.team199.Robot2018.commands; + +import org.usfirst.frc.team199.Robot2018.Robot; + +import edu.wpi.first.wpilibj.command.InstantCommand; + +/** + * + */ +public class ToggleIntake extends InstantCommand { + + public ToggleIntake() { + // Use requires() here to declare subsystem dependencies + // eg. requires(chassis); + super(); + } + + // Called just before this Command runs the first time + @Override + protected void initialize() { + Robot.intakeEject.toggleIntake(); + } +} diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/ToggleLeftIntake.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/ToggleLeftIntake.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/ToggleLeftIntake.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/ToggleLeftIntake.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/ToggleRightIntake.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/ToggleRightIntake.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/ToggleRightIntake.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/ToggleRightIntake.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/UpdateLiftPosition.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/UpdateLiftPosition.java similarity index 53% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/UpdateLiftPosition.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/UpdateLiftPosition.java index c50ce59..f129911 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/UpdateLiftPosition.java +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/UpdateLiftPosition.java @@ -26,46 +26,48 @@ public UpdateLiftPosition(Lift lift) { // Called just before this Command runs the first time @Override protected void initialize() { - try { - Robot.oi.manipulator.getRawAxis(1); - } catch (NullPointerException e) { - System.err.println("[ERROR] Manipulator not plugged in."); - manipulatorPluggedIn = false; - } + // try { + // Robot.oi.manipulator.getRawAxis(1); + // } catch (NullPointerException e) { + // System.err.println("[ERROR] Manipulator not plugged in."); + // manipulatorPluggedIn = false; + // } goToGround = false; } // Called repeatedly when this Command is scheduled to run @Override protected void execute() { - if (manipulatorPluggedIn) { - int angle = Robot.oi.manipulator.getPOV(); + // if (manipulatorPluggedIn) { + int angle = Robot.oi.manipulator.getPOV(); - System.out.println("POV Reading: " + angle); + // System.out.println("POV Reading: " + angle); - if (angle == 180) { - desiredPos = LiftHeight.GROUND; - goToGround = true; - } else if (angle == 270) { - desiredPos = LiftHeight.HOLD_CUBE; - goToGround = false; - } else if (angle != -1) { - desiredPos = LiftHeight.SWITCH; - goToGround = false; - } + if (angle == 180) { + desiredPos = LiftHeight.HOLD_CUBE; + goToGround = true; + } else if (angle == 270) { + desiredPos = LiftHeight.HOLD_CUBE; + goToGround = false; + } else if (angle != -1) { + desiredPos = LiftHeight.SWITCH; + goToGround = false; + } - if (goToGround || angle != -1) { - desiredDist = lift.getDesiredDistFromPos(desiredPos); - lift.setSetpoint(desiredDist); - } + if (/* goToGround || */ angle != -1) { + desiredDist = lift.getDesiredDistFromPos(desiredPos); + lift.setSetpoint(desiredDist); + } - if (goToGround && lift.onTarget() && lift.getSpeed() <= 0.1) { - desiredPos = LiftHeight.GROUND; - desiredDist = lift.getDesiredDistFromPos(desiredPos); - lift.setSetpoint(desiredDist); - goToGround = false; - } + if (goToGround && lift.onTarget() && lift.getSpeed() <= 0.1) { + desiredPos = LiftHeight.GROUND; + desiredDist = lift.getDesiredDistFromPos(desiredPos); + lift.setSetpoint(desiredDist); + goToGround = false; } + // System.out.println("Desired Pos: " + desiredPos); + // System.out.println("Desired Dist: " + desiredDist); + // System.out.println("Current Dist: " + lift.getHeight()); } // Make this return true when this Command no longer needs to run execute() diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/UpdatePIDConstants.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/UpdatePIDConstants.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/UpdatePIDConstants.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/commands/UpdatePIDConstants.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/Climber.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/Climber.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/Climber.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/Climber.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/ClimberAssist.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/ClimberAssist.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/ClimberAssist.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/ClimberAssist.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/ClimberAssistInterface.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/ClimberAssistInterface.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/ClimberAssistInterface.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/ClimberAssistInterface.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/ClimberInterface.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/ClimberInterface.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/ClimberInterface.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/ClimberInterface.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/Drivetrain.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/Drivetrain.java similarity index 93% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/Drivetrain.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/Drivetrain.java index 6b6ba36..a745d32 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/Drivetrain.java +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/Drivetrain.java @@ -52,12 +52,21 @@ public class Drivetrain extends Subsystem implements DrivetrainInterface { private SmartDashboardInterface sd; private boolean highGear; + private boolean isInverted; + private int inverted; + /** + * Sets up velocity PID controllers. Initializes to not in high gear and to not + * inverted. + */ public Drivetrain(SmartDashboardInterface sd) { this.sd = sd; highGear = false; + isInverted = false; + inverted = 1; + // all 0s for controller construction because they all get set to right values // by resetAllVelocityPIDConsts leftVelocityController = new VelocityPIDController(0, 0, 0, 0, leftEncRate, dtLeft); @@ -85,11 +94,26 @@ public Drivetrain(SmartDashboardInterface sd) { } } + /** + * Inverts the drivetrain (forward is backward, left is right) by toggling a + * motor output multiplier (between 1 and -1) and the distance encoders (between + * inverted or not). The motor output multiplier is used in arcadeDrive and + * tankDrive for final speed/turn and left/right outputs. + */ + public void reverseDT() { + inverted *= -1; + isInverted = !isInverted; + leftEncDist.setReverseDirection(isInverted); + rightEncDist.setReverseDirection(isInverted); + SmartDashboard.putBoolean("DT is Inverted", isInverted); + } + @Override public void initDefaultCommand() { setDefaultCommand(new TeleopDrive()); } + @Override public boolean isVPIDUsed() { return Robot.getBool("Teleop velocity PID", false); } @@ -151,6 +175,7 @@ public boolean VPIDsOnTarg() { * * @return the rate of the left encoder */ + @Override public double getLeftEncRate() { return leftEncRate.getRate(); } @@ -160,6 +185,7 @@ public double getLeftEncRate() { * * @return the rate of the right encoder */ + @Override public double getRightEncRate() { return rightEncRate.getRate(); } @@ -210,6 +236,7 @@ public void teleopDrive() { if (Robot.getBool("Arcade Drive Default Setup", true)) { forw = -Robot.oi.leftJoy.getY(); turn = Robot.oi.rightJoy.getX(); + System.out.println("Forward is " + forw + " and turn is " + turn); Robot.dt.arcadeDrive(squareJoy ? Robot.oi.squareValueKeepSign(forw) : forw, squareJoy ? Robot.oi.squareValueKeepSign(turn) : turn); } else { @@ -259,7 +286,7 @@ public void arcadeDrive(double speed, double turn) { turn *= Robot.getConst("Turn Slow Ratio", 0.5); } } - robotDrive.arcadeDrive(speed, turn, Robot.getBool("Square Drive Values", false)); + robotDrive.arcadeDrive(inverted * speed, turn, Robot.getBool("Square Drive Values", false)); } /** @@ -272,11 +299,18 @@ public void arcadeDrive(double speed, double turn) { */ @Override public void tankDrive(double leftSpeed, double rightSpeed) { - if (Robot.oi.leftJoy.getRawButton(1) || Robot.oi.rightJoy.getRawButton(1)) { + if (Robot.oi.leftJoy.getRawButton(1)) { leftSpeed *= Robot.getConst("Speed Slow Ratio", 0.5); + } + if (Robot.oi.rightJoy.getRawButton(1)) { rightSpeed *= Robot.getConst("Speed Slow Ratio", 0.5); } - robotDrive.tankDrive(leftSpeed, rightSpeed, Robot.getBool("Square Drive Values", false)); + if (isInverted) { + double leftSpd = leftSpeed; + leftSpeed = rightSpeed; + rightSpeed = leftSpd; + } + robotDrive.tankDrive(inverted * leftSpeed, inverted * rightSpeed, Robot.getBool("Square Drive Values", false)); } /** @@ -331,6 +365,7 @@ public void resetAHRS() { fancyGyro.reset(); } + @Override public double getGyroRate() { return fancyGyro.getRate(); } @@ -432,6 +467,7 @@ public void shiftGearSolenoidOff() { /** * @return the gyroscope */ + @Override public PIDSource getGyro() { return fancyGyro; } @@ -530,6 +566,7 @@ public void putVelocityControllersToDashboard() { SmartDashboard.putData("Right PID Controller", rightVelocityController); } + @Override public double getPIDMoveConstant() { double G = Robot.rmap.getGearRatio(); double T = Robot.rmap.getStallTorque(); @@ -541,6 +578,7 @@ public double getPIDMoveConstant() { return Math.sqrt(Robot.rmap.convertMtoIn((8 * T * G) / (R * M))); } + @Override public double getPIDTurnConstant() { double G = Robot.rmap.getGearRatio(); double T = Robot.rmap.getStallTorque(); diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/DrivetrainInterface.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/DrivetrainInterface.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/DrivetrainInterface.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/DrivetrainInterface.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/IntakeEject.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/IntakeEject.java similarity index 90% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/IntakeEject.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/IntakeEject.java index 147c027..7c526db 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/IntakeEject.java +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/IntakeEject.java @@ -21,6 +21,7 @@ public class IntakeEject extends Subsystem implements IntakeEjectInterface { private final DoubleSolenoid rightSolenoid = RobotMap.rightIntakeSolenoid; private boolean leftOpen = isOpen(leftSolenoid.get()); private boolean rightOpen = isOpen(rightSolenoid.get()); + private boolean hasCube = false; /** * Return whether or not a side of the intake (L/R) is open @@ -38,6 +39,7 @@ public boolean isOpen(DoubleSolenoid.Value val) { */ @Override public void initDefaultCommand() { + // I don't want this on the manipulator joysticks during a match setDefaultCommand(new DefaultIntake()); } @@ -67,7 +69,7 @@ public boolean hasCube() { SmartDashboard.putNumber("Intake Current Left", Robot.rmap.getPort("PDP Intake Left Channel", 4)); SmartDashboard.putNumber("Intake Current Right", Robot.rmap.getPort("PDP Intake Left Channel", 11)); - return pdp.getCurrent(Robot.rmap.getPort("PDP Intake Left Channel", 4)) > Robot.getConst("Max Current", 39) + return pdp.getCurrent(Robot.rmap.getPort("PDP Intake Left Channel", 4)) > Robot.getConst("Max Current", 15) || pdp.getCurrent(Robot.rmap.getPort("PDP Intake Right Channel", 11)) > Robot.getConst("Max Current", 39); } @@ -118,6 +120,17 @@ public void runIntake(double speed) { runRightIntake(speed); } + /** + * Toggles the left and right intake between open (kReverse) and closed + * (kForward). + */ + public void toggleIntake() { + toggleLeftIntake(); + toggleRightIntake(); + SmartDashboard.putBoolean("Left Intake Open", leftOpen); + SmartDashboard.putBoolean("Right Intake Open", rightOpen); + } + /** * Toggles the left intake between open (kReverse) and closed (kForward). */ diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/IntakeEjectInterface.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/IntakeEjectInterface.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/IntakeEjectInterface.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/IntakeEjectInterface.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/Lift.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/Lift.java similarity index 99% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/Lift.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/Lift.java index 629f133..14593f4 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/Lift.java +++ b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/Lift.java @@ -61,7 +61,7 @@ public Lift() { WIGGLE_ROOM = (int) Robot.getConst("Lift wiggle room", 3.0); // inches // calculate constant measurements - GROUND_DIST = 0; + GROUND_DIST = 0.7; HOLD_CUBE_DIST = 4; // distance to switch 18.75 inches in starting position SWITCH_DIST = (18.75 + WIGGLE_ROOM) / NUM_STAGES; diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/LiftInterface.java b/Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/LiftInterface.java similarity index 100% rename from Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/LiftInterface.java rename to Robot2018/src/main/java/org/usfirst/frc/team199/Robot2018/subsystems/LiftInterface.java diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/EjectToSwitch.java b/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/EjectToSwitch.java deleted file mode 100644 index 79c7653..0000000 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/EjectToSwitch.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.usfirst.frc.team199.Robot2018.commands; - -import org.usfirst.frc.team199.Robot2018.Robot; - -import edu.wpi.first.wpilibj.command.CommandGroup; - -/** - * - */ -public class EjectToSwitch extends CommandGroup { - - public EjectToSwitch() { - addSequential(new AutoLift(Robot.lift, "SWITCH")); - addSequential( - new PIDMove(Robot.getConst("Auto Switch Move Dist", 12), Robot.dt, Robot.sd, Robot.dt.getDistEncAvg())); - addSequential(new OuttakeCube()); - addSequential(new PIDMove(-1 * Robot.getConst("Auto Switch Move Dist", 12), Robot.dt, Robot.sd, - Robot.dt.getDistEncAvg())); - addSequential(new AutoLift(Robot.lift, "GROUND")); - } -} diff --git a/Robot2018/vendordeps/Phoenix.json b/Robot2018/vendordeps/Phoenix.json new file mode 100644 index 0000000..a1654ec --- /dev/null +++ b/Robot2018/vendordeps/Phoenix.json @@ -0,0 +1,87 @@ +{ + "fileName": "Phoenix.json", + "name": "CTRE-Phoenix", + "version": "5.12.1", + "uuid": "ab676553-b602-441f-a38d-f1296eff6537", + "mavenUrls": [ + "http://devsite.ctr-electronics.com/maven/release/" + ], + "jsonUrl": "http://devsite.ctr-electronics.com/maven/release/com/ctre/phoenix/Phoenix-latest.json", + "javaDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "api-java", + "version": "5.12.1" + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "wpiapi-java", + "version": "5.12.1" + } + ], + "jniDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "cci", + "version": "5.12.1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64" + ] + } + ], + "cppDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "wpiapi-cpp", + "version": "5.12.1", + "libName": "CTRE_Phoenix_WPI", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "api-cpp", + "version": "5.12.1", + "libName": "CTRE_Phoenix", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "cci", + "version": "5.12.1", + "libName": "CTRE_PhoenixCCI", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "core", + "version": "5.12.1", + "libName": "CTRE_PhoenixCore", + "headerClassifier": "headers" + } + ] +} \ No newline at end of file diff --git a/Robot2018/vendordeps/navx_frc.json b/Robot2018/vendordeps/navx_frc.json new file mode 100644 index 0000000..80defba --- /dev/null +++ b/Robot2018/vendordeps/navx_frc.json @@ -0,0 +1,33 @@ +{ + "fileName": "navx_frc.json", + "name": "KauaiLabs_navX_FRC", + "version": "3.1.344", + "uuid": "cb311d09-36e9-4143-a032-55bb2b94443b", + "mavenUrls": [ + "https://repo1.maven.org/maven2/" + ], + "jsonUrl": "https://www.kauailabs.com/dist/frc/2019/navx_frc.json", + "javaDependencies": [ + { + "groupId": "com.kauailabs.navx.frc", + "artifactId": "navx-java", + "version": "3.1.344" + } + ], + "jniDependencies": [], + "cppDependencies": [ + { + "groupId": "com.kauailabs.navx.frc", + "artifactId": "navx-cpp", + "version": "3.1.344", + "headerClassifier": "headers", + "sourcesClassifier": "sources", + "sharedLibrary": false, + "libName": "navx_frc", + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena" + ] + } + ] +} \ No newline at end of file diff --git a/docs/controllers.txt b/docs/controllers.txt index 50ed1de..073aba4 100644 --- a/docs/controllers.txt +++ b/docs/controllers.txt @@ -34,10 +34,10 @@ 2 Z axis 2 manipulator buttons - 1 A close intake [CloseIntake] - 2 B open intake [OpenIntake] - 3 X raise intake [RaiseIntake] - 4 Y lower intake [LowerIntake] + 1 A lower intake [LowerIntake] + 2 B intake [ToggleIntake] + 3 X + 4 Y raise intake [RaiseIntake] 5 LB take in [IntakeCube] 6 RB take out [OuttakeCube] 7 back run lift motor up [RunLift]