diff --git a/.checkstyle b/.checkstyle
deleted file mode 100644
index ea955143..00000000
--- a/.checkstyle
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 4c5f320e..00000000
--- a/.gitignore
+++ /dev/null
@@ -1,44 +0,0 @@
-*.class
-
-# Mobile Tools for Java (J2ME)
-.mtj.tmp/
-
-# Package Files #
-./*.jar
-#*.war
-#*.ear
-
-# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
-hs_err_pid*
-
-# binary dir
-bin/
-build/
-dist/
-
-# git diff files
-*.orig
-
-# test logs
-derby.log
-/TeamDatabase
-/488Logs
-
-# dynamically generated properties files
-netconsole-host.properties
-WPI_Native_Libraries.properties
-
-# JetBrains
-.idea/
-/*.iml
-
-#Gradle
-.gradle/
-
-#Eclipse (build tools used by VS Code)
-.settings/
-.classpath
-.factorypath
-.project
-.apt_generated*
-*.dll
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
deleted file mode 100644
index 1ff6da79..00000000
--- a/.vscode/extensions.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "recommendations": [
- "ryanluker.vscode-coverage-gutters",
- "vscjava.vscode-java-test",
- "shengchen.vscode-checkstyle"
- ]
- }
\ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
deleted file mode 100644
index aace7433..00000000
--- a/.vscode/launch.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- // Use IntelliSense to learn about possible attributes.
- // Hover to view descriptions of existing attributes.
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
- "version": "0.2.0",
- "configurations": [
- {
- "type": "java",
- "name": "Debug (Launch)",
- "request": "launch",
- "cwd": "${workspaceFolder}",
- "console": "internalConsole",
- "stopOnEntry": false,
- "mainClass": "",
- "args": ""
- },
- {
- "type": "java",
- "name": "Debug (Launch)-PlanarTestVisualizer",
- "request": "launch",
- "cwd": "${workspaceFolder}",
- "console": "internalConsole",
- "stopOnEntry": false,
- "mainClass": "xbot.common.math.PlanarTestVisualizer",
- "args": "",
- "projectName": "SeriouslyCommonLib"
- },
- {
- "type": "java",
- "name": "Debug (Attach)",
- "request": "attach",
- "hostName": "localhost",
- "port": ""
- }
- ]
-}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
deleted file mode 100644
index c7fd0cb8..00000000
--- a/.vscode/settings.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "java.configuration.updateBuildConfiguration": "automatic",
- "java.test.defaultConfig": "SeriouslyCommonLib",
- "java.test.config": [
- {
- "name": "SeriouslyCommonLib",
- "workingDirectory": "${workspaceFolder}/build/jni/release",
- "vmargs": [ "-Djava.library.path=${workspaceFolder}/build/jni/release" ],
- "env": { "LD_LIBRARY_PATH": "${workspaceFolder}/build/jni/release" ,
- "DYLD_LIBRARY_PATH": "${workspaceFolder}/build/jni/release" }
- },
- ],
- "coverage-gutters.coverageReportFileName": "html/index.html",
- "coverage-gutters.coverageBaseDir": "build/reports/jacoco/test",
- "coverage-gutters.coverageFileNames": [
- "jacocoTestReport.xml"
- ],
- "java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m"
-}
diff --git a/.wpilib/wpilib_preferences.json b/.wpilib/wpilib_preferences.json
deleted file mode 100644
index 1d03e955..00000000
--- a/.wpilib/wpilib_preferences.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "enableCppIntellisense": false,
- "currentLanguage": "java",
- "projectYear": "2023",
- "teamNumber": 488
-}
\ No newline at end of file
diff --git a/488license.txt b/488license.txt
deleted file mode 100644
index 137febe7..00000000
--- a/488license.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-Copyright 2019 Team Xbot
-
-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.
-
-
-
-License for portions of this library (InterpolatingHistoryBuffer.java) are as follows :
-Copyright (C) 2017 FRC Team 1736 Robot Casserole - www.robotcasserole.org
-
-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/README.md b/README.md
deleted file mode 100644
index 71f36dfa..00000000
--- a/README.md
+++ /dev/null
@@ -1,41 +0,0 @@
-# Seriously Common Lib for FRC [![Build Status](https://dev.azure.com/Team488/Team%20488%20Builds/_apis/build/status/Team488.SeriouslyCommonLib?branchName=main)](https://dev.azure.com/Team488/Team%20488%20Builds/_build/latest?definitionId=1?branchName=main)
-
-## Up-Front Warning
-
-This repository is still very much a work in progress! There are chunks of code and build steps missing here that would probably block you from directly integrating this into your robot.
-
-It's getting more complete every week, but as it stands, we recommend that you use parts of this repository rather than the whole of it - taking individual classes, or using the design as inspiration, rather than seeing it as a stable platform for robot development.
-
-## What is it?
-
-Seriously Common Lib is a collection of common solutions to robot problems that FRC teams face while using WPILib and Java. It attempts to streamline basic functionality, provide the framework for more advanced programs, and promote clean and well-written code. It functions primarily as a wrapper around WPILib which allows the robot code to run separately from the robot-specific library and HAL, enabling unit tests that can be run on a PC or CI server.
-
-For new teams that are haven't done much advanced programming before, this library has all the core code that is needed to get a robot running with advanced functionality without having to write the core systems from scratch. For more advanced teams, the common lib gives you a solid foundation of all the basics to start building your robot code on top of. You don't need to use the pre-built drive system or any of the other parts of the library if you don't want to; it's all modular.
-
-## Who's working on it?
-SeriouslyCommonLib started as a separation of the commonly-written sections of code from FRC team 488 Xbot. We wanted to write re-usable code that could significantly decrease the time it took to get started in subsequent years. We had also been looking for a way to write unit tests for our robot code, which required us to write a fairly large amount of code that we didn't want to re-write each year. In doing so, we developed loads of useful utilities and wrappers and kept them separate from our season code so that we could publish it when we had the time.
-
-We plan to continue maintaining this codebase throughout upcoming years as we develop new functionality and find areas to fix and improve.
-
-## What does it do?
-### Main features
-- **Fully testable** We have wrappers for the robot-specific classes that WPILib provies. This means that every class can be run on a development PC, using mock implementations and factories. Your tests run all the same code that gets deployed to the robot.
-- **Persistent, configurable properties** We have utilities and extra interfaces which provide an easily-accessable property framework. When you use our classes to create a property, supplying a flag makes it automatically persist in a database on the robot as well as on the Smart Dashboard. Perfect for configuration and settings.
-- **Detailed logging** Every class logs with a specific message and error level when something important happens (using log4j). You can modify the logging priority threshold for the program as a whole or for specific classes, depending on the verbosity of the desired logging.
-- **Re-usable utilities** Our math utilities, logic helpers, and various number containers (such as the `XYPair`for vectors or points) contain loads of re-usable logic that's useful throughout a robot program.
-- **Robots never give up** It's always painful when your robot code crashes in a competition and you lose control of your robot. Although it's always best to write safe code, our scheduler wrapper keeps commands running even after an exception is thrown.
-- **Pre-written drive system** We have written a drive system implementation and included it in the commom lib to make it as easy as possible to get started writing code with minimal effort.
-- **Tilt detection** The common lib includes drive system helpers to attempt to counteract the acceleration of a tilting robot. If it's enabled and the robot starts to fall over, the tilt detection will kick in and attempt to right itself.
-- **Enhanced autonomous capabilities** We're working on the infrastructure required to allow you to write JavaScript code which executes as a WPILib command. This means that you can write small snippets of code that execute synchronously from their point of view while still allowing the scheduler and other robot functionality to run as normal.
-
-## How do I get started?
-
-If you want to jump in, a good place to start is our [robot template](https://github.com/Team488/FRCRobotTemplate). It includes all the configuration, build scripts, and boilerplate needed to start adding functionality. We hope to develop full documentation, but in the mean time, feel free to open issues on this repo to ask us questions and provide feedback.
-
-## How's development going?
-
-We are currently in the process of modifying this library to get it ready as a robot platform. We plan to build on top of it in upcoming seasons to add functionality and fix bugs. Currently, it should be fully functional for testing using the template project, but there isn't much documentation available. More to come soon!
-
-### We'd love some help!
-
-Although we do plan to maintain this library for use in our own robots, we'd love to recieve help with fixing bugs, adding new features, and finding issues that we need to look at. If your team uses the library, we'd love for you to open issues on GitHub as you find them. And if you're feeling adventurous, we welcome PRs too.
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
deleted file mode 100644
index 0d80c56d..00000000
--- a/azure-pipelines.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-# Gradle
-# Build your Java project and run tests with Gradle using a Gradle wrapper script.
-# Add steps that analyze code, save build artifacts, deploy, and more:
-# https://docs.microsoft.com/azure/devops/pipelines/languages/java
-
-jobs:
- - job: Windows_64_Bit
- pool:
- vmImage: 'windows-latest'
- steps:
- - task: JavaToolInstaller@0
- inputs:
- versionSpec: '11'
- jdkArchitectureOption: 'x64'
- jdkSourceOption: 'PreInstalled'
- - task: Gradle@2
- inputs:
- workingDirectory: ''
- gradleWrapperFile: 'gradlew'
- gradleOptions: '-Xmx3072m'
- publishJUnitResults: true
- testResultsFiles: '**/TEST-*.xml'
- tasks: 'build --stacktrace --info'
- # checkStyleRunAnalysis: true
- # pmdRunAnalysis: true
- - task: PublishCodeCoverageResults@1
- inputs:
- codeCoverageTool: 'JaCoCo'
- summaryFileLocation: 'build/reports/jacoco/test/jacocoTestReport.xml'
- reportDirectory: 'build/reports/jacoco/test/html'
diff --git a/build.gradle b/build.gradle
deleted file mode 100644
index 51b7a4a0..00000000
--- a/build.gradle
+++ /dev/null
@@ -1,136 +0,0 @@
-import edu.wpi.first.gradlerio.deploy.roborio.RoboRIO
-/*
- * This build file was auto generated by running the Gradle 'init' task
- * by 'John' at '1/7/18 10:12 PM' with Gradle 2.14.1
- *
- * This generated file contains a sample Java project to get you started.
- * For more details take a look at the Java Quickstart chapter in the Gradle
- * user guide available at https://docs.gradle.org/2.14.1/userguide/tutorial_java_projects.html
- */
-
-plugins {
- id "edu.wpi.first.GradleRIO" version "2023.4.2"
- id 'scala'
- id 'checkstyle'
- id 'jacoco'
-}
-
-sourceCompatibility = JavaVersion.VERSION_11
-targetCompatibility = JavaVersion.VERSION_11
-
-// In this section you declare where to find the dependencies of your project
-repositories {
- // Use 'mavenCentral' for resolving your dependencies.
- // You can declare any Maven/Ivy/file repository here.
- mavenCentral()
-
- maven { url "https://mvnrepository.com/artifact/com.google.dagger/dagger" }
- maven { url "https://mvnrepository.com/artifact/com.google.dagger/dagger-compiler" }
- maven { url "https://mvnrepository.com/artifact/org.zeromq/jeromq" }
-
- maven { url uri ("../SeriouslyCommonLib/lib/")}
-}
-
-configurations {
- nativeBundle
-}
-
-// In this section you declare the dependencies for your production and test code
-dependencies {
- implementation wpi.java.deps.wpilib()
- implementation wpi.java.vendor.java()
-
- nativeDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.desktop)
- nativeDebug wpi.java.vendor.jniDebug(wpi.platforms.desktop)
- simulationDebug wpi.sim.enableDebug()
-
- nativeRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.desktop)
- nativeRelease wpi.java.vendor.jniRelease(wpi.platforms.desktop)
- simulationRelease wpi.sim.enableRelease()
-
- testImplementation 'junit:junit:4.12'
-
- // The production code uses the SLF4J logging API at compile time
- implementation 'org.slf4j:slf4j-api:1.7.21'
-
- // In future, sync with WPILib, using junit 5
- implementation 'junit:junit:4.12'
-
- implementation 'com.google.dagger:dagger:2.44.2'
- annotationProcessor 'com.google.dagger:dagger-compiler:2.44.2'
- testAnnotationProcessor 'com.google.dagger:dagger-compiler:2.44.2'
-
- implementation group: 'log4j', name: 'log4j', version: '1.2.17'
-
- implementation group: 'org.json', name:'json', version: '20220924'
-
- implementation group: 'org.zeromq', name: 'jeromq', version: '0.5.3'
-
- implementation 'org.scala-lang:scala-library:2.11.12'
- testImplementation 'org.scalatest:scalatest_2.11:3.0.0'
-}
-
-sourceSets {
- main {
- resources {
- srcDirs = ["src/main/resources"]
- }
- }
-}
-
-task jarSources(type:Jar){
- from sourceSets.main.allSource
- classifier = 'source'
-}
-
-test {
- reports {
- junitXml.required = true
- }
-}
-
-// Configure string concat to always inline compile
-tasks.withType(JavaCompile) {
- options.compilerArgs.add '-XDstringConcat=inline'
-}
-
-tasks.withType(Test) {
- testLogging.showStandardStreams = true
-
- afterTest { desc, result ->
- logger.quiet "Executed test ${desc.name} [${desc.className}] with result: ${result.resultType}"
- }
-
- afterSuite { desc, result ->
- if (!desc.parent) { // will match the outermost suite
- println "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
- }
- }
-}
-
-checkstyle {
- toolVersion = '10.6.0'
- configFile = file('./xbotcheckstyle.xml')
-}
-
-task checkstyle(type: Checkstyle) {
- source 'src/main/java'
- configProperties.basedir = file('.')
-
- // Empty classpath
- classpath = files()
-}
-
-jacocoTestReport {
- dependsOn test
- reports {
- xml.required = true
- }
-}
-
-// always generate the coverage report after the tests run
-test.finalizedBy { jacocoTestReport }
-
-// Configure jar and deploy tasks
-wpi.java.configureExecutableTasks(jar)
-wpi.java.configureTestTasks(test)
\ No newline at end of file
diff --git a/checkstyle_suppressions.xml b/checkstyle_suppressions.xml
deleted file mode 100644
index 0f89c5ce..00000000
--- a/checkstyle_suppressions.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 7454180f..00000000
Binary files a/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index c23a1b31..00000000
--- a/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-distributionBase=GRADLE_USER_HOME
-distributionPath=permwrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=permwrapper/dists
diff --git a/gradlew b/gradlew
deleted file mode 100755
index c53aefaa..00000000
--- a/gradlew
+++ /dev/null
@@ -1,234 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright © 2015-2021 the original authors.
-#
-# 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
-#
-# https://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.
-#
-
-##############################################################################
-#
-# Gradle start up script for POSIX generated by Gradle.
-#
-# Important for running:
-#
-# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
-# noncompliant, but you have some other compliant shell such as ksh or
-# bash, then to run this script, type that shell name before the whole
-# command line, like:
-#
-# ksh Gradle
-#
-# Busybox and similar reduced shells will NOT work, because this script
-# requires all of these POSIX shell features:
-# * functions;
-# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
-# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
-# * compound commands having a testable exit status, especially «case»;
-# * various built-in commands including «command», «set», and «ulimit».
-#
-# Important for patching:
-#
-# (2) This script targets any POSIX shell, so it avoids extensions provided
-# by Bash, Ksh, etc; in particular arrays are avoided.
-#
-# The "traditional" practice of packing multiple parameters into a
-# space-separated string is a well documented source of bugs and security
-# problems, so this is (mostly) avoided, by progressively accumulating
-# options in "$@", and eventually passing that to Java.
-#
-# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
-# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
-# see the in-line comments for details.
-#
-# There are tweaks for specific operating systems such as AIX, CygWin,
-# Darwin, MinGW, and NonStop.
-#
-# (3) This script is generated from the Groovy template
-# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
-# within the Gradle project.
-#
-# You can find Gradle at https://github.com/gradle/gradle/.
-#
-##############################################################################
-
-# Attempt to set APP_HOME
-
-# Resolve links: $0 may be a link
-app_path=$0
-
-# Need this for daisy-chained symlinks.
-while
- APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
- [ -h "$app_path" ]
-do
- ls=$( ls -ld "$app_path" )
- link=${ls#*' -> '}
- case $link in #(
- /*) app_path=$link ;; #(
- *) app_path=$APP_HOME$link ;;
- esac
-done
-
-APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
-
-APP_NAME="Gradle"
-APP_BASE_NAME=${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" "-Xms64m"'
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD=maximum
-
-warn () {
- echo "$*"
-} >&2
-
-die () {
- echo
- echo "$*"
- echo
- exit 1
-} >&2
-
-# 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 ;; #(
- MSYS* | 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" && ! "$darwin" && ! "$nonstop" ; then
- case $MAX_FD in #(
- max*)
- MAX_FD=$( ulimit -H -n ) ||
- warn "Could not query maximum file descriptor limit"
- esac
- case $MAX_FD in #(
- '' | soft) :;; #(
- *)
- ulimit -n "$MAX_FD" ||
- warn "Could not set maximum file descriptor limit to $MAX_FD"
- esac
-fi
-
-# Collect all arguments for the java command, stacking in reverse order:
-# * args from the command line
-# * the main class name
-# * -classpath
-# * -D...appname settings
-# * --module-path (only if needed)
-# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
-
-# For Cygwin or MSYS, switch paths to Windows format before running java
-if "$cygwin" || "$msys" ; then
- APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
- CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
-
- JAVACMD=$( cygpath --unix "$JAVACMD" )
-
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- for arg do
- if
- case $arg in #(
- -*) false ;; # don't mess with options #(
- /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
- [ -e "$t" ] ;; #(
- *) false ;;
- esac
- then
- arg=$( cygpath --path --ignore --mixed "$arg" )
- fi
- # Roll the args list around exactly as many times as the number of
- # args, so each arg winds up back in the position where it started, but
- # possibly modified.
- #
- # NB: a `for` loop captures its iteration list before it begins, so
- # changing the positional parameters here affects neither the number of
- # iterations, nor the values presented in `arg`.
- shift # remove old arg
- set -- "$@" "$arg" # push replacement arg
- done
-fi
-
-# Collect all arguments for the java command;
-# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
-# shell script including quotes and variable substitutions, so put them in
-# double quotes to make sure that they get re-expanded; and
-# * put everything else in single quotes, so that it's not re-expanded.
-
-set -- \
- "-Dorg.gradle.appname=$APP_BASE_NAME" \
- -classpath "$CLASSPATH" \
- org.gradle.wrapper.GradleWrapperMain \
- "$@"
-
-# Use "xargs" to parse quoted args.
-#
-# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
-#
-# In Bash we could simply go:
-#
-# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
-# set -- "${ARGS[@]}" "$@"
-#
-# but POSIX shell has neither arrays nor command substitution, so instead we
-# post-process each arg (as a line of input to sed) to backslash-escape any
-# character that might be a shell metacharacter, then use eval to reverse
-# that process (while maintaining the separation between arguments), and wrap
-# the whole thing up as a single "set" statement.
-#
-# This will of course break if any of these variables contains a newline or
-# an unmatched quote.
-#
-
-eval "set -- $(
- printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
- xargs -n1 |
- sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
- tr '\n' ' '
- )" '"$@"'
-
-exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
deleted file mode 100644
index 107acd32..00000000
--- a/gradlew.bat
+++ /dev/null
@@ -1,89 +0,0 @@
-@rem
-@rem Copyright 2015 the original author or authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem You may obtain a copy of the License at
-@rem
-@rem https://www.apache.org/licenses/LICENSE-2.0
-@rem
-@rem Unless required by applicable law or agreed to in writing, software
-@rem distributed under the License is distributed on an "AS IS" BASIS,
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem See the License for the specific language governing permissions and
-@rem limitations under the License.
-@rem
-
-@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 Resolve any "." and ".." in APP_HOME to make it shorter.
-for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
-
-@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" "-Xms64m"
-
-@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 execute
-
-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 execute
-
-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
-
-: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 %*
-
-: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/lib/log4jConfig/log4j.xml b/lib/log4jConfig/log4j.xml
deleted file mode 100644
index 643aefb2..00000000
--- a/lib/log4jConfig/log4j.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/lib/log4jConfig/log4j4unitTesting.xml b/lib/log4jConfig/log4j4unitTesting.xml
deleted file mode 100644
index 768a4648..00000000
--- a/lib/log4jConfig/log4j4unitTesting.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
deleted file mode 100644
index 7bcf1c17..00000000
--- a/settings.gradle
+++ /dev/null
@@ -1,31 +0,0 @@
-import org.gradle.internal.os.OperatingSystem
-
-pluginManagement {
- repositories {
- mavenLocal()
- gradlePluginPortal()
- String frcYear = '2023'
- File frcHome
- if (OperatingSystem.current().isWindows()) {
- String publicFolder = System.getenv('PUBLIC')
- if (publicFolder == null) {
- publicFolder = "C:\\Users\\Public"
- }
- def homeRoot = new File(publicFolder, "wpilib")
- frcHome = new File(homeRoot, frcYear)
- } else {
- def userFolder = System.getProperty("user.home")
- def homeRoot = new File(userFolder, "wpilib")
- frcHome = new File(homeRoot, frcYear)
- }
- def frcHomeMaven = new File(frcHome, 'maven')
- maven {
- name 'frcHome'
- url frcHomeMaven
- }
- }
-}
-
-
-rootProject.name = 'SeriouslyCommonLib'
-
diff --git a/src/main/java/edu/wpi/first/wpilibj/MockAnalogInput.java b/src/main/java/edu/wpi/first/wpilibj/MockAnalogInput.java
deleted file mode 100644
index 17d8e891..00000000
--- a/src/main/java/edu/wpi/first/wpilibj/MockAnalogInput.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package edu.wpi.first.wpilibj;
-
-import org.json.JSONObject;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import xbot.common.controls.sensors.XAnalogInput;
-import xbot.common.injection.DevicePolice;
-import xbot.common.simulation.ISimulatableSensor;
-
-public class MockAnalogInput extends XAnalogInput implements ISimulatableSensor {
- int channel;
- double voltage;
-
- @AssistedFactory
- public abstract static class MockAnalogInputFactory implements XAnalogInputFactory {
- public abstract MockAnalogInput create(@Assisted("channel") int channel);
- }
-
- @AssistedInject
- public MockAnalogInput(@Assisted("channel") int channel, DevicePolice police) {
- super(channel, police);
- this.channel = channel;
- }
-
- public void setVoltage(double voltage) {
- this.voltage = voltage;
- }
-
- public double getVoltage() {
- return voltage;
- }
-
- public double getAverageVoltage() {
- return voltage;
- }
-
- public void setAverageBits(int bits) {
- // Nothing to do here.
- }
-
- @Override
- public int getChannel() {
- return channel;
- }
-
- @Override
- public boolean getAsDigital(double threshold) {
- return getVoltage() >= threshold;
- }
-
- @Override
- public void ingestSimulationData(JSONObject payload) {
- setVoltage(payload.getDouble("Voltage"));
- }
-}
diff --git a/src/main/java/edu/wpi/first/wpilibj/MockCompressor.java b/src/main/java/edu/wpi/first/wpilibj/MockCompressor.java
deleted file mode 100644
index 9235c21c..00000000
--- a/src/main/java/edu/wpi/first/wpilibj/MockCompressor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package edu.wpi.first.wpilibj;
-
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import xbot.common.controls.actuators.XCompressor;
-
-public class MockCompressor extends XCompressor {
-
- private boolean isEnabled = true;
-
- @AssistedFactory
- public abstract static class MockCompressorFactory implements XCompressorFactory {
- public abstract MockCompressor create();
- }
-
- @AssistedInject
- public MockCompressor() {
-
- }
-
- @Override
- public void disable() {
- isEnabled = false;
- }
-
- @Override
- public void enable() {
- isEnabled = true;
- }
-
- @Override
- public boolean isEnabled() {
- return isEnabled;
- }
-}
diff --git a/src/main/java/edu/wpi/first/wpilibj/MockDigitalInput.java b/src/main/java/edu/wpi/first/wpilibj/MockDigitalInput.java
deleted file mode 100644
index 7b55173b..00000000
--- a/src/main/java/edu/wpi/first/wpilibj/MockDigitalInput.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package edu.wpi.first.wpilibj;
-
-import org.json.JSONObject;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import xbot.common.controls.sensors.XDigitalInput;
-import xbot.common.injection.DevicePolice;
-import xbot.common.simulation.ISimulatableSensor;
-
-public class MockDigitalInput extends XDigitalInput implements ISimulatableSensor {
-
- protected boolean value;
- final int channel;
-
- @AssistedFactory
- public abstract static class MockDigitalInputFactory implements XDigitalInputFactory
- {
- public abstract MockDigitalInput create(@Assisted("channel") int channel);
- }
-
- @AssistedInject
- public MockDigitalInput(@Assisted("channel") int channel, DevicePolice police) {
- super(police, channel);
- this.channel = channel;
- }
-
- public void setValue(boolean value) {
- this.value = value ^ getInverted();
- }
-
- @Override
- public void setInverted(boolean inverted) {
- super.setInverted(inverted);
- value = !value;
- }
-
- public boolean getRaw() {
- return value;
- }
-
- public int getChannel() {
- return this.channel;
- }
-
- @Override
- public void ingestSimulationData(JSONObject payload) {
- setValue(payload.getBoolean("Triggered"));
- }
-}
diff --git a/src/main/java/edu/wpi/first/wpilibj/MockDigitalOutput.java b/src/main/java/edu/wpi/first/wpilibj/MockDigitalOutput.java
deleted file mode 100644
index 150e8d39..00000000
--- a/src/main/java/edu/wpi/first/wpilibj/MockDigitalOutput.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package edu.wpi.first.wpilibj;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import xbot.common.controls.actuators.XDigitalOutput;
-import xbot.common.injection.DevicePolice;
-
-public class MockDigitalOutput extends XDigitalOutput {
- protected int channel;
- protected boolean value;
-
- @AssistedFactory
- public abstract static class MockDigitalOutputFactory implements XDigitalOutputFactory {
- public abstract MockDigitalOutput create(@Assisted("channel") int channel);
- }
-
- @AssistedInject
- public MockDigitalOutput(@Assisted("channel") int channel, DevicePolice police) {
- super(channel, police);
- }
-
- @Override
- public void set(boolean value) {
- this.value = value;
- }
-
- @Override
- public void setPWMRate(double frequency) {
- // Unsupported in mock implementation.
- }
-
- @Override
- public void enablePWM(double initialDutyCycle) {
- // Unsupported in mock implementation.
- }
-
- @Override
- public void updateDutyCycle(double dutyCycle) {
- // Unsupported in mock implementation.
- }
-
- @Override
- public void disablePWM() {
- // Unsupported in mock implementation.
- }
-
- @Override
- public boolean get() {
- return value;
- }
-}
diff --git a/src/main/java/edu/wpi/first/wpilibj/MockDistanceSensor.java b/src/main/java/edu/wpi/first/wpilibj/MockDistanceSensor.java
deleted file mode 100644
index 996079b2..00000000
--- a/src/main/java/edu/wpi/first/wpilibj/MockDistanceSensor.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package edu.wpi.first.wpilibj;
-
-import xbot.common.controls.sensors.DistanceSensor;
-
-public class MockDistanceSensor implements DistanceSensor {
-
- double distance;
-
- public MockDistanceSensor() {
- }
-
- public double getDistance() {
- return distance;
- }
-
- public void setDistance(double distance) {
- this.distance = distance;
- }
-
- public void incrementDistance(double delta) {
- this.distance += delta;
- }
-
- @Override
- public void setAveraging(boolean shouldAverage) {
- // Nothing to do in mock implementation
- }
-
-}
diff --git a/src/main/java/edu/wpi/first/wpilibj/MockDistanceSensorPair.java b/src/main/java/edu/wpi/first/wpilibj/MockDistanceSensorPair.java
deleted file mode 100644
index 523b268e..00000000
--- a/src/main/java/edu/wpi/first/wpilibj/MockDistanceSensorPair.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package edu.wpi.first.wpilibj;
-
-import javax.inject.Inject;
-
-import xbot.common.controls.sensors.DistanceSensor;
-import xbot.common.controls.sensors.DistanceSensorPair;
-
-public class MockDistanceSensorPair implements DistanceSensorPair {
-
- private DistanceSensor sensorA;
- private DistanceSensor sensorB;
-
- @Inject
- public MockDistanceSensorPair() {
- sensorA = new MockDistanceSensor();
- sensorB = new MockDistanceSensor();
- }
-
- @Override
- public DistanceSensor getSensorA() {
- return sensorA;
- }
-
- @Override
- public DistanceSensor getSensorB() {
- return sensorB;
- }
-
- @Override
- public void update() {
- // Intentionally left blank
- }
-}
diff --git a/src/main/java/edu/wpi/first/wpilibj/MockLidarLite.java b/src/main/java/edu/wpi/first/wpilibj/MockLidarLite.java
deleted file mode 100644
index 1b1c6845..00000000
--- a/src/main/java/edu/wpi/first/wpilibj/MockLidarLite.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package edu.wpi.first.wpilibj;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import edu.wpi.first.wpilibj.I2C.Port;
-import xbot.common.controls.sensors.XLidarLite;
-import xbot.common.injection.DevicePolice;
-import xbot.common.properties.PropertyFactory;
-
-public class MockLidarLite extends XLidarLite {
-
- @AssistedFactory
- public abstract static class MockLidarLiteFactory implements XLidarLiteFactory {
- public abstract MockLidarLite create(@Assisted("port") Port port, @Assisted("prefix") String prefix);
- }
-
- @AssistedInject
- public MockLidarLite(@Assisted("port") Port port, PropertyFactory propMan, DevicePolice police, @Assisted("prefix") String prefix) {
- super(port, propMan, police, prefix);
- }
-
- @Override
- protected void update() {
- // no-op, but still need to delay to prevent high speed loop
- try {
- Thread.sleep(5);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- public void setTestDistance(int testDistance) {
- byte[] fakeDistance = new byte[2];
- fakeDistance[0] = (byte)(testDistance >> 8);
- fakeDistance[1] = (byte)(testDistance % 256);
- }
-
-}
diff --git a/src/main/java/edu/wpi/first/wpilibj/MockPWM.java b/src/main/java/edu/wpi/first/wpilibj/MockPWM.java
deleted file mode 100644
index 80b4812b..00000000
--- a/src/main/java/edu/wpi/first/wpilibj/MockPWM.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package edu.wpi.first.wpilibj;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import xbot.common.controls.actuators.XPWM;
-import xbot.common.injection.DevicePolice;
-
-public class MockPWM extends XPWM {
- protected int channel;
- protected double value;
-
- @AssistedFactory
- public abstract static class MockPWMFactory implements XPWMFactory {
- public abstract MockPWM create(@Assisted("channel") int channel);
- }
-
- @AssistedInject
- public MockPWM(@Assisted("channel") int channel, DevicePolice police) {
- super(channel, police);
- }
-
- @Override
- public void setRaw(int value) {
- this.value = value / 255d;
- }
-
- @Override
- public int getRaw() {
- return (int)(value * 255);
- }
-
- @Override
- public void setSigned(double value) {
- this.value = value;
- }
-
- @Override
- public double getSigned() {
- return value;
- }
-
- @Override
- public void setUnsigned(double value) {
- this.value = value;
- }
-
- @Override
- public double getUnsigned() {
- return value;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/edu/wpi/first/wpilibj/MockPowerDistributionPanel.java b/src/main/java/edu/wpi/first/wpilibj/MockPowerDistributionPanel.java
deleted file mode 100644
index 39c233d9..00000000
--- a/src/main/java/edu/wpi/first/wpilibj/MockPowerDistributionPanel.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package edu.wpi.first.wpilibj;
-
-import java.util.HashMap;
-
-import org.apache.log4j.Logger;
-
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import xbot.common.controls.sensors.XPowerDistributionPanel;
-
-public class MockPowerDistributionPanel extends XPowerDistributionPanel {
- private HashMap outputCurrents;
-
- private static Logger log = Logger.getLogger(MockPowerDistributionPanel.class);
-
- @AssistedFactory
- public abstract static class MockPowerDistributionPanelFactory implements XPowerDistributionPanelFactory {
- @Override
- public abstract MockPowerDistributionPanel create();
- }
-
- @AssistedInject
- public MockPowerDistributionPanel() {
- log.info("Creating PDP");
- outputCurrents = new HashMap<>();
- }
-
- public void setCurrent(int channel, double current) {
- outputCurrents.put(channel, current);
- }
-
- @Override
- public double getCurrent(int channel) {
- return outputCurrents.getOrDefault(channel, 0d);
- }
-}
diff --git a/src/main/java/edu/wpi/first/wpilibj/MockServo.java b/src/main/java/edu/wpi/first/wpilibj/MockServo.java
deleted file mode 100644
index 9bf45ead..00000000
--- a/src/main/java/edu/wpi/first/wpilibj/MockServo.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package edu.wpi.first.wpilibj;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import xbot.common.controls.actuators.XServo;
-import xbot.common.injection.DevicePolice;
-
-public class MockServo extends XServo {
-
- protected double value;
-
- @AssistedFactory
- public abstract static class MockServoFactory implements XServoFactory {
- public abstract MockServo create(@Assisted("channel") int channel);
- }
-
- @AssistedInject
- public MockServo(@Assisted("channel") int channel, DevicePolice police) {
- super(channel, police);
- }
-
- @Override
- public void set(double value) {
- this.value = value;
- }
-
- public double getValue(){
- return value;
- }
-}
diff --git a/src/main/java/edu/wpi/first/wpilibj/MockSolenoid.java b/src/main/java/edu/wpi/first/wpilibj/MockSolenoid.java
deleted file mode 100644
index 43d6d513..00000000
--- a/src/main/java/edu/wpi/first/wpilibj/MockSolenoid.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package edu.wpi.first.wpilibj;
-
-import org.json.JSONObject;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import xbot.common.controls.actuators.XSolenoid;
-import xbot.common.injection.DevicePolice;
-import xbot.common.simulation.ISimulatableSolenoid;
-
-public class MockSolenoid extends XSolenoid implements ISimulatableSolenoid {
- final int channel;
- protected boolean on;
-
- @AssistedFactory
- public abstract static class MockSolenoidFactory implements XSolenoidFactory {
- public abstract MockSolenoid create(@Assisted("channel") int channel);
- }
-
- @AssistedInject
- public MockSolenoid(@Assisted("channel") int channel, DevicePolice police) {
- super(channel, police);
- this.channel = channel;
- }
-
- @Override
- public void set(boolean on) {
- this.on = on;
- }
-
- public boolean get() {
- return on;
- }
-
- @Override
- public int getMaxSupportedChannel() {
- return 15;
- }
-
- @Override
- public JSONObject getSimulationData() {
- return buildMotorObject(channel, get());
- }
-}
diff --git a/src/main/java/edu/wpi/first/wpilibj/MockSpeedController.java b/src/main/java/edu/wpi/first/wpilibj/MockSpeedController.java
deleted file mode 100644
index e0f0fc29..00000000
--- a/src/main/java/edu/wpi/first/wpilibj/MockSpeedController.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package edu.wpi.first.wpilibj;
-
-import org.apache.log4j.Logger;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import xbot.common.controls.actuators.XSpeedController;
-import xbot.common.injection.DevicePolice;
-
-public class MockSpeedController extends XSpeedController {
-
- private static Logger log = Logger.getLogger(MockSpeedController.class);
- protected double value;
-
- @AssistedFactory
- public abstract static class MockSpeedControllerFactory implements XSpeedControllerFactory {
- public abstract MockSpeedController create(@Assisted("channel") int channel);
- }
-
- @AssistedInject
- public MockSpeedController(@Assisted("channel") int channel, DevicePolice police) {
- super(channel, police);
- log.info("Creating speed controller on channel:" + channel);
- }
-
- @Override
- public double get() {
- return value;
- }
-
- @Override
- public void set(double output) {
- value = output;
- }
-}
diff --git a/src/main/java/edu/wpi/first/wpilibj/MockTimer.java b/src/main/java/edu/wpi/first/wpilibj/MockTimer.java
deleted file mode 100644
index 0630c6f1..00000000
--- a/src/main/java/edu/wpi/first/wpilibj/MockTimer.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package edu.wpi.first.wpilibj;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import xbot.common.controls.sensors.XSettableTimerImpl;
-
-@Singleton
-public class MockTimer implements XSettableTimerImpl {
-
- @Inject
- public MockTimer() {}
-
- double timeInSeconds;
-
- @Override
- public void setTimeInSeconds(double time) {
- timeInSeconds = time;
- }
-
- @Override
- public void advanceTimeInSecondsBy(double time) {
- timeInSeconds += time;
- }
-
- /**
- * Return the system clock time in seconds. Return the time from the FPGA hardware clock in seconds since the FPGA
- * started.
- *
- * @return Robot running time in seconds.
- */
- @Override
- public double getFPGATimestamp() {
- return timeInSeconds;
- }
-
- @Override
- public double getMatchTime() {
- return timeInSeconds;
- }
-
- @Override
- public void delay(double seconds) {
-
- }
-}
\ No newline at end of file
diff --git a/src/main/java/edu/wpi/first/wpilibj/MockXboxControllerAdapter.java b/src/main/java/edu/wpi/first/wpilibj/MockXboxControllerAdapter.java
deleted file mode 100644
index 6b16740d..00000000
--- a/src/main/java/edu/wpi/first/wpilibj/MockXboxControllerAdapter.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package edu.wpi.first.wpilibj;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-import xbot.common.controls.sensors.XXboxController;
-import xbot.common.controls.sensors.buttons.AdvancedJoystickButtonTrigger.AdvancedJoystickButtonTriggerFactory;
-import xbot.common.controls.sensors.buttons.AdvancedPovButtonTrigger.AdvancedPovButtonTriggerFactory;
-import xbot.common.controls.sensors.buttons.AnalogHIDButtonTrigger.AnalogHIDButtonTriggerFactory;
-import xbot.common.injection.DevicePolice;
-import xbot.common.logging.RobotAssertionManager;
-import xbot.common.math.XYPair;
-import xbot.common.subsystems.feedback.XRumbleManager;
-import xbot.common.subsystems.feedback.XRumbleManager.XRumbleManagerFactory;
-
-public class MockXboxControllerAdapter extends XXboxController {
-
- private XYPair leftStick;
- private XYPair rightStick;
-
- private double leftTrigger;
- private double rightTrigger;
-
- private final XRumbleManager rumbleManager;
-
- @AssistedFactory
- public abstract static class MockXboxControllerFactory implements XXboxControllerFactory {
- public abstract MockXboxControllerAdapter create(@Assisted("port") int port);
- }
-
- @AssistedInject
- public MockXboxControllerAdapter(@Assisted("port") int port,
- AdvancedJoystickButtonTriggerFactory joystickButtonFactory,
- AdvancedPovButtonTriggerFactory povButtonFactory,
- AnalogHIDButtonTriggerFactory analogHidButtonFactory, XRumbleManagerFactory rumbleManagerFactory,
- RobotAssertionManager manager, DevicePolice police) {
- super(port, joystickButtonFactory, povButtonFactory, analogHidButtonFactory, rumbleManagerFactory, manager,
- police);
- leftStick = new XYPair();
- rightStick = new XYPair();
- this.rumbleManager = rumbleManagerFactory.create(this);
- }
-
- public void setLeftStick(double x, double y) {
- leftStick.x = x * (leftXInversion ? -1 : 1);
- leftStick.y = y * (leftYInversion ? -1 : 1);
- }
-
- public void setLeftStick(XYPair xy) {
- setLeftStick(xy.x, xy.y);
- }
-
- public void setRightStick(double x, double y) {
- rightStick.x = x * (rightXInversion ? -1 : 1);
- rightStick.y = y * (rightYInversion ? -1 : 1);
- }
-
- public void setRightStick(XYPair xy) {
- setRightStick(xy.x, xy.y);
- }
-
- /**
- * Needed for a few scenarios where we want to emulate the underlying joystick
- * behavior
- * and not the intent after inversion.
- *
- * @param xy XYPair to directly set. (Remember that by default, most joysticks
- * have an inverted Y axis!)
- */
- public void setRawLeftStick(XYPair xy) {
- leftStick.x = xy.x;
- leftStick.y = xy.y;
- }
-
- /**
- * Needed for a few scenarios where we want to emulate the underlying joystick
- * behavior
- * and not the intent after inversion.
- *
- * @param xy XYPair to directly set. (Remember that by default, most joysticks
- * have an inverted Y axis!)
- */
- public void setRawRightStick(XYPair xy) {
- rightStick.x = xy.x;
- rightStick.y = xy.y;
- }
-
- public void setLeftTrigger(double left) {
- leftTrigger = left;
- }
-
- public void setRightTrigger(double right) {
- rightTrigger = right;
- }
-
- @Override
- public boolean getButton(int button) {
- return false;
- }
-
- @Override
- public double getRawAxis(int axis) {
- return 0;
- }
-
- @Override
- public int getPOV() {
- return 0;
- }
-
- @Override
- public GenericHID getGenericHID() {
- // We don't have the HID.
- return null;
- }
-
- @Override
- public XRumbleManager getRumbleManager() {
- return this.rumbleManager;
- }
-
- @Override
- protected double getLeftRawTriggerAxis() {
- return leftTrigger;
- }
-
- @Override
- protected double getRightRawTriggerAxis() {
- return rightTrigger;
- }
-
- @Override
- protected double getLeftRawX() {
- return leftStick.x;
- }
-
- @Override
- protected double getLeftRawY() {
- return leftStick.y;
- }
-
- @Override
- protected double getRightRawX() {
- return rightStick.x;
- }
-
- @Override
- protected double getRightRawY() {
- return rightStick.y;
- }
-
-}
diff --git a/src/main/java/xbot/common/command/BaseCommand.java b/src/main/java/xbot/common/command/BaseCommand.java
deleted file mode 100644
index 0fc26f63..00000000
--- a/src/main/java/xbot/common/command/BaseCommand.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package xbot.common.command;
-
-import javax.inject.Inject;
-
-import org.apache.log4j.Logger;
-
-import edu.wpi.first.wpilibj2.command.CommandBase;
-import xbot.common.logging.TimeLogger;
-import xbot.common.properties.IPropertySupport;
-
-/**
- * Enhanced version of WPILib's Command that allows for extension of existing
- * functionality.
- */
-public abstract class BaseCommand extends CommandBase implements IPropertySupport {
-
- protected Logger log;
- protected TimeLogger monitor;
- private boolean configurableRunWhenDisabled;
-
- @Inject
- SmartDashboardCommandPutter commandPutter;
-
- public BaseCommand() {
- log = Logger.getLogger(this.getName());
- monitor = new TimeLogger(this.getName(), 20);
- }
-
- @Override
- public boolean runsWhenDisabled() {
- return configurableRunWhenDisabled;
- }
-
- public void setRunsWhenDisabled(boolean value) {
- configurableRunWhenDisabled = value;
- }
-
- public String getPrefix() {
- return this.getName() + "/";
- }
-
- @Override
- public abstract void initialize();
-
- @Override
- public abstract void execute();
-
- public void includeOnSmartDashboard() {
- if (commandPutter != null) {
- commandPutter.addCommandToSmartDashboard(this);
- }
- }
-
- public void includeOnSmartDashboard(String label) {
- if (commandPutter != null) {
- commandPutter.addCommandToSmartDashboard(label, this);
- }
- }
-
- /**
- * @deprecated
- * Suggest use {@link #addRequirements(edu.wpi.first.wpilibj2.command.Subsystem...)} instead.
- * @param subsystem Requirement to add
- */
- @Deprecated
- public void requires(BaseSubsystem subsystem) {
- this.addRequirements(subsystem);
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/command/BaseMaintainerCommand.java b/src/main/java/xbot/common/command/BaseMaintainerCommand.java
deleted file mode 100644
index b2e0dedc..00000000
--- a/src/main/java/xbot/common/command/BaseMaintainerCommand.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package xbot.common.command;
-
-import edu.wpi.first.wpilibj.DriverStation;
-import xbot.common.logic.HumanVsMachineDecider;
-import xbot.common.logic.HumanVsMachineDecider.HumanVsMachineDeciderFactory;
-import xbot.common.logic.HumanVsMachineDecider.HumanVsMachineMode;
-import xbot.common.logic.TimeStableValidator;
-import xbot.common.properties.BooleanProperty;
-import xbot.common.properties.DoubleProperty;
-import xbot.common.properties.Property;
-import xbot.common.properties.PropertyFactory;
-import xbot.common.properties.StringProperty;
-
-public abstract class BaseMaintainerCommand extends BaseCommand {
-
- BaseSetpointSubsystem subsystemToMaintan;
-
- protected final BooleanProperty errorWithinToleranceProp;
- protected final DoubleProperty errorToleranceProp;
- protected final BooleanProperty errorIsTimeStableProp;
- protected final DoubleProperty errorTimeStableWindowProp;
- protected final BooleanProperty subsystemReportsReadyProp;
-
- protected final TimeStableValidator timeStableValidator;
- protected final HumanVsMachineDecider decider;
-
- private final StringProperty currentModeProp;
-
- public BaseMaintainerCommand(BaseSetpointSubsystem subsystemToMaintain, PropertyFactory pf,
- HumanVsMachineDeciderFactory humanVsMachineDeciderFactory,
- double defaultErrorTolerance, double defaultTimeStableWindow) {
- this.subsystemToMaintan = subsystemToMaintain;
- this.addRequirements(subsystemToMaintain);
-
- pf.setPrefix(this);
- errorToleranceProp = pf.createPersistentProperty("Error Tolerance", defaultErrorTolerance);
- errorTimeStableWindowProp = pf.createPersistentProperty("Error Time Stable Window", defaultTimeStableWindow);
-
- pf.setDefaultLevel(Property.PropertyLevel.Debug);
- errorWithinToleranceProp = pf.createEphemeralProperty("Error Within Tolerance", false);
- errorIsTimeStableProp = pf.createEphemeralProperty("Error Is Time Stable", false);
- currentModeProp = pf.createEphemeralProperty("Current Mode", "Not Yet Run");
- subsystemReportsReadyProp = pf.createEphemeralProperty("Subsystem Ready", false);
-
- timeStableValidator = new TimeStableValidator(() -> errorTimeStableWindowProp.get());
- decider = humanVsMachineDeciderFactory.create(this.getPrefix());
- }
-
- protected void resetDecider(boolean startInAutomaticMode) {
- decider.reset(startInAutomaticMode);
- }
-
- @Override
- public void execute() {
- maintain();
- subsystemToMaintan.setMaintainerIsAtGoal(isMaintainerAtGoal());
- }
-
- /**
- * Contains all the logic associated with keeping the subsystem
- * at its goal.
- */
- protected void maintain() {
- double humanInput = getHumanInputMagnitude();
- HumanVsMachineMode mode = decider.getRecommendedMode(humanInput);
- currentModeProp.set(mode.toString());
-
- switch (mode) {
- case Coast:
- coastAction();
- break;
- case HumanControl:
- humanControlAction();
- break;
- case InitializeMachineControl:
- initializeMachineControlAction();
- break;
- case MachineControl:
- if (subsystemToMaintan.isCalibrated()) {
- calibratedMachineControlAction();
- } else {
- uncalibratedMachineControlAction();
- }
- break;
- default:
- // How did you get here?!?!
- break;
- }
- }
-
- // Typically do nothing.
- protected abstract void coastAction();
-
- protected void humanControlAction() {
- // Typically simply assign human input
- subsystemToMaintan.setPower(getHumanInput());
- }
-
- protected void initializeMachineControlAction() {
- // When we re-initialize machine control, we need to briefly "take" the setpoint
- // lock. In practice,
- // we can't require and then un-require a subsystem, so instead we just cancel
- // any running command that
- // is trying to maniuplate the setpoint.
- if (subsystemToMaintan.getSetpointLock().getCurrentCommand() != null && !DriverStation.isAutonomous()) {
- subsystemToMaintan.getSetpointLock().getCurrentCommand().cancel();
- }
-
- // Typically set the goal to the current position, to avoid sudden extreme
- // changes
- // as soon as Coast is complete.
- subsystemToMaintan.setTargetValue(subsystemToMaintan.getCurrentValue());
- }
-
- protected abstract void calibratedMachineControlAction();
-
- protected void uncalibratedMachineControlAction() {
- // Typically default to human control, although this is a good candidate
- // for being overwritten by an auto-calibrating feature.
- humanControlAction();
- }
-
- protected boolean isMaintainerAtGoal() {
- // Are we near our goal?
- boolean withinErrorTolerance = getErrorWithinTolerance();
- // Check for any other conditions other than total error.
- boolean totalAtGoal = additionalAtGoalChecks() && withinErrorTolerance;
-
- boolean isStable = timeStableValidator.checkStable(totalAtGoal);
- // Let everybody know
- errorWithinToleranceProp.set(withinErrorTolerance);
- errorIsTimeStableProp.set(isStable);
- subsystemReportsReadyProp.set(subsystemToMaintan.isMaintainerAtGoal());
- return isStable;
- }
-
- /**
- * Maintainer systems already check for error tolerance and time stability. If
- * there
- * are any other checks that should be made, override this method and place them
- * here.
- *
- * @return true by default, can be overridden by child classes.
- */
- protected boolean additionalAtGoalChecks() {
- return true;
- }
-
- /**
- * Performs a simple difference between goal and target in order to see if we
- * are close.
- * if your subsystem needs to do something more complicated (for example, if you
- * needed to
- * compute difference via a ContiguousDouble) then override this method with a
- * better
- * computation.
- */
- protected boolean getErrorWithinTolerance() {
- if (Math.abs(getErrorMagnitude()) < errorToleranceProp
- .get()) {
- return true;
- }
- return false;
- }
-
- protected abstract double getErrorMagnitude();
-
- protected abstract T getHumanInput();
-
- protected abstract double getHumanInputMagnitude();
-
- @Override
- public String getPrefix() {
- return subsystemToMaintan.getPrefix() + getName() + "/";
- }
-
- protected void setErrorTolerance(double tolerance) {
- errorToleranceProp.set(tolerance);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/command/BaseRobot.java b/src/main/java/xbot/common/command/BaseRobot.java
deleted file mode 100644
index fa805f9a..00000000
--- a/src/main/java/xbot/common/command/BaseRobot.java
+++ /dev/null
@@ -1,328 +0,0 @@
-package xbot.common.command;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.xml.DOMConfigurator;
-import org.json.JSONObject;
-
-import edu.wpi.first.wpilibj.DriverStation;
-import edu.wpi.first.wpilibj.RobotController;
-import edu.wpi.first.wpilibj.TimedRobot;
-import edu.wpi.first.wpilibj.livewindow.LiveWindow;
-import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
-import edu.wpi.first.wpilibj2.command.Command;
-import edu.wpi.first.wpilibj2.command.CommandScheduler;
-import xbot.common.controls.sensors.XTimer;
-import xbot.common.controls.sensors.XTimerImpl;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.components.BaseComponent;
-import xbot.common.logging.RobotSession;
-import xbot.common.logging.TimeLogger;
-import xbot.common.logic.Latch;
-import xbot.common.logic.Latch.EdgeType;
-import xbot.common.properties.DoubleProperty;
-import xbot.common.properties.PropertyFactory;
-import xbot.common.properties.XPropertyManager;
-import xbot.common.simulation.ISimulatableMotor;
-import xbot.common.simulation.ISimulatableSolenoid;
-import xbot.common.simulation.SimulationPayloadDistributor;
-import xbot.common.simulation.WebotsClient;
-import xbot.common.subsystems.autonomous.AutonomousCommandSelector;
-
-/**
- * Core Robot class which configures logging, properties,
- * scheduling, and the injector. Required for a fair amount
- * of CommonLib functionality.
- */
-public abstract class BaseRobot extends TimedRobot {
-
- Logger log;
- Latch brownoutLatch;
-
- protected XPropertyManager propertyManager;
- protected XScheduler xScheduler;
-
- // Other than initially creating required systems, you should never use the injector again
- private BaseComponent injectorComponent;
-
- protected Command autonomousCommand;
- protected AutonomousCommandSelector autonomousCommandSelector;
-
- protected DoubleProperty batteryVoltage;
- protected DoubleProperty frequencyReportInterval;
- protected double lastFreqCounterResetTime = -1;
- protected int loopCycleCounter = 0;
-
- protected WebotsClient webots;
- protected DevicePolice devicePolice;
- protected SimulationPayloadDistributor simulationPayloadDistributor;
-
- TimeLogger schedulerMonitor;
- TimeLogger outsidePeriodicMonitor;
-
- protected RobotSession robotSession;
-
- public BaseRobot() {
- // The IterativeRobot uses the period below to trigger some timeouts. We find these to be more annoying
- // than helpful, so we set the period (typically 0.02) to something dramatically larger (10 seconds).
- super(10);
- // However, we want to make sure that we actually do call the loopFunc quickly and periodically at
- // 50hz, so we make this call to addPeriodic.
- addPeriodic(super::loopFunc, 0.02);
- brownoutLatch = new Latch(false, EdgeType.Both, edge -> {
- if(edge == EdgeType.RisingEdge) {
- log.warn("Entering brownout");
- }
- else if(edge == EdgeType.FallingEdge) {
- log.info("Leaving brownout");
- }
- });
-
- }
-
- @Override
- protected void loopFunc() {
- // Do nothing. This is part of some shenanigans to avoid loop overrun notifications.
- }
-
- @Override
- public double getPeriod() {
- // In case anything was depending on reading the period, we use the typical 50hz value.
- return 0.02;
- }
-
- /**
- * Override if you need a different module
- */
- protected void setupInjectionModule() {
- injectorComponent = createDaggerComponent();
- }
-
- /**
- * Returns the {@link BaseComponent} instance used for dependency injection
- */
- protected abstract BaseComponent createDaggerComponent();
-
- /**
- * Get the dependency injection component
- * @return an implementation of BaseComponent that will be used throughout the robot.
- */
- protected BaseComponent getInjectorComponent() {
- return injectorComponent;
- }
-
- /**
- * This function is run when the robot is first started up and should be used for any initialization code.
- */
- public void robotInit() {
-
- // Get our logging config
- try {
- if(BaseRobot.isReal()) {
- DOMConfigurator.configure("/home/lvuser/deploy/log4j.xml");
- } else {
- DOMConfigurator.configure("SeriouslyCommonLib/lib/log4jConfig/log4j4unitTesting.xml");
- }
- } catch (Exception e) {
- // Had a problem loading the config. Robot should continue!
- final String errorString = "Couldn't configure logging - file probably missing or malformed";
- System.out.println(errorString);
- DriverStation.reportError(errorString, false);
- }
-
- log = Logger.getLogger(BaseRobot.class);
- log.info("========== BASE ROBOT INITIALIZING ==========");
- setupInjectionModule();
- log.info("========== INJECTOR CREATED ==========");
- this.initializeSystems();
- log.info("========== SYSTEMS INITIALIZED ==========");
- SmartDashboard.putData(CommandScheduler.getInstance());
-
- if (this.isReal()) {
- // We're just so tired of seeing these in logs. We may re-enable this at competition time.
- DriverStation.silenceJoystickConnectionWarning(true);
- }
- PropertyFactory pf = injectorComponent.propertyFactory();
- pf.setTopLevelPrefix();
- frequencyReportInterval = pf.createPersistentProperty("Robot loop frequency report interval", 20);
- batteryVoltage = pf.createEphemeralProperty("Battery Voltage", 0);
- schedulerMonitor = new TimeLogger("XScheduler", (int)frequencyReportInterval.get());
- outsidePeriodicMonitor = new TimeLogger("OutsidePeriodic", 20);
- robotSession = injectorComponent.robotSession();
- devicePolice = injectorComponent.devicePolice();
- simulationPayloadDistributor = injectorComponent.simulationPayloadDistributor();
- LiveWindow.disableAllTelemetry();
- }
-
- protected String getEnableTypeString() {
- if (!DriverStation.isEnabled()) {
- return "disabled";
- }
-
- if (DriverStation.isAutonomous()) {
- return "auto";
- }
-
- if (DriverStation.isTeleop()) {
- return "teleop";
- }
-
- if (DriverStation.isTest()) {
- return "test";
- }
-
- return "enabled/unknown";
- }
-
- protected void updateLoggingContext() {
- String dsStatus = DriverStation.isDSAttached() ? "DS" : "no DS";
- String fmsStatus = DriverStation.isFMSAttached() ? "FMS" : "no FMS";
- String matchStatus = DriverStation.getMatchType().toString() + " " + DriverStation.getMatchNumber() + " " + DriverStation.getReplayNumber();
- String enableStatus = getEnableTypeString();
- String matchContext = dsStatus + ", " + fmsStatus + ", " + enableStatus + ", " + matchStatus;
- org.apache.log4j.MDC.put("matchContext", matchContext);
- }
-
- protected void initializeSystems() {
- updateLoggingContext();
- // override with additional systems (but call this one too)
- XTimerImpl timerimpl = injectorComponent.timerImplementation();
- XTimer.setImplementation(timerimpl);
-
- // Get the property manager and get all properties from the robot disk
- propertyManager = injectorComponent.propertyManager();
- xScheduler = injectorComponent.scheduler();
- // All this does is set the timeout period for the scheduler - the actual loop still runs at 50hz.
- CommandScheduler.getInstance().setPeriod(0.05);
- autonomousCommandSelector = injectorComponent.autonomousCommandSelector();
- }
-
- @Override
- public void disabledInit() {
- updateLoggingContext();
- log.info("Disabled init (" + getMatchContextString() + ")");
- propertyManager.saveOutAllProperties();
- }
-
- public void disabledPeriodic() {
- this.sharedPeriodic();
- }
-
- protected String getMatchContextString() {
- return DriverStation.getAlliance().toString() + DriverStation.getLocation() + ", "
- + DriverStation.getMatchTime() + "s, "
- + (DriverStation.isDSAttached() ? "DS connected" : "DS disconnected") + ", "
- + (DriverStation.isFMSAttached() ? "FMS connected" : "FMS disconnected") + ", "
- + "Is disabled: " + DriverStation.isDisabled() + ", "
- + "Is enabled: " + DriverStation.isEnabled() + ", "
- + "Is auto: " + DriverStation.isAutonomous() + ", "
- + "Is teleop: " + DriverStation.isTeleop() + ", "
- + "Is test: " + DriverStation.isTest() + ", "
- + "Is browned out: " + RobotController.isBrownedOut() + ", "
- + "Is output enabled: " + RobotController.isSysActive() + ", "
- + "Battery voltage: " + RobotController.getBatteryVoltage();
- }
-
- public void autonomousInit() {
- robotSession.autoInit();
- updateLoggingContext();
- log.info("Autonomous init (" + getMatchContextString() + ")");
- this.autonomousCommand = this.autonomousCommandSelector.getCurrentAutonomousCommand();
- if(this.autonomousCommand != null) {
- log.info("Starting autonomous command: " + this.autonomousCommand);
- this.autonomousCommand.schedule();
- } else {
- log.warn("No autonomous command set.");
- }
- }
-
- /**
- * This function is called periodically during autonomous
- */
- public void autonomousPeriodic() {
- this.sharedPeriodic();
- }
-
- public void teleopInit() {
- robotSession.teleopInit();
- updateLoggingContext();
- log.info("Teleop init (" + getMatchContextString() + ")");
- if(this.autonomousCommand != null) {
- log.info("Cancelling autonomousCommand.");
- this.autonomousCommand.cancel();
- }
- }
-
- /**
- * This function is called periodically during operator control
- */
- public void teleopPeriodic() {
- this.sharedPeriodic();
- }
-
- /**
- * This function is called periodically during test mode
- */
- public void testPeriodic() {
- }
-
- protected void sharedPeriodic() {
- outsidePeriodicMonitor.stop();
- schedulerMonitor.start();
- xScheduler.run();
- schedulerMonitor.stop();
-
- batteryVoltage.set(RobotController.getBatteryVoltage());
-
- brownoutLatch.setValue(RobotController.isBrownedOut());
-
- loopCycleCounter++;
- double timeSinceLastLog = XTimer.getFPGATimestamp() - lastFreqCounterResetTime;
- if(lastFreqCounterResetTime <= 0) {
- lastFreqCounterResetTime = XTimer.getFPGATimestamp();
- }
- else if(timeSinceLastLog >= frequencyReportInterval.get()) {
- double loopsPerSecond = loopCycleCounter / timeSinceLastLog;
-
- loopCycleCounter = 0;
- lastFreqCounterResetTime = XTimer.getFPGATimestamp();
-
- log.info("Robot loops per second: " + loopsPerSecond);
- }
-
- outsidePeriodicMonitor.start();
- }
-
-
- @Override
- public void simulationInit() {
- /*
- webots = injectorComponent.webotsClient();
- webots.initialize();
-
- */
- }
-
- @Override
- public void simulationPeriodic() {
- /*
- // find all simulatable motors
- List motors = new ArrayList();
-
- for (String deviceId: devicePolice.registeredChannels.keySet()) {
- Object device = devicePolice.registeredChannels.get(deviceId);
- if (device instanceof ISimulatableMotor) {
- motors.add(((ISimulatableMotor)device).getSimulationData());
- }
- if (device instanceof ISimulatableSolenoid) {
- motors.add(((ISimulatableSolenoid)device).getSimulationData());
- }
- }
- JSONObject response = webots.sendMotors(motors);
-
- simulationPayloadDistributor.distributeSimulationPayload(response);
- */
- }
-}
diff --git a/src/main/java/xbot/common/command/BaseSetpointCommand.java b/src/main/java/xbot/common/command/BaseSetpointCommand.java
deleted file mode 100644
index 19e11c8f..00000000
--- a/src/main/java/xbot/common/command/BaseSetpointCommand.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package xbot.common.command;
-
-public abstract class BaseSetpointCommand extends BaseCommand {
-
- public BaseSetpointCommand(SupportsSetpointLock... systems) {
- for (SupportsSetpointLock system : systems) {
- this.addRequirements(system.getSetpointLock());
- }
- }
-
- @Override
- public boolean isFinished() {
- return false;
- }
-}
diff --git a/src/main/java/xbot/common/command/BaseSetpointSubsystem.java b/src/main/java/xbot/common/command/BaseSetpointSubsystem.java
deleted file mode 100644
index ddb1c36b..00000000
--- a/src/main/java/xbot/common/command/BaseSetpointSubsystem.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package xbot.common.command;
-
-import edu.wpi.first.wpilibj2.command.Subsystem;
-import xbot.common.controls.sensors.XTimer;
-
-public abstract class BaseSetpointSubsystem extends BaseSubsystem implements SupportsSetpointLock {
-
- private Subsystem setpointLock;
- private double lastUpdateTimeFromMaintainer;
- protected boolean atGoal;
-
- public BaseSetpointSubsystem() {
- setpointLock = new Subsystem() {};
- }
-
- @Override
- public Subsystem getSetpointLock() {
- return setpointLock;
- }
-
- public boolean isMaintainerAtGoal() {
- // If we haven't heard from the maintainer within the last 0.5 seconds,
- // then assume the system is not ready.
- double gap = XTimer.getFPGATimestamp() - lastUpdateTimeFromMaintainer;
- return atGoal && Math.abs(gap) < 0.5;
- }
-
- public void setMaintainerIsAtGoal(boolean atGoal) {
- lastUpdateTimeFromMaintainer = XTimer.getFPGATimestamp();
- this.atGoal = atGoal;
- }
-
- public abstract T getCurrentValue();
-
- public abstract T getTargetValue();
-
- public abstract void setTargetValue(T value);
-
- public abstract void setPower(T power);
-
- public abstract boolean isCalibrated();
-}
diff --git a/src/main/java/xbot/common/command/BaseSubsystem.java b/src/main/java/xbot/common/command/BaseSubsystem.java
deleted file mode 100644
index f1c5979d..00000000
--- a/src/main/java/xbot/common/command/BaseSubsystem.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package xbot.common.command;
-
-import org.apache.log4j.Logger;
-
-import edu.wpi.first.wpilibj2.command.SubsystemBase;
-import xbot.common.properties.IPropertySupport;
-
-public abstract class BaseSubsystem extends SubsystemBase implements IPropertySupport {
-
- protected Logger log;
-
- public BaseSubsystem() {
- log = Logger.getLogger(this.getName());
- }
-
- public String getPrefix() {
- return this.getName() + "/";
- }
-}
diff --git a/src/main/java/xbot/common/command/BaseWaitForMaintainerCommand.java b/src/main/java/xbot/common/command/BaseWaitForMaintainerCommand.java
deleted file mode 100644
index f3e98fe6..00000000
--- a/src/main/java/xbot/common/command/BaseWaitForMaintainerCommand.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package xbot.common.command;
-
-import xbot.common.controls.sensors.XTimer;
-import xbot.common.properties.DoubleProperty;
-import xbot.common.properties.PropertyFactory;
-
-/**
- * Command that waits for a setpoint subsystem to reach its goal
- */
-public abstract class BaseWaitForMaintainerCommand extends BaseCommand {
-
- private final BaseSetpointSubsystem system;
- private final DoubleProperty timeoutProperty;
-
- private double startTime;
-
- public BaseWaitForMaintainerCommand(BaseSetpointSubsystem system, PropertyFactory pf, double defaultTimeout) {
- this.system = system;
-
- pf.setPrefix(this);
- this.timeoutProperty = pf.createPersistentProperty("Timeout Seconds", defaultTimeout);
- }
-
- @Override
- public void initialize() {
- this.startTime = XTimer.getFPGATimestamp();
- }
-
- @Override
- public void execute() {
- // this command doesn't do anything in the execute phase
- }
-
- @Override
- public boolean isFinished() {
- return (this.system.isMaintainerAtGoal() || isTimeoutExpired());
- }
-
- private boolean isTimeoutExpired() {
- return XTimer.getFPGATimestamp() > this.startTime + this.timeoutProperty.get();
- }
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/command/DelayViaSupplierCommand.java b/src/main/java/xbot/common/command/DelayViaSupplierCommand.java
deleted file mode 100644
index 8c862c1c..00000000
--- a/src/main/java/xbot/common/command/DelayViaSupplierCommand.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package xbot.common.command;
-
-import java.util.function.Supplier;
-
-import xbot.common.controls.sensors.XTimer;
-
-public class DelayViaSupplierCommand extends BaseCommand {
-
- protected double startTime;
- protected Supplier delaySupplier;
-
- public DelayViaSupplierCommand(Supplier delaySupplier) {
- this.delaySupplier = delaySupplier;
- }
-
- @Override
- public void initialize() {
- this.startTime = XTimer.getFPGATimestamp();
- log.info("Initializing with intial time: " + startTime + " and waiting for " + delaySupplier.get() + " seconds");
- }
-
- @Override
- public void execute() {
- // Do nothing
- }
-
- @Override
- public boolean isFinished() {
- return isTimeoutExpired();
- }
-
- private boolean isTimeoutExpired() {
- return XTimer.getFPGATimestamp() > startTime + delaySupplier.get();
- }
-}
diff --git a/src/main/java/xbot/common/command/MockSmartDashboardCommandPutter.java b/src/main/java/xbot/common/command/MockSmartDashboardCommandPutter.java
deleted file mode 100644
index 5fda03e4..00000000
--- a/src/main/java/xbot/common/command/MockSmartDashboardCommandPutter.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package xbot.common.command;
-
-import javax.inject.Inject;
-
-public class MockSmartDashboardCommandPutter implements SmartDashboardCommandPutter {
-
- @Inject
- public MockSmartDashboardCommandPutter() {}
-
- @Override
- public void addCommandToSmartDashboard(BaseCommand command) {
- // intentionally left blank as the SmartDashboard isn't available off the robot right now
-
- }
-
- @Override
- public void addCommandToSmartDashboard(String label, BaseCommand command) {
- // intentionally left blank as the SmartDashboard isn't available off the robot right now
-
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/command/NamedInstantCommand.java b/src/main/java/xbot/common/command/NamedInstantCommand.java
deleted file mode 100644
index 6383c08d..00000000
--- a/src/main/java/xbot/common/command/NamedInstantCommand.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package xbot.common.command;
-
-import edu.wpi.first.wpilibj2.command.InstantCommand;
-import edu.wpi.first.wpilibj2.command.Subsystem;
-
-/**
- * Convenience wrapper of InstantCommand that allows setting a human readable name for
- * smartdashboard/logging readability.
- */
-public class NamedInstantCommand extends InstantCommand {
- public NamedInstantCommand(String name, Runnable toRun, Subsystem... requirements) {
- super(toRun, requirements);
- this.setName(name);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/command/NamedRunCommand.java b/src/main/java/xbot/common/command/NamedRunCommand.java
deleted file mode 100644
index cc1042f3..00000000
--- a/src/main/java/xbot/common/command/NamedRunCommand.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package xbot.common.command;
-
-import org.apache.log4j.Logger;
-
-import edu.wpi.first.wpilibj2.command.RunCommand;
-import edu.wpi.first.wpilibj2.command.Subsystem;
-
-public class NamedRunCommand extends RunCommand {
- protected Logger log;
-
- public NamedRunCommand(String name, Runnable toRun, Subsystem... requirements) {
- super(toRun, requirements);
- this.setName(name);
- log = Logger.getLogger(this.getName());
- }
-
- @Override
- public void initialize() {
- super.initialize();
- log.info("Initializing");
- }
-}
diff --git a/src/main/java/xbot/common/command/RealSmartDashboardCommandPutter.java b/src/main/java/xbot/common/command/RealSmartDashboardCommandPutter.java
deleted file mode 100644
index f55e9c2e..00000000
--- a/src/main/java/xbot/common/command/RealSmartDashboardCommandPutter.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package xbot.common.command;
-
-import javax.inject.Inject;
-
-//import edu.wpi.first.wpilibj2.command.Command;
-import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
-
-public class RealSmartDashboardCommandPutter implements SmartDashboardCommandPutter {
-
- @Inject
- public RealSmartDashboardCommandPutter() {}
-
- @Override
- public void addCommandToSmartDashboard(BaseCommand command) {
- SmartDashboard.putData(command);
- }
-
- @Override
- public void addCommandToSmartDashboard(String label, BaseCommand command) {
- SmartDashboard.putData(label, command);
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/command/SimpleWaitForMaintainerCommand.java b/src/main/java/xbot/common/command/SimpleWaitForMaintainerCommand.java
deleted file mode 100644
index 8209f513..00000000
--- a/src/main/java/xbot/common/command/SimpleWaitForMaintainerCommand.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package xbot.common.command;
-
-import java.util.function.Supplier;
-
-import xbot.common.controls.sensors.XTimer;
-
-public class SimpleWaitForMaintainerCommand extends BaseCommand {
-
- private final BaseSetpointSubsystem subsystem;
- private double startTime;
- private Supplier delaySupplier;
-
- public SimpleWaitForMaintainerCommand(BaseSetpointSubsystem subsystem, Supplier delaySupplier) {
- this.subsystem = subsystem;
- this.delaySupplier = delaySupplier;
- }
-
- @Override
- public void initialize() {
- this.startTime = XTimer.getFPGATimestamp();
- }
-
- @Override
- public void execute() {
- // Do nothing
- }
-
- @Override
- public boolean isFinished() {
- return isTimeoutExpired() || subsystem.isMaintainerAtGoal();
- }
-
- private boolean isTimeoutExpired() {
- return XTimer.getFPGATimestamp() > startTime + delaySupplier.get();
- }
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/command/SmartDashboardCommandPutter.java b/src/main/java/xbot/common/command/SmartDashboardCommandPutter.java
deleted file mode 100644
index af222a11..00000000
--- a/src/main/java/xbot/common/command/SmartDashboardCommandPutter.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package xbot.common.command;
-
-public interface SmartDashboardCommandPutter {
- public void addCommandToSmartDashboard(BaseCommand command);
- public void addCommandToSmartDashboard(String label, BaseCommand command);
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/command/SupportsSetpointLock.java b/src/main/java/xbot/common/command/SupportsSetpointLock.java
deleted file mode 100644
index db0d8cfd..00000000
--- a/src/main/java/xbot/common/command/SupportsSetpointLock.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package xbot.common.command;
-
-import edu.wpi.first.wpilibj2.command.Subsystem;
-
-public interface SupportsSetpointLock {
-
- public Subsystem getSetpointLock();
-}
diff --git a/src/main/java/xbot/common/command/XScheduler.java b/src/main/java/xbot/common/command/XScheduler.java
deleted file mode 100644
index e5eefb2b..00000000
--- a/src/main/java/xbot/common/command/XScheduler.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package xbot.common.command;
-
-import java.util.Arrays;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.apache.log4j.Logger;
-
-import edu.wpi.first.wpilibj2.command.Command;
-import edu.wpi.first.wpilibj2.command.CommandScheduler;
-import edu.wpi.first.wpilibj2.command.Subsystem;
-
-/**
- * Wrapper for base Scheduler which intelligently manages exceptions.
- */
-@Singleton
-public class XScheduler {
-
- private static Logger log = Logger.getLogger(XScheduler.class);
-
- boolean crashedPreviously = false;
-
- int numberOfCrashes = 0;
-
- CommandScheduler scheduler;
-
- @Inject
- public XScheduler() {
- this.scheduler = CommandScheduler.getInstance();
- }
-
- public int getNumberOfCrashes()
- {
- return numberOfCrashes;
- }
-
- public void run() {
- try {
- scheduler.run();
- crashedPreviously = false;
- } catch(Throwable t) {
- log.error(String.format(
- "Unhandled exception in Scheduler %s at %s",
- t.toString(),
- Arrays.toString(t.getStackTrace())));
- if(crashedPreviously) {
- log.error("Due to repeated exceptions, clearing Scheduler queue completely");
- scheduler.cancelAll();
- }
- crashedPreviously = true;
- numberOfCrashes++;
- }
- }
-
- public void removeAll() {
- scheduler.cancelAll();
- }
-
- public void registerSubsystem(Subsystem... subsystems) {
- scheduler.registerSubsystem(subsystems);
- }
-
- public void setDefaultCommand(Subsystem subsystem, Command defaultCommand) {
- scheduler.setDefaultCommand(subsystem, defaultCommand);
- }
-}
diff --git a/src/main/java/xbot/common/controls/XBaseIO.java b/src/main/java/xbot/common/controls/XBaseIO.java
deleted file mode 100644
index a4f27e73..00000000
--- a/src/main/java/xbot/common/controls/XBaseIO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package xbot.common.controls;
-
-public interface XBaseIO {
- public int getChannel();
-}
diff --git a/src/main/java/xbot/common/controls/actuators/XCANSparkMax.java b/src/main/java/xbot/common/controls/actuators/XCANSparkMax.java
deleted file mode 100644
index 2ff3099b..00000000
--- a/src/main/java/xbot/common/controls/actuators/XCANSparkMax.java
+++ /dev/null
@@ -1,742 +0,0 @@
-package xbot.common.controls.actuators;
-
-import com.revrobotics.CANSparkMax;
-import com.revrobotics.CANSparkMax.ControlType;
-import com.revrobotics.CANSparkMax.ExternalFollower;
-import com.revrobotics.CANSparkMax.FaultID;
-import com.revrobotics.CANSparkMax.IdleMode;
-import com.revrobotics.CANSparkMax.SoftLimitDirection;
-import com.revrobotics.REVLibError;
-import com.revrobotics.SparkMaxPIDController.ArbFFUnits;
-
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.DevicePolice.DeviceType;
-import xbot.common.injection.electrical_contract.DeviceInfo;
-import xbot.common.properties.DoubleProperty;
-import xbot.common.properties.Property;
-import xbot.common.properties.PropertyFactory;
-
-public abstract class XCANSparkMax {
-
- protected int deviceId;
- protected String prefix = "";
- PropertyFactory propertyFactory;
- protected boolean usesPropertySystem = true;
-
- DoubleProperty kPprop;
- DoubleProperty kIprop;
- DoubleProperty kDprop;
- DoubleProperty kIzProp;
- DoubleProperty kFFprop;
- DoubleProperty kMaxOutputProp;
- DoubleProperty kMinOutoutProp;
-
- DoubleProperty percentProp;
- DoubleProperty voltageProp;
- DoubleProperty currentProp;
-
- protected final String policeTicket;
-
- protected boolean firstPeriodicCall = true;
-
- public abstract static class XCANSparkMaxFactory {
- public abstract XCANSparkMax create(
- DeviceInfo deviceInfo,
- String owningSystemPrefix,
- String name,
- XCANSparkMaxPIDProperties defaultPIDProperties);
-
- public XCANSparkMax create(DeviceInfo deviceInfo, String owningSystemPrefix, String name) {
- return create(deviceInfo, owningSystemPrefix, name, new XCANSparkMaxPIDProperties());
- }
-
- public XCANSparkMax createWithoutProperties(DeviceInfo deviceInfo, String owningSystemPrefix, String name) {
- return create(deviceInfo, owningSystemPrefix, name, null);
- }
- }
-
- protected XCANSparkMax(
- DeviceInfo deviceInfo,
- String owningSystemPrefix,
- String name,
- PropertyFactory pf,
- DevicePolice police,
- XCANSparkMaxPIDProperties defaultPIDProperties) {
- this.deviceId = deviceInfo.channel;
- this.propertyFactory = pf;
- this.propertyFactory.setPrefix(owningSystemPrefix);
- this.propertyFactory.appendPrefix(name);
- prefix = pf.getPrefix();
- policeTicket = police.registerDevice(DeviceType.CAN, deviceId, this);
-
- if (defaultPIDProperties == null) {
- usesPropertySystem = false;
- } else {
- kPprop = pf.createPersistentProperty("kP", defaultPIDProperties.p);
- kIprop = pf.createPersistentProperty("kI", defaultPIDProperties.i);
- kDprop = pf.createPersistentProperty("kD", defaultPIDProperties.d);
-
- pf.setDefaultLevel(Property.PropertyLevel.Debug);
- percentProp = pf.createEphemeralProperty("Percent", 0);
- voltageProp = pf.createEphemeralProperty("Voltage", 0);
- currentProp = pf.createEphemeralProperty("Current", 0);
- kIzProp = pf.createPersistentProperty("kIzone", defaultPIDProperties.iZone);
- kFFprop = pf.createPersistentProperty("kFeedForward", defaultPIDProperties.feedForward);
- kMaxOutputProp = pf.createPersistentProperty("kMaxOutput", defaultPIDProperties.maxOutput);
- kMinOutoutProp = pf.createPersistentProperty("kMinOutput", defaultPIDProperties.minOutput);
- }
- }
-
- ///
- // Our own methods
- ///
-
- public String getPrefix() {
- return prefix;
- }
-
- private void setAllProperties() {
- if (usesPropertySystem) {
- setP(kPprop.get());
- setI(kIprop.get());
- setD(kDprop.get());
- setIZone(kIzProp.get());
- setFF(kFFprop.get());
- setOutputRange(kMinOutoutProp.get(), kMaxOutputProp.get());
- }
- }
-
- public void periodic() {
- if (usesPropertySystem) {
- if (firstPeriodicCall) {
- setAllProperties();
- firstPeriodicCall = false;
- }
- kPprop.hasChangedSinceLastCheck((value) -> setP(value));
- kIprop.hasChangedSinceLastCheck((value) -> setI(value));
- kDprop.hasChangedSinceLastCheck((value) -> setD(value));
- kIzProp.hasChangedSinceLastCheck((value) -> setIZone(value));
- kFFprop.hasChangedSinceLastCheck((value) -> setFF(value));
- kMaxOutputProp.hasChangedSinceLastCheck((value) -> setOutputRange(kMinOutoutProp.get(), value));
- kMinOutoutProp.hasChangedSinceLastCheck((value) -> setOutputRange(value, kMaxOutputProp.get()));
-
- percentProp.set(getAppliedOutput());
- voltageProp.set(getAppliedOutput() * getBusVoltage());
- currentProp.set(getOutputCurrent());
- }
- }
-
- /**** Speed Controller Interface ****/
- /**
- * Common interface for setting the speed of a speed controller.
- *
- * @param speed The speed to set. Value should be between -1.0 and 1.0.
- */
- public abstract void set(double speed);
-
- /**
- * Sets the voltage output of the SpeedController. This is equivillant to a call
- * to SetReference(output, rev::ControlType::kVoltage). The behavior of this
- * call differs slightly from the WPILib documetation for this call since the
- * device internally sets the desired voltage (not a compensation value). That
- * means that this *can* be a 'set-and-forget' call.
- *
- * @param outputVolts The voltage to output.
- */
- public abstract void setVoltage(double outputVolts);
-
- /**
- * Common interface for getting the current set speed of a speed controller.
- *
- * @return The current set speed. Value is between -1.0 and 1.0.
- */
- public abstract double get();
-
- /**
- * Common interface for inverting direction of a speed controller.
- *
- * This call has no effect if the controller is a follower.
- *
- * @param isInverted The state of inversion, true is inverted.
- */
- public abstract void setInverted(boolean isInverted);
-
- /**
- * Common interface for returning the inversion state of a speed controller.
- *
- * This call has no effect if the controller is a follower.
- *
- * @return isInverted The state of inversion, true is inverted.
- */
- public abstract boolean getInverted();
-
- /**
- * Common interface for disabling a motor.
- */
- public abstract void disable();
-
- public abstract void stopMotor();
-
- /**
- * Sets the current limit in Amps.
- *
- * The motor controller will reduce the controller voltage output to avoid
- * surpassing this limit. This limit is enabled by default and used for
- * brushless only. This limit is highly recommended when using the NEO brushless
- * motor.
- *
- * The NEO Brushless Motor has a low internal resistance, which can mean large
- * current spikes that could be enough to cause damage to the motor and
- * controller. This current limit provides a smarter strategy to deal with high
- * current draws and keep the motor and controller operating in a safe region.
- *
- * @param limit The current limit in Amps.
- *
- * @return REVLibError Set to REVLibError.kOK if successful
- *
- */
- public abstract REVLibError setSmartCurrentLimit(int limit);
-
- /**
- * Sets the current limit in Amps.
- *
- * The motor controller will reduce the controller voltage output to avoid
- * surpassing this limit. This limit is enabled by default and used for
- * brushless only. This limit is highly recommended when using the NEO brushless
- * motor.
- *
- * The NEO Brushless Motor has a low internal resistance, which can mean large
- * current spikes that could be enough to cause damage to the motor and
- * controller. This current limit provides a smarter strategy to deal with high
- * current draws and keep the motor and controller operating in a safe region.
- *
- * The controller can also limit the current based on the RPM of the motor in a
- * linear fashion to help with controllability in closed loop control. For a
- * response that is linear the entire RPM range leave limit RPM at 0.
- *
- * @param stallLimit The current limit in Amps at 0 RPM.
- * @param freeLimit The current limit at free speed (5700RPM for NEO).
- *
- * @return REVLibError Set to REVLibError.kOK if successful
- */
- public abstract REVLibError setSmartCurrentLimit(int stallLimit, int freeLimit);
-
- /**
- * Sets the current limit in Amps.
- *
- * The motor controller will reduce the controller voltage output to avoid
- * surpassing this limit. This limit is enabled by default and used for
- * brushless only. This limit is highly recommended when using the NEO brushless
- * motor.
- *
- * The NEO Brushless Motor has a low internal resistance, which can mean large
- * current spikes that could be enough to cause damage to the motor and
- * controller. This current limit provides a smarter strategy to deal with high
- * current draws and keep the motor and controller operating in a safe region.
- *
- * The controller can also limit the current based on the RPM of the motor in a
- * linear fashion to help with controllability in closed loop control. For a
- * response that is linear the entire RPM range leave limit RPM at 0.
- *
- * @param stallLimit The current limit in Amps at 0 RPM.
- * @param freeLimit The current limit at free speed (5700RPM for NEO).
- * @param limitRPM RPM less than this value will be set to the stallLimit, RPM
- * values greater than limitRPM will scale linearly to
- * freeLimit
- *
- * @return REVLibError Set to REVLibError.kOK if successful
- */
- public abstract REVLibError setSmartCurrentLimit(int stallLimit, int freeLimit, int limitRPM);
-
- /**
- * Sets the secondary current limit in Amps.
- *
- * The motor controller will disable the output of the controller briefly if the
- * current limit is exceeded to reduce the current. This limit is a simplified
- * 'on/off' controller. This limit is enabled by default but is set higher than
- * the default Smart Current Limit.
- *
- * The time the controller is off after the current limit is reached is
- * determined by the parameter limitCycles, which is the number of PWM cycles
- * (20kHz). The recommended value is the default of 0 which is the minimum time
- * and is part of a PWM cycle from when the over current is detected. This
- * allows the controller to regulate the current close to the limit value.
- *
- * The total time is set by the equation
- *
- *
- * t = (50us - t0) + 50us * limitCycles
- * t = total off time after over current
- * t0 = time from the start of the PWM cycle until over current is detected
- *
- *
- *
- * @param limit The current limit in Amps.
- *
- * @return REVLibError Set to REVLibError.kOK if successful
- */
- public abstract REVLibError setSecondaryCurrentLimit(double limit);
-
- /**
- * Sets the secondary current limit in Amps.
- *
- * The motor controller will disable the output of the controller briefly if the
- * current limit is exceeded to reduce the current. This limit is a simplified
- * 'on/off' controller. This limit is enabled by default but is set higher than
- * the default Smart Current Limit.
- *
- * The time the controller is off after the current limit is reached is
- * determined by the parameter limitCycles, which is the number of PWM cycles
- * (20kHz). The recommended value is the default of 0 which is the minimum time
- * and is part of a PWM cycle from when the over current is detected. This
- * allows the controller to regulate the current close to the limit value.
- *
- * The total time is set by the equation
- *
- *
- * t = (50us - t0) + 50us * limitCycles
- * t = total off time after over current
- * t0 = time from the start of the PWM cycle until over current is detected
- *
- *
- *
- * @param limit The current limit in Amps.
- * @param chopCycles The number of additional PWM cycles to turn the driver off
- * after overcurrent is detected.
- *
- * @return REVLibError Set to REVLibError.kOK if successful
- */
- public abstract REVLibError setSecondaryCurrentLimit(double limit, int chopCycles);
-
- /**
- * Sets the idle mode setting for the SPARK MAX.
- *
- * @param mode Idle mode (coast or brake).
- *
- * @return REVLibError Set to REVLibError.kOK if successful
- */
- public abstract REVLibError setIdleMode(IdleMode mode);
-
- /**
- * Gets the idle mode setting for the SPARK MAX.
- *
- * This uses the Get Parameter API and should be used infrequently. This
- * function uses a non-blocking call and will return a cached value if the
- * parameter is not returned by the timeout. The timeout can be changed by
- * calling SetCANTimeout(int milliseconds)
- *
- * @return IdleMode Idle mode setting
- */
- public abstract IdleMode getIdleMode();
-
- /**
- * Sets the voltage compensation setting for all modes on the SPARK MAX and
- * enables voltage compensation.
- *
- * @param nominalVoltage Nominal voltage to compensate output to
- *
- * @return REVLibError Set to REVLibError.kOK if successful
- */
- public abstract REVLibError enableVoltageCompensation(double nominalVoltage);
-
- /**
- * Disables the voltage compensation setting for all modes on the SPARK MAX.
- *
- * @return REVLibError Set to REVLibError.kOK if successful
- */
- public abstract REVLibError disableVoltageCompensation();
-
- /**
- * Get the configured voltage compensation nominal voltage value
- *
- * @return The nominal voltage for voltage compensation mode.
- */
- public abstract double getVoltageCompensationNominalVoltage();
-
- /**
- * Sets the ramp rate for open loop control modes.
- *
- * This is the maximum rate at which the motor controller's output is allowed to
- * change.
- *
- * @param rate Time in seconds to go from 0 to full throttle.
- *
- * @return REVLibError Set to REVLibError.kOK if successful
- */
- public abstract REVLibError setOpenLoopRampRate(double rate);
-
- /**
- * Sets the ramp rate for closed loop control modes.
- *
- * This is the maximum rate at which the motor controller's output is allowed to
- * change.
- *
- * @param rate Time in seconds to go from 0 to full throttle.
- *
- * @return REVLibError Set to REVLibError.kOK if successful
- */
- public abstract REVLibError setClosedLoopRampRate(double rate);
-
- /**
- * Get the configured open loop ramp rate
- *
- * This is the maximum rate at which the motor controller's output is allowed to
- * change.
- *
- * @return ramp rate time in seconds to go from 0 to full throttle.
- */
- public abstract double getOpenLoopRampRate();
-
- /**
- * Get the configured closed loop ramp rate
- *
- * This is the maximum rate at which the motor controller's output is allowed to
- * change.
- *
- * @return ramp rate time in seconds to go from 0 to full throttle.
- */
- public abstract double getClosedLoopRampRate();
-
- /**
- * Causes this controller's output to mirror the provided leader.
- *
- * Only voltage output is mirrored. Settings changed on the leader do not affect
- * the follower.
- *
- * The motor will spin in the same direction as the leader. This can be changed
- * by passing a true constant after the leader parameter.
- *
- * Following anything other than a CAN SPARK MAX is not officially supported.
- *
- * @param leader The motor controller to follow.
- *
- * @return REVLibError Set to REVLibError.kOK if successful
- */
- public abstract REVLibError follow(final XCANSparkMax leader);
-
- /**
- * Causes this controller's output to mirror the provided leader.
- *
- * Only voltage output is mirrored. Settings changed on the leader do not affect
- * the follower.
- *
- * Following anything other than a CAN SPARK MAX is not officially supported.
- *
- * @param leader The motor controller to follow.
- * @param invert Set the follower to output opposite of the leader
- *
- * @return REVLibError Set to REVLibError.kOK if successful
- */
- public abstract REVLibError follow(final XCANSparkMax leader, boolean invert);
-
- /**
- * Causes this controller's output to mirror the provided leader.
- *
- * Only voltage output is mirrored. Settings changed on the leader do not affect
- * the follower.
- *
- * The motor will spin in the same direction as the leader. This can be changed
- * by passing a true constant after the deviceID parameter.
- *
- * Following anything other than a CAN SPARK MAX is not officially supported.
- *
- * @param leader The type of motor controller to follow (Talon SRX, Spark Max,
- * etc.).
- * @param deviceID The CAN ID of the device to follow.
- *
- * @return REVLibError Set to REVLibError.kOK if successful
- */
- public abstract REVLibError follow(ExternalFollower leader, int deviceID);
-
- /**
- * Causes this controller's output to mirror the provided leader.
- *
- * Only voltage output is mirrored. Settings changed on the leader do not affect
- * the follower.
- *
- * Following anything other than a CAN SPARK MAX is not officially supported.
- *
- * @param leader The type of motor controller to follow (Talon SRX, Spark Max,
- * etc.).
- * @param deviceID The CAN ID of the device to follow.
- *
- * @param invert Set the follower to output opposite of the leader
- *
- * @return REVLibError Set to REVLibError.kOK if successful
- */
- public abstract REVLibError follow(ExternalFollower leader, int deviceID, boolean invert);
-
- /**
- * Returns whether the controller is following another controller
- *
- * @return True if this device is following another controller false otherwise
- */
- public abstract boolean isFollower();
-
- /**
- * @return All fault bits as a short
- */
- public abstract short getFaults();
-
- /**
- * @return All sticky fault bits as a short
- */
- public abstract short getStickyFaults();
-
- /**
- * Get the value of a specific fault
- *
- * @param faultID The ID of the fault to retrive
- *
- * @return True if the fault with the given ID occurred.
- */
- public abstract boolean getFault(FaultID faultID);
-
- /**
- * Get the value of a specific sticky fault
- *
- * @param faultID The ID of the sticky fault to retrive
- *
- * @return True if the sticky fault with the given ID occurred.
- */
- public abstract boolean getStickyFault(FaultID faultID);
-
- /**
- * @return The voltage fed into the motor controller.
- */
- public abstract double getBusVoltage();
-
- /**
- * @return The motor controller's applied output duty cycle.
- */
- public abstract double getAppliedOutput();
-
- /**
- * @return The motor controller's output current in Amps.
- */
- public abstract double getOutputCurrent();
-
- /**
- * @return The motor temperature in Celsius.
- */
- public abstract double getMotorTemperature();
-
- /**
- * Clears all sticky faults.
- *
- * @return REVLibError Set to REVLibError.kOK if successful
- */
- public abstract REVLibError clearFaults();
-
- /**
- * Writes all settings to flash.
- *
- * @return REVLibError Set to REVLibError.kOK if successful
- */
- public abstract REVLibError burnFlash();
-
- /**
- * Sets timeout for sending CAN messages with SetParameter* and GetParameter*
- * calls. These calls will block for up to this amoutn of time before returning
- * a timeout erro. A timeout of 0 will make the SetParameter* calls
- * non-blocking, and instead will check the response in a separate thread. With
- * this configuration, any error messages will appear on the drivestration but
- * will not be returned by the GetLastError() call.
- *
- * @param milliseconds The timeout in milliseconds.
- *
- * @return REVLibError Set to REVLibError.kOK if successful
- */
- public abstract REVLibError setCANTimeout(int milliseconds);
-
- /**
- * Enable soft limits
- *
- * @param direction the direction of motion to restrict
- *
- * @param enable set true to enable soft limits
- *
- * @return REVLibError Set to REVLibError.kOK if successful
- */
- public abstract REVLibError enableSoftLimit(SoftLimitDirection direction, boolean enable);
-
- /**
- * Set the soft limit based on position. The default unit is rotations, but will
- * match the unit scaling set by the user.
- *
- * Note that this value is not scaled internally so care must be taken to make
- * sure these units match the desired conversion
- *
- * @param direction the direction of motion to restrict
- *
- * @param limit position soft limit of the controller
- *
- * @return REVLibError Set to REVLibError.kOK if successful
- */
- public abstract REVLibError setSoftLimit(SoftLimitDirection direction, float limit);
-
- /**
- * Get the soft limit setting in the controller
- *
- * @param direction the direction of motion to restrict
- *
- * @return position soft limit setting of the controller
- */
- public abstract double getSoftLimit(SoftLimitDirection direction);
-
- /**
- * @param direction The direction of the motion to restrict
- *
- * @return true if the soft limit is enabled.
- */
- public abstract boolean isSoftLimitEnabled(SoftLimitDirection direction);
-
- /**
- * All device errors are tracked on a per thread basis for all devices in that
- * thread. This is meant to be called immediately following another call that
- * has the possibility of returning an error to validate if an error has
- * occurred.
- *
- * @return the last error that was generated.
- */
- public abstract REVLibError getLastError();
-
- public abstract REVLibError restoreFactoryDefaults();
-
- ///
- // CAN Encoder Block
- ///
- public abstract double getPosition();
-
- public abstract double getVelocity();
-
- public abstract REVLibError setPosition(double position);
-
- public abstract REVLibError setPositionConversionFactor(double factor);
-
- public abstract REVLibError setVelocityConversionFactor(double factor);
-
- public abstract double getPositionConversionFactor();
-
- public abstract double getVelocityConversionFactor();
-
- public abstract REVLibError setAverageDepth(int depth);
-
- public abstract int getAverageDepth();
-
- public abstract REVLibError setMeasurementPeriod(int period_us);
-
- public abstract int getMeasurementPeriod();
-
- public abstract int getCountsPerRevolution();
-
- public abstract REVLibError setEncoderInverted(boolean inverted);
-
- ///
- // CAN PID Controller
- ///
-
- public abstract REVLibError setP(double gain);
-
- public abstract REVLibError setP(double gain, int slotID);
-
- public abstract REVLibError setI(double gain);
-
- public abstract REVLibError setI(double gain, int slotID);
-
- public abstract REVLibError setD(double gain);
-
- public abstract REVLibError setD(double gain, int slotID);
-
- public abstract REVLibError setDFilter(double gain);
-
- public abstract REVLibError setDFilter(double gain, int slotID);
-
- public abstract REVLibError setFF(double gain);
-
- public abstract REVLibError setFF(double gain, int slotID);
-
- // CHECKSTYLE:OFF
- public abstract REVLibError setIZone(double iZone);
-
- public abstract REVLibError setIZone(double iZone, int slotID);
-
- // CHECKSTYLE:ON
- public abstract REVLibError setOutputRange(double min, double max);
-
- public abstract REVLibError setOutputRange(double min, double max, int slotID);
-
- public abstract double getP();
-
- public abstract double getP(int slotID);
-
- public abstract double getI();
-
- public abstract double getI(int slotID);
-
- public abstract double getD();
-
- public abstract double getD(int slotID);
-
- public abstract double getDFilter(int slotID);
-
- public abstract double getFF();
-
- public abstract double getFF(int slotID);
-
- public abstract double getIZone();
-
- public abstract double getIZone(int slotID);
-
- public abstract double getOutputMin();
-
- public abstract double getOutputMin(int slotID);
-
- public abstract double getOutputMax();
-
- public abstract double getOutputMax(int slotID);
-
- public abstract REVLibError setSmartMotionMaxVelocity(double maxVel, int slotID);
-
- public abstract REVLibError setSmartMotionMaxAccel(double maxAccel, int slotID);
-
- public abstract REVLibError setSmartMotionMinOutputVelocity(double minVel, int slotID);
-
- public abstract REVLibError setSmartMotionAllowedClosedLoopError(double allowedErr, int slotID);
-
- public abstract double getSmartMotionMaxVelocity(int slotID);
-
- public abstract double getSmartMotionMaxAccel(int slotID);
-
- public abstract double getSmartMotionMinOutputVelocity(int slotID);
-
- public abstract double getSmartMotionAllowedClosedLoopError(int slotID);
-
- public abstract REVLibError setIMaxAccum(double iMaxAccum, int slotID);
-
- public abstract double getIMaxAccum(int slotID);
-
- public abstract REVLibError setIAccum(double iAccum);
-
- public abstract double getIAccum();
-
- public abstract REVLibError setReference(double value, ControlType ctrl);
-
- public abstract REVLibError setReference(double value, ControlType ctrl, int pidSlot);
-
- public abstract REVLibError setReference(double value, ControlType ctrl, int pidSlot, double arbFeedforward);
-
- public abstract REVLibError setReference(double value, ControlType ctrl, int pidSlot, double arbFeedforward,
- ArbFFUnits arbFFUnits);
-
- /// Get true value. Should not be called in competition code.
- public abstract CANSparkMax getInternalSparkMax();
-
- public abstract void setForwardLimitSwitch(com.revrobotics.SparkMaxLimitSwitch.Type switchType, boolean enabled);
-
- public abstract void setReverseLimitSwitch(com.revrobotics.SparkMaxLimitSwitch.Type switchType, boolean enabled);
-
- public abstract boolean getForwardLimitSwitchPressed(com.revrobotics.SparkMaxLimitSwitch.Type switchType);
-
- public abstract boolean getReverseLimitSwitchPressed(com.revrobotics.SparkMaxLimitSwitch.Type switchType);
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/actuators/XCANSparkMaxPIDProperties.java b/src/main/java/xbot/common/controls/actuators/XCANSparkMaxPIDProperties.java
deleted file mode 100644
index 1681d413..00000000
--- a/src/main/java/xbot/common/controls/actuators/XCANSparkMaxPIDProperties.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package xbot.common.controls.actuators;
-
-public class XCANSparkMaxPIDProperties {
- public double p = 0;
- public double i = 0;
- public double d = 0;
- public double iZone = 0;
- public double feedForward = 0;
- public double maxOutput = 1;
- public double minOutput = -1;
-
- public XCANSparkMaxPIDProperties(
- double p,
- double i,
- double d,
- double iZone,
- double feedForward,
- double maxOutput,
- double minOutput
- ) {
- this.p = p;
- this.i = i;
- this.d = d;
- this.iZone = iZone;
- this.feedForward = feedForward;
- this.maxOutput = maxOutput;
- this.minOutput = minOutput;
- }
-
- public XCANSparkMaxPIDProperties() { }
-
-
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/actuators/XCANTalon.java b/src/main/java/xbot/common/controls/actuators/XCANTalon.java
deleted file mode 100644
index a790a864..00000000
--- a/src/main/java/xbot/common/controls/actuators/XCANTalon.java
+++ /dev/null
@@ -1,394 +0,0 @@
-package xbot.common.controls.actuators;
-
-import com.ctre.phoenix.ErrorCode;
-import com.ctre.phoenix.ParamEnum;
-import com.ctre.phoenix.motion.MotionProfileStatus;
-import com.ctre.phoenix.motion.TrajectoryPoint;
-import com.ctre.phoenix.motorcontrol.ControlFrame;
-import com.ctre.phoenix.motorcontrol.ControlMode;
-import com.ctre.phoenix.motorcontrol.Faults;
-import com.ctre.phoenix.motorcontrol.FeedbackDevice;
-import com.ctre.phoenix.motorcontrol.IMotorController;
-import com.ctre.phoenix.motorcontrol.IMotorControllerEnhanced;
-import com.ctre.phoenix.motorcontrol.LimitSwitchNormal;
-import com.ctre.phoenix.motorcontrol.LimitSwitchSource;
-import com.ctre.phoenix.motorcontrol.NeutralMode;
-import com.ctre.phoenix.motorcontrol.RemoteFeedbackDevice;
-import com.ctre.phoenix.motorcontrol.RemoteLimitSwitchSource;
-import com.ctre.phoenix.motorcontrol.RemoteSensorSource;
-import com.ctre.phoenix.motorcontrol.SensorTerm;
-import com.ctre.phoenix.motorcontrol.StatusFrame;
-import com.ctre.phoenix.motorcontrol.StatusFrameEnhanced;
-import com.ctre.phoenix.motorcontrol.StickyFaults;
-import com.ctre.phoenix.sensors.SensorVelocityMeasPeriod;
-
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.DevicePolice.DeviceType;
-import xbot.common.injection.electrical_contract.CANTalonInfo;
-import xbot.common.properties.DoubleProperty;
-import xbot.common.properties.PropertyFactory;
-
-
-public abstract class XCANTalon implements IMotorControllerEnhanced {
- /*
- * Functions currently omitted:
- *
- * - enableControl/disableControl
- * - delete
- * - motion control frame mode
- * - "expiration" and other MotorSafety members
- * - getPinStateQuad*
- * - getPulseWidth*
- * - setPID w/ special args
- * - setParameter/getParameter
- */
-
- protected int deviceId;
- protected PropertyFactory propMan;
-
- private DoubleProperty currentProperty = null;
- private DoubleProperty outVoltageProperty = null;
- private DoubleProperty temperatureProperty = null;
- private DoubleProperty positionProperty = null;
- private DoubleProperty velocityProperty = null;
-
- protected String policeTicket;
-
- public interface XCANTalonFactory {
- XCANTalon create(CANTalonInfo deviceInfo);
- }
-
- public XCANTalon(int deviceId, PropertyFactory propMan, DevicePolice police) {
- this.deviceId = deviceId;
- this.propMan = propMan;
- policeTicket = police.registerDevice(DeviceType.CAN, deviceId, this);
- }
-
-
-
- public void createTelemetryProperties(String callingSystemPrefix, String deviceName) {
- // Creates nice prefixes for the SmartDashboard.
- propMan.setPrefix(callingSystemPrefix + "/" + deviceName);
- currentProperty = propMan.createEphemeralProperty("current", 0);
- outVoltageProperty = propMan.createEphemeralProperty("voltage", 0);
- temperatureProperty = propMan.createEphemeralProperty("temperature", 0);
- positionProperty = propMan.createEphemeralProperty("position", 0);
- velocityProperty = propMan.createEphemeralProperty("velocity", 0);
- }
-
- public void updateTelemetryProperties() {
- if(currentProperty == null
- || outVoltageProperty == null
- || temperatureProperty == null
- || positionProperty == null
- || velocityProperty == null) {
- return;
- }
-
- currentProperty.set(this.getOutputCurrent());
- outVoltageProperty.set(this.getMotorOutputVoltage());
- temperatureProperty.set(this.getTemperature());
-
- positionProperty.set(this.getSelectedSensorPosition(0));
- velocityProperty.set(this.getSelectedSensorVelocity(0));
- }
- /*
- @Override
- public int hashCode() {
- return this.deviceId;
- }*/
- /*
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof XCANTalon) {
- // This works since our hash code IS our device ID.
- return ((XCANTalon)obj).hashCode() == this.hashCode();
- }
- return false;
- }*/
-
- // ------ Set output routines. ----------//
- public abstract void set(ControlMode Mode, double demand);
-
- public void set(ControlMode mode, double demand1, double demand2) {
- // Deliberately do nothing.
- }
-
- public abstract void neutralOutput();
-
- public abstract void setNeutralMode(NeutralMode neutralMode);
-
- // ------ Invert behavior ----------//
- public abstract void setSensorPhase(boolean PhaseSensor);
-
- public abstract void setInverted(boolean invert);
-
- public abstract boolean getInverted();
-
- // ----- general output shaping ------------------//
- public abstract ErrorCode configOpenloopRamp(double secondsFromNeutralToFull, int timeoutMs);
-
- public abstract ErrorCode configClosedloopRamp(double secondsFromNeutralToFull, int timeoutMs);
-
- public abstract ErrorCode configPeakOutputForward(double percentOut, int timeoutMs);
-
- public abstract ErrorCode configPeakOutputReverse(double percentOut, int timeoutMs);
-
- public abstract ErrorCode configNominalOutputForward(double percentOut, int timeoutMs);
-
- public abstract ErrorCode configNominalOutputReverse(double percentOut, int timeoutMs);
-
- public abstract ErrorCode configNeutralDeadband(double percentDeadband, int timeoutMs);
-
- // ------ Voltage Compensation ----------//
- public abstract ErrorCode configVoltageCompSaturation(double voltage, int timeoutMs);
-
- public abstract ErrorCode configVoltageMeasurementFilter(int filterWindowSamples, int timeoutMs);
-
- public abstract void enableVoltageCompensation(boolean enable);
-
- // ------ General Status ----------//
- public abstract double getBusVoltage() ;
-
- public abstract double getMotorOutputPercent() ;
-
- public abstract double getMotorOutputVoltage() ;
-
- public abstract double getOutputCurrent() ;
-
- public abstract double getTemperature() ;
-
- // ------ sensor selection ----------//
- public abstract ErrorCode configSelectedFeedbackSensor(RemoteFeedbackDevice feedbackDevice, int pidIdx, int timeoutMs);
-
- public abstract ErrorCode configRemoteFeedbackFilter(int deviceID, RemoteSensorSource remoteSensorSource, int remoteOrdinal,
- int timeoutMs);
-
- public abstract ErrorCode configSensorTerm(SensorTerm sensorTerm, FeedbackDevice feedbackDevice, int timeoutMs);
-
- public abstract ErrorCode configSelectedFeedbackSensor(FeedbackDevice feedbackDevice, int pidIdx, int timeoutMs );
-
- // ------- sensor status --------- //
- public abstract double getSelectedSensorPosition(int pidIdx);
-
- public abstract double getSelectedSensorVelocity(int pidIdx);
-
- public abstract ErrorCode setSelectedSensorPosition(int sensorPos, int pidIdx, int timeoutMs);
-
- // ------ status frame period changes ----------//
- public abstract ErrorCode setControlFramePeriod(ControlFrame frame, int periodMs);
-
- public abstract ErrorCode setStatusFramePeriod(StatusFrame frame, int periodMs, int timeoutMs);
- public abstract ErrorCode setStatusFramePeriod(StatusFrameEnhanced frame, int periodMs, int timeoutMs );
-
- public abstract int getStatusFramePeriod(StatusFrame frame, int timeoutMs);
- public abstract int getStatusFramePeriod(StatusFrameEnhanced frame, int timeoutMs );
-
- //----- velocity signal conditionaing ------//
- public abstract ErrorCode configVelocityMeasurementPeriod(SensorVelocityMeasPeriod period, int timeoutMs );
- public abstract ErrorCode configVelocityMeasurementWindow(int windowSize, int timeoutMs );
-
- //------ remote limit switch ----------//
- public abstract ErrorCode configForwardLimitSwitchSource(RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int deviceID, int timeoutMs);
-
- public abstract ErrorCode configReverseLimitSwitchSource(RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int deviceID, int timeoutMs);
-
- public abstract void overrideLimitSwitchesEnable(boolean enable);
-
- // ------ local limit switch ----------//
- public abstract ErrorCode configForwardLimitSwitchSource(LimitSwitchSource type, LimitSwitchNormal normalOpenOrClose, int timeoutMs );
- public abstract ErrorCode configReverseLimitSwitchSource(LimitSwitchSource type, LimitSwitchNormal normalOpenOrClose, int timeoutMs );
-
- public abstract boolean isFwdLimitSwitchClosed();
- public abstract boolean isRevLimitSwitchClosed();
-
- // ------ soft limit ----------//
- public abstract ErrorCode configForwardSoftLimitThreshold(int forwardSensorLimit, int timeoutMs);
-
- public abstract ErrorCode configReverseSoftLimitThreshold(int reverseSensorLimit, int timeoutMs);
-
- public abstract ErrorCode configForwardSoftLimitEnable(boolean enable, int timeoutMs);
-
- public abstract ErrorCode configReverseSoftLimitEnable(boolean enable, int timeoutMs);
-
- public abstract void overrideSoftLimitsEnable(boolean enable);
-
- // ------ Current Lim ----------//
- public abstract ErrorCode configPeakCurrentLimit(int amps, int timeoutMs );
- public abstract ErrorCode configPeakCurrentDuration(int milliseconds, int timeoutMs );
- public abstract ErrorCode configContinuousCurrentLimit(int amps, int timeoutMs );
- public abstract void enableCurrentLimit(boolean enable);
-
- // ------ General Close loop ----------//
- public abstract ErrorCode config_kP(int slotIdx, double value, int timeoutMs);
-
- public abstract ErrorCode config_kI(int slotIdx, double value, int timeoutMs);
-
- public abstract ErrorCode config_kD(int slotIdx, double value, int timeoutMs);
-
- public abstract ErrorCode config_kF(int slotIdx, double value, int timeoutMs);
-
- public abstract ErrorCode config_IntegralZone(int slotIdx, int izone, int timeoutMs);
-
- public abstract ErrorCode configAllowableClosedloopError(int slotIdx, int allowableCloseLoopError, int timeoutMs);
-
- public abstract ErrorCode configMaxIntegralAccumulator(int slotIdx, double iaccum, int timeoutMs);
-
- //------ Close loop State ----------//
- public abstract ErrorCode setIntegralAccumulator(double iaccum, int pidIdx, int timeoutMs);
-
- public abstract double getClosedLoopError(int pidIdx);
-
- public abstract double getIntegralAccumulator(int pidIdx) ;
-
- public abstract double getErrorDerivative(int pidIdx) ;
-
- public abstract void selectProfileSlot(int slotIdx, int pidIdx);
-
- //public abstract int getClosedLoopTarget(int pidIdx); // will be added to JNI
-
- public abstract double getActiveTrajectoryPosition();
-
- public abstract double getActiveTrajectoryVelocity();
-
- public abstract double getActiveTrajectoryHeading();
-
- // ------ Motion Profile Settings used in Motion Magic and Motion Profile
- public abstract ErrorCode configMotionCruiseVelocity(int sensorUnitsPer100ms, int timeoutMs);
-
- public abstract ErrorCode configMotionAcceleration(int sensorUnitsPer100msPerSec, int timeoutMs);
-
- // ------ Motion Profile Buffer ----------//
- public abstract ErrorCode clearMotionProfileTrajectories();
- public abstract int getMotionProfileTopLevelBufferCount();
- public abstract ErrorCode pushMotionProfileTrajectory(TrajectoryPoint trajPt);
- public abstract boolean isMotionProfileTopLevelBufferFull();
- public abstract void processMotionProfileBuffer();
- public abstract ErrorCode getMotionProfileStatus(MotionProfileStatus statusToFill);
- public abstract ErrorCode clearMotionProfileHasUnderrun(int timeoutMs);
- public abstract ErrorCode changeMotionControlFramePeriod(int periodMs);
-
- // ------ error ----------//
- public abstract ErrorCode getLastError();
-
- // ------ Faults ----------//
- public abstract ErrorCode getFaults(Faults toFill) ;
-
- public abstract ErrorCode getStickyFaults(StickyFaults toFill) ;
-
- public abstract ErrorCode clearStickyFaults(int timeoutMs);
-
- // ------ Firmware ----------//
- public abstract int getFirmwareVersion();
-
- public abstract boolean hasResetOccurred();
-
- // ------ Custom Persistent Params ----------//
- public abstract ErrorCode configSetCustomParam(int newValue, int paramIndex, int timeoutMs);
-
- public abstract int configGetCustomParam(int paramIndex, int timoutMs);
-
- //------ Generic Param API, typically not used ----------//
- public abstract ErrorCode configSetParameter(ParamEnum param, double value, int subValue, int ordinal, int timeoutMs);
- public abstract ErrorCode configSetParameter(int param, double value, int subValue, int ordinal, int timeoutMs);
-
- public abstract double configGetParameter(ParamEnum paramEnum, int ordinal, int timeoutMs) ;
- public abstract double configGetParameter(int paramEnum, int ordinal, int timeoutMs) ;
-
- //------ Misc. ----------//
- public abstract int getBaseID();
- public abstract int getDeviceID();
-
- // ----- Follower ------//
- public abstract void follow(IMotorController masterToFollow);
- public abstract void valueUpdated();
-
- public void simpleSet(double percentInput) {
- set(ControlMode.PercentOutput, percentInput);
- }
-
- public void stopMotor() {
- neutralOutput();
- }
-
- /***
- * Convenience function to rapidly configure two CANTalons to work in tandem; often used for drive motors.
- * @param prefix Prefix for network tables; typically, fill this with getPrefix() if calling this from a Subsystem or Command.
- * @param masterName Motor name for network tables
- * @param master Talon that will control overall operations
- * @param follower Talon that will follow the master
- * @param masterInverted Should the master be inverted?
- * @param followerInverted Should the follower be inverted RELATIVE TO THE MASTER?
- * @param sensorPhase Is the encoder in phase with the master?
- */
- public static void configureMotorTeam(String prefix, String masterName, XCANTalon master, XCANTalon follower, boolean masterInverted,
- boolean followerInverted, boolean sensorPhase) {
- master.configureAsMasterMotor(prefix, masterName, masterInverted, sensorPhase);
- follower.configureAsFollowerMotor(master, followerInverted);
- }
-
- public static void configureMotorTeam(String prefix, String masterName, XCANTalon master, XCANTalon follower1, XCANTalon follower2, boolean masterInverted,
- boolean follower1Inverted, boolean follower2Inverted, boolean sensorPhase) {
- master.configureAsMasterMotor(prefix, masterName, masterInverted, sensorPhase);
- follower1.configureAsFollowerMotor(master, follower1Inverted);
- follower2.configureAsFollowerMotor(master, follower2Inverted);
- }
-
- public static void configureMotorTeam(String prefix, String masterName, XCANTalon master, XCANTalon follower1, XCANTalon follower2, XCANTalon follower3, boolean masterInverted,
- boolean follower1Inverted, boolean follower2Inverted, boolean follower3Inverted, boolean sensorPhase) {
- master.configureAsMasterMotor(prefix, masterName, masterInverted, sensorPhase);
- follower1.configureAsFollowerMotor(master, follower1Inverted);
- follower2.configureAsFollowerMotor(master, follower2Inverted);
- follower3.configureAsFollowerMotor(master, follower3Inverted);
- }
-
- /**
- * Convenience function to rapidly configure a CANTalon as a Master motor. Uses some typical configurations that can be
- * overriden later (for example, it sets typical maximum/minimum output values to 1 and -1)
- * @param prefix Prefix for network tables; typically, fill this with getPrefix() if calling this from a Subsystem or Command.
- * @param masterName Motor name for network tables
- * @param masterInverted Should the master be inverted?
- * @param sensorPhase Is the encoder in phase with the master?
- */
- public void configureAsMasterMotor(String prefix, String masterName, boolean masterInverted, boolean sensorPhase) {
- this.setInverted(masterInverted);
- this.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative, 0, 0);
- this.setSensorPhase(sensorPhase);
- this.createTelemetryProperties(prefix, masterName);
-
- this.setNeutralMode(NeutralMode.Coast);
- this.configForwardLimitSwitchSource(LimitSwitchSource.Deactivated, LimitSwitchNormal.Disabled, 0);
- this.configReverseLimitSwitchSource(LimitSwitchSource.Deactivated, LimitSwitchNormal.Disabled, 0);
-
- this.configPeakOutputForward(1, 0);
- this.configPeakOutputReverse(-1, 0);
-
- this.configForwardSoftLimitEnable(false, 0);
- this.configReverseSoftLimitEnable(false, 0);
- }
-
- /**
- * Convenience function to rapidly configure a XCANTalon to follow another XCANTalon. Uses some typical configurations that can be
- * overriden later (for example, it sets typical maximum/minimum output values to 1 and -1)
- * @param master The master XCANTalon that this should follow
- * @param followerInverted Should the follower be inverted RELATIVE TO THE MASTER?
- */
- public void configureAsFollowerMotor(XCANTalon master, boolean followerInverted) {
- this.follow(master);
- this.setInverted(followerInverted);
-
- this.setNeutralMode(NeutralMode.Coast);
- this.configPeakOutputForward(1, 0);
- this.configPeakOutputReverse(-1, 0);
-
- this.configForwardLimitSwitchSource(LimitSwitchSource.Deactivated, LimitSwitchNormal.Disabled, 0);
- this.configReverseLimitSwitchSource(LimitSwitchSource.Deactivated, LimitSwitchNormal.Disabled, 0);
-
- this.configForwardSoftLimitEnable(false, 0);
- this.configReverseSoftLimitEnable(false, 0);
- }
-
- public abstract int getPulseWidthRiseToFallUs();
-}
diff --git a/src/main/java/xbot/common/controls/actuators/XCANVictorSPX.java b/src/main/java/xbot/common/controls/actuators/XCANVictorSPX.java
deleted file mode 100644
index 9a727960..00000000
--- a/src/main/java/xbot/common/controls/actuators/XCANVictorSPX.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package xbot.common.controls.actuators;
-
-import xbot.common.injection.DevicePolice;
-import xbot.common.properties.PropertyFactory;
-
-public abstract class XCANVictorSPX extends XCANTalon {
-
- public interface XCANVictorSPXFactory {
- XCANVictorSPX create(int deviceId);
- }
-
- public XCANVictorSPX(int deviceId, PropertyFactory propMan, DevicePolice police) {
- super(deviceId, propMan, police);
- this.deviceId = deviceId;
- this.propMan = propMan;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/actuators/XCompressor.java b/src/main/java/xbot/common/controls/actuators/XCompressor.java
deleted file mode 100644
index d842289b..00000000
--- a/src/main/java/xbot/common/controls/actuators/XCompressor.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package xbot.common.controls.actuators;
-
-public abstract class XCompressor {
-
- public interface XCompressorFactory {
- XCompressor create();
- }
-
- public abstract void disable();
- public abstract void enable();
- public abstract boolean isEnabled();
-}
diff --git a/src/main/java/xbot/common/controls/actuators/XDigitalOutput.java b/src/main/java/xbot/common/controls/actuators/XDigitalOutput.java
deleted file mode 100644
index 19b33dac..00000000
--- a/src/main/java/xbot/common/controls/actuators/XDigitalOutput.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package xbot.common.controls.actuators;
-
-import xbot.common.controls.XBaseIO;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.DevicePolice.DeviceType;
-
-public abstract class XDigitalOutput implements XBaseIO {
-
- protected int channel;
-
- public interface XDigitalOutputFactory {
- XDigitalOutput create(int channel);
- }
-
- protected XDigitalOutput(int channel, DevicePolice police) {
- this.channel = channel;
- police.registerDevice(DeviceType.DigitalIO, channel, this);
- }
-
- public int getChannel() {
- return channel;
- }
-
- public abstract void set(boolean value);
-
- /**
- * Set the PWM frequency of ALL DIGITAL OUTPUT PWM CHANNELS
- * @param frequency PWM frequency
- */
- public abstract void setPWMRate(double frequency);
- public abstract void enablePWM(double initialDutyCycle);
- public abstract void updateDutyCycle(double dutyCycle);
- public abstract void disablePWM();
- public abstract boolean get();
-}
diff --git a/src/main/java/xbot/common/controls/actuators/XDoubleSolenoid.java b/src/main/java/xbot/common/controls/actuators/XDoubleSolenoid.java
deleted file mode 100644
index 6182c3bf..00000000
--- a/src/main/java/xbot/common/controls/actuators/XDoubleSolenoid.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package xbot.common.controls.actuators;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-public class XDoubleSolenoid {
-
- protected boolean isInverted = false;
- public XSolenoid forwardSolenoid;
- public XSolenoid reverseSolenoid;
-
- @AssistedFactory
- public abstract static class XDoubleSolenoidFactory {
- public abstract XDoubleSolenoid create(
- @Assisted("forwardSolenoid") XSolenoid forwardSolenoid,
- @Assisted("reverseSolenoid") XSolenoid reverseSolenoid);
- }
-
- @AssistedInject
- public XDoubleSolenoid(@Assisted("forwardSolenoid") XSolenoid forwardSolenoid, @Assisted("reverseSolenoid") XSolenoid reverseSolenoid) {
- this.forwardSolenoid = forwardSolenoid;
- this.reverseSolenoid = reverseSolenoid;
- }
-
- public void setInverted(boolean isInverted) {
- this.isInverted = isInverted;
- }
-
- public enum DoubleSolenoidMode {
- OFF,
- FORWARD,
- REVERSE
- }
-
- public void setDoubleSolenoid(DoubleSolenoidMode mode) {
- if (mode == DoubleSolenoidMode.FORWARD && isInverted)
- {
- mode = DoubleSolenoidMode.REVERSE;
- }
- else if (mode == DoubleSolenoidMode.REVERSE && isInverted)
- {
- mode = DoubleSolenoidMode.FORWARD;
- }
-
- switch (mode) {
-
- case FORWARD:
- setForwardInternal();
- break;
- case REVERSE:
- setReverseInternal();
- break;
- default:
- setOffInternal();
- break;
- }
- }
-
- public DoubleSolenoidMode getDoubleSolenoidMode() {
- DoubleSolenoidMode modeCandidate = DoubleSolenoidMode.OFF;
-
- if(forwardSolenoid.getAdjusted()) {
- modeCandidate = DoubleSolenoidMode.FORWARD;
- } else if(reverseSolenoid.getAdjusted()) {
- modeCandidate = DoubleSolenoidMode.REVERSE;
- }
-
- if (isInverted && modeCandidate == DoubleSolenoidMode.FORWARD) {
- modeCandidate = DoubleSolenoidMode.REVERSE;
- } else if (isInverted && modeCandidate == DoubleSolenoidMode.REVERSE) {
- modeCandidate = DoubleSolenoidMode.FORWARD;
- }
-
- return modeCandidate;
- }
-
- public boolean getIsForward() {
- return getDoubleSolenoidMode() == DoubleSolenoidMode.FORWARD;
- }
-
- public boolean getIsReverse() {
- return getDoubleSolenoidMode() == DoubleSolenoidMode.REVERSE;
- }
-
- public boolean getIsOff() {
- return getDoubleSolenoidMode() == DoubleSolenoidMode.OFF;
- }
-
- public void setOff() {
- setDoubleSolenoid(DoubleSolenoidMode.OFF);
- }
-
- public void setForward() {
- setDoubleSolenoid(DoubleSolenoidMode.FORWARD);
- }
-
- public void setReverse() {
- setDoubleSolenoid(DoubleSolenoidMode.REVERSE);
- }
-
- private void setOffInternal() {
- forwardSolenoid.setOn(false);
- reverseSolenoid.setOn(false);
- }
-
- private void setForwardInternal() {
- forwardSolenoid.setOn(true);
- reverseSolenoid.setOn(false);
- }
-
- private void setReverseInternal() {
- forwardSolenoid.setOn(false);
- reverseSolenoid.setOn(true);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/actuators/XPWM.java b/src/main/java/xbot/common/controls/actuators/XPWM.java
deleted file mode 100644
index 9cf3eec9..00000000
--- a/src/main/java/xbot/common/controls/actuators/XPWM.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package xbot.common.controls.actuators;
-
-import xbot.common.controls.XBaseIO;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.DevicePolice.DeviceType;
-
-public abstract class XPWM implements XBaseIO
-{
- protected int channel;
-
- public interface XPWMFactory {
- XPWM create(int channel);
- }
-
- protected XPWM(int channel, DevicePolice police) {
- this.channel = channel;
- police.registerDevice(DeviceType.PWM, channel, this);
- }
-
- public int getChannel() {
- return channel;
- }
-
- /**
- * Sets the PWM duty cycle
- * @param value the value to set, in the range [0, 255]
- */
- public abstract void setRaw(int value);
- public abstract int getRaw();
-
- /**
- * Sets the PWM duty cycle
- * @param value the value to set, in the range [-1, 1]
- */
- public abstract void setSigned(double value);
- public abstract double getSigned();
-
- /**
- * Sets the PWM duty cycle
- * @param value the value to set, in the range [0, 1]
- */
- public abstract void setUnsigned(double value);
- public abstract double getUnsigned();
-}
diff --git a/src/main/java/xbot/common/controls/actuators/XRelay.java b/src/main/java/xbot/common/controls/actuators/XRelay.java
deleted file mode 100644
index 09144d3d..00000000
--- a/src/main/java/xbot/common/controls/actuators/XRelay.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package xbot.common.controls.actuators;
-
-import edu.wpi.first.wpilibj.Relay.Value;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.DevicePolice.DeviceType;
-
-public abstract class XRelay {
-
- protected int channel;
- protected boolean inverted;
-
- public interface XRelayFactory {
- XRelay create(int channel);
- }
-
- protected XRelay(int channel, DevicePolice police) {
- this.channel = channel;
- police.registerDevice(DeviceType.PWM, channel, this);
- }
-
- public void setForward() {
- Value valueToSet = Value.kForward;
- if (inverted) {
- valueToSet = Value.kReverse;
- }
-
- set(valueToSet);
- }
-
- public void setReverse() {
- Value valueToSet = Value.kReverse;
- if (inverted) {
- valueToSet = Value.kForward;
- }
-
- set(valueToSet);
- }
-
- public void stop() {
- set(Value.kOff);
- }
-
- public void setInverted(boolean inverted) {
- this.inverted = inverted;
- }
-
- public abstract void set(Value value);
-}
diff --git a/src/main/java/xbot/common/controls/actuators/XServo.java b/src/main/java/xbot/common/controls/actuators/XServo.java
deleted file mode 100644
index 198d1c54..00000000
--- a/src/main/java/xbot/common/controls/actuators/XServo.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package xbot.common.controls.actuators;
-
-import xbot.common.controls.XBaseIO;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.DevicePolice.DeviceType;
-
-public abstract class XServo implements XBaseIO {
-
- protected int channel;
-
- public interface XServoFactory {
- XServo create(int channel);
- }
-
- protected XServo(int channel, DevicePolice police) {
- this.channel = channel;
- police.registerDevice(DeviceType.PWM, channel, this);
- }
-
- public int getChannel() {
- return channel;
- }
-
- public abstract void set(double value);
-}
diff --git a/src/main/java/xbot/common/controls/actuators/XSolenoid.java b/src/main/java/xbot/common/controls/actuators/XSolenoid.java
deleted file mode 100644
index aa0ef93b..00000000
--- a/src/main/java/xbot/common/controls/actuators/XSolenoid.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package xbot.common.controls.actuators;
-
-import xbot.common.controls.XBaseIO;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.DevicePolice.DeviceType;
-
-public abstract class XSolenoid implements XBaseIO {
-
- protected boolean isInverted = false;
- protected final int channel;
-
- public interface XSolenoidFactory {
- XSolenoid create(int channel);
- }
-
- protected XSolenoid(int channel, DevicePolice police) {
- this.channel = channel;
- police.registerDevice(DeviceType.Solenoid, this.channel, 0, getMaxSupportedChannel());
- }
-
- public void setOn(boolean on) {
- set(on ^ isInverted);
- }
-
- public boolean getAdjusted() {
- return get() ^ isInverted;
- }
-
- public void setInverted(boolean isInverted) {
- this.isInverted = isInverted;
- }
-
- public int getChannel() {
- return channel;
- }
-
- protected abstract void set(boolean on);
- protected abstract boolean get();
- protected abstract int getMaxSupportedChannel();
-}
diff --git a/src/main/java/xbot/common/controls/actuators/XSpeedController.java b/src/main/java/xbot/common/controls/actuators/XSpeedController.java
deleted file mode 100644
index 7c0fefe8..00000000
--- a/src/main/java/xbot/common/controls/actuators/XSpeedController.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package xbot.common.controls.actuators;
-
-import xbot.common.controls.XBaseIO;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.DevicePolice.DeviceType;
-
-public abstract class XSpeedController implements XBaseIO
-{
- protected int channel;
- protected boolean isInverted;
-
- public interface XSpeedControllerFactory {
- XSpeedController create(int channel);
- }
-
- public XSpeedController(int channel, DevicePolice police) {
- this.channel = channel;
- police.registerDevice(DeviceType.PWM, channel, this);
- }
-
- public int getChannel() {
- return channel;
- }
-
- public boolean getInverted() {
- return isInverted;
- }
- public void setInverted(boolean isInverted) {
- this.isInverted = isInverted;
- }
-
- public void setPower(double power) {
- set(power * (isInverted ? -1 : 1));
- }
-
- public double getPower() {
- return get() * (isInverted ? -1 : 1);
- }
-
- protected abstract double get();
- protected abstract void set(double value);
-}
diff --git a/src/main/java/xbot/common/controls/actuators/mock_adapters/MockCANSparkMax.java b/src/main/java/xbot/common/controls/actuators/mock_adapters/MockCANSparkMax.java
deleted file mode 100644
index 5d845a7f..00000000
--- a/src/main/java/xbot/common/controls/actuators/mock_adapters/MockCANSparkMax.java
+++ /dev/null
@@ -1,674 +0,0 @@
-package xbot.common.controls.actuators.mock_adapters;
-
-import java.math.BigDecimal;
-
-import com.revrobotics.CANSparkMax;
-import com.revrobotics.CANSparkMax.ControlType;
-import com.revrobotics.CANSparkMax.ExternalFollower;
-import com.revrobotics.CANSparkMax.FaultID;
-import com.revrobotics.CANSparkMax.IdleMode;
-import com.revrobotics.CANSparkMax.SoftLimitDirection;
-import com.revrobotics.REVLibError;
-import com.revrobotics.SparkMaxLimitSwitch.Type;
-import com.revrobotics.SparkMaxPIDController.ArbFFUnits;
-
-import org.apache.log4j.Logger;
-import org.json.JSONObject;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-import xbot.common.controls.actuators.XCANSparkMax;
-import xbot.common.controls.actuators.XCANSparkMaxPIDProperties;
-import xbot.common.controls.sensors.XEncoder;
-import xbot.common.controls.sensors.mock_adapters.MockEncoder;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.electrical_contract.DeviceInfo;
-import xbot.common.properties.PropertyFactory;
-import xbot.common.simulation.ISimulatableMotor;
-import xbot.common.simulation.ISimulatableSensor;
-
-public class MockCANSparkMax extends XCANSparkMax implements ISimulatableMotor, ISimulatableSensor {
- private static Logger log = Logger.getLogger(MockCANSparkMax.class);
- private double power = 0;
- private double velocity = 0;
- private double simulationScalingValue;
- boolean inverted = false;
- public XEncoder internalEncoder = null;
- double positionOffset = 0;
- double simulationPosition = 0;
-
- // PID parameters
- double kP = 0;
- double kI = 0;
- double kD = 0;
- double kFF = 0;
- double kMinOutput = -1.0;
- double kMaxOutput = 1.0;
- double referenceValue = 0;
- ControlType controlType = null;
-
- @AssistedFactory
- public abstract static class MockCANSparkMaxFactory extends XCANSparkMaxFactory {
- public abstract MockCANSparkMax create(
- @Assisted("deviceInfo") DeviceInfo deviceInfo,
- @Assisted("owningSystemPrefix") String owningSystemPrefix,
- @Assisted("name") String name,
- @Assisted("defaultPIDProperties") XCANSparkMaxPIDProperties defaultPIDProperties);
- }
-
- @AssistedInject
- public MockCANSparkMax(@Assisted("deviceInfo") DeviceInfo deviceInfo,
- @Assisted("owningSystemPrefix") String owningSystemPrefix, @Assisted("name") String name,
- PropertyFactory propMan, DevicePolice police,
- @Assisted("defaultPIDProperties") XCANSparkMaxPIDProperties defaultPIDProperties) {
- super(deviceInfo, owningSystemPrefix, name, propMan, police, defaultPIDProperties);
- log.info("Creating CAN talon with device ID: " + deviceId);
- internalEncoder = new MockEncoder("Test", propMan);
- setInverted(deviceInfo.inverted);
-
- this.simulationScalingValue = deviceInfo.simulationScalingValue;
- double simulationScalingFloor = 0.00001;
- if (Math.abs(simulationScalingValue) < simulationScalingFloor) {
- log.error("Your scaling value was suspiciously low. Are you sure it should be smaller than "
- + simulationScalingFloor + "?");
- }
- }
-
- protected double inversionFactor() {
- return this.getInverted() ? -1 : 1;
- }
-
- @Override
- public void set(double speed) {
- clearPid();
- power = speed;
- }
-
- @Override
- public void setVoltage(double outputVolts) {
- clearPid();
- power = outputVolts / 12;
- }
-
- @Override
- public double get() {
- return power;
- }
-
- @Override
- public void setInverted(boolean isInverted) {
- inverted = isInverted;
- }
-
- @Override
- public boolean getInverted() {
- return inverted;
- }
-
- @Override
- public void disable() {
- clearPid();
- power = 0;
- }
-
- @Override
- public void stopMotor() {
- clearPid();
- power = 0;
- }
-
- @Override
- public REVLibError setSmartCurrentLimit(int limit) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setSmartCurrentLimit(int stallLimit, int freeLimit) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setSmartCurrentLimit(int stallLimit, int freeLimit, int limitRPM) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setSecondaryCurrentLimit(double limit) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setSecondaryCurrentLimit(double limit, int chopCycles) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setIdleMode(IdleMode mode) {
- return REVLibError.kOk;
- }
-
- @Override
- public IdleMode getIdleMode() {
- return null;
- }
-
- @Override
- public REVLibError enableVoltageCompensation(double nominalVoltage) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError disableVoltageCompensation() {
- return REVLibError.kOk;
- }
-
- @Override
- public double getVoltageCompensationNominalVoltage() {
- return 0;
- }
-
- @Override
- public REVLibError setOpenLoopRampRate(double rate) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setClosedLoopRampRate(double rate) {
- return REVLibError.kOk;
- }
-
- @Override
- public double getOpenLoopRampRate() {
- return 0;
- }
-
- @Override
- public double getClosedLoopRampRate() {
- return 0;
- }
-
- @Override
- public REVLibError follow(XCANSparkMax leader) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError follow(XCANSparkMax leader, boolean invert) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError follow(ExternalFollower leader, int deviceID) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError follow(ExternalFollower leader, int deviceID, boolean invert) {
- return REVLibError.kOk;
- }
-
- @Override
- public boolean isFollower() {
- return false;
- }
-
- @Override
- public short getFaults() {
- return 0;
- }
-
- @Override
- public short getStickyFaults() {
- return 0;
- }
-
- @Override
- public boolean getFault(FaultID faultID) {
- return false;
- }
-
- @Override
- public boolean getStickyFault(FaultID faultID) {
- return false;
- }
-
- @Override
- public double getBusVoltage() {
- return 0;
- }
-
- @Override
- public double getAppliedOutput() {
- return 0;
- }
-
- @Override
- public double getOutputCurrent() {
- return 0;
- }
-
- @Override
- public double getMotorTemperature() {
- return 0;
- }
-
- @Override
- public REVLibError clearFaults() {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError burnFlash() {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setCANTimeout(int milliseconds) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError enableSoftLimit(SoftLimitDirection direction, boolean enable) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setSoftLimit(SoftLimitDirection direction, float limit) {
- return REVLibError.kOk;
- }
-
- @Override
- public double getSoftLimit(SoftLimitDirection direction) {
- return 0;
- }
-
- @Override
- public boolean isSoftLimitEnabled(SoftLimitDirection direction) {
- return false;
- }
-
- @Override
- public REVLibError getLastError() {
- return REVLibError.kOk;
- }
-
- @Override
- public double getPosition() {
- return positionOffset + simulationPosition;
- }
-
- @Override
- public double getVelocity() {
- return velocity;
- }
-
- @Override
- public REVLibError setPosition(double position) {
- this.positionOffset = position - simulationPosition;
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setPositionConversionFactor(double factor) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setVelocityConversionFactor(double factor) {
- return REVLibError.kOk;
- }
-
- @Override
- public double getPositionConversionFactor() {
- return 0;
- }
-
- @Override
- public double getVelocityConversionFactor() {
- return 0;
- }
-
- @Override
- public REVLibError setAverageDepth(int depth) {
- return REVLibError.kOk;
- }
-
- @Override
- public int getAverageDepth() {
- return 0;
- }
-
- @Override
- public REVLibError setMeasurementPeriod(int period_us) {
- return REVLibError.kOk;
- }
-
- @Override
- public int getMeasurementPeriod() {
- return 0;
- }
-
- @Override
- public int getCountsPerRevolution() {
- return 0;
- }
-
- @Override
- public REVLibError setEncoderInverted(boolean inverted) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setP(double gain) {
- kP = gain;
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setP(double gain, int slotID) {
- kP = gain;
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setI(double gain) {
- kI = gain;
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setI(double gain, int slotID) {
- kI = gain;
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setD(double gain) {
- kD = gain;
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setD(double gain, int slotID) {
- kD = gain;
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setDFilter(double gain) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setDFilter(double gain, int slotID) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setFF(double gain) {
- kFF = gain;
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setFF(double gain, int slotID) {
- kFF = gain;
- return REVLibError.kOk;
- }
-
- //CHECKSTYLE:OFF
- @Override
- public REVLibError setIZone(double IZone) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setIZone(double IZone, int slotID) {
- return REVLibError.kOk;
- }
- //CHECKSTYLE:ON
-
- @Override
- public REVLibError setOutputRange(double min, double max) {
- kMinOutput = min;
- kMaxOutput = max;
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setOutputRange(double min, double max, int slotID) {
- kMinOutput = min;
- kMaxOutput = max;
- return REVLibError.kOk;
- }
-
- @Override
- public double getP() {
- return kP;
- }
-
- @Override
- public double getP(int slotID) {
- return kP;
- }
-
- @Override
- public double getI() {
- return kI;
- }
-
- @Override
- public double getI(int slotID) {
- return kI;
- }
-
- @Override
- public double getD() {
- return kD;
- }
-
- @Override
- public double getD(int slotID) {
- return kD;
- }
-
- @Override
- public double getDFilter(int slotID) {
- return 0;
- }
-
- @Override
- public double getFF() {
- return kFF;
- }
-
- @Override
- public double getFF(int slotID) {
- return kFF;
- }
-
- @Override
- public double getIZone() {
- return 0;
- }
-
- @Override
- public double getIZone(int slotID) {
- return 0;
- }
-
- @Override
- public double getOutputMin() {
- return kMinOutput;
- }
-
- @Override
- public double getOutputMin(int slotID) {
- return kMinOutput;
- }
-
- @Override
- public double getOutputMax() {
- return kMaxOutput;
- }
-
- @Override
- public double getOutputMax(int slotID) {
- return kMaxOutput;
- }
-
- @Override
- public REVLibError setSmartMotionMaxVelocity(double maxVel, int slotID) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setSmartMotionMaxAccel(double maxAccel, int slotID) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setSmartMotionMinOutputVelocity(double minVel, int slotID) {
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setSmartMotionAllowedClosedLoopError(double allowedErr, int slotID) {
- return REVLibError.kOk;
- }
-
- @Override
- public double getSmartMotionMaxVelocity(int slotID) {
- return 0;
- }
-
- @Override
- public double getSmartMotionMaxAccel(int slotID) {
- return 0;
- }
-
- @Override
- public double getSmartMotionMinOutputVelocity(int slotID) {
- return 0;
- }
-
- @Override
- public double getSmartMotionAllowedClosedLoopError(int slotID) {
- return 0;
- }
-
- @Override
- public REVLibError setIMaxAccum(double iMaxAccum, int slotID) {
- return REVLibError.kOk;
- }
-
- @Override
- public double getIMaxAccum(int slotID) {
- return 0;
- }
-
- @Override
- public REVLibError setIAccum(double iAccum) {
- return REVLibError.kOk;
- }
-
- @Override
- public double getIAccum() {
- return 0;
- }
-
- @Override
- public REVLibError restoreFactoryDefaults() {
- return REVLibError.kOk;
- }
-
- @Override
- public CANSparkMax getInternalSparkMax() {
- return null;
- }
-
- @Override
- public REVLibError setReference(double value, ControlType ctrl) {
- referenceValue = value - positionOffset;
- controlType = ctrl;
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setReference(double value, ControlType ctrl, int pidSlot) {
- referenceValue = value - positionOffset;
- controlType = ctrl;
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setReference(double value, ControlType ctrl, int pidSlot, double arbFeedforward) {
- referenceValue = value - positionOffset;
- controlType = ctrl;
- return REVLibError.kOk;
- }
-
- @Override
- public REVLibError setReference(double value, ControlType ctrl, int pidSlot, double arbFeedforward,
- ArbFFUnits arbFFUnits) {
- referenceValue = value - positionOffset;
- controlType = ctrl;
- return REVLibError.kOk;
- }
-
- public double getReference() {
- return referenceValue + positionOffset;
- }
-
- public ControlType getControlType() {
- return controlType;
- }
-
- public void setVelocity(double velocity) {
- this.velocity = velocity;
- }
-
- private void clearPid() {
- referenceValue = 0;
- controlType = null;
- }
-
- @Override
- public JSONObject getSimulationData() {
- JSONObject motorObject;
-
- if (controlType == ControlType.kPosition) {
- motorObject = buildMotorObject(policeTicket, (float)(referenceValue / simulationScalingValue * inversionFactor()));
- motorObject.put("mode", "POSITION");
- } else {
- motorObject = buildMotorObject(policeTicket, (float)(get() * inversionFactor()));
- }
-
- return motorObject;
- }
-
- @Override
- public void ingestSimulationData(JSONObject payload) {
- BigDecimal intermediate = (BigDecimal) payload.get("EncoderTicks");
- simulationPosition = (intermediate.doubleValue() * simulationScalingValue * inversionFactor());
- }
-
- @Override
- public void setForwardLimitSwitch(Type switchType, boolean enabled) {
- }
-
- @Override
- public void setReverseLimitSwitch(Type switchType, boolean enabled) {
- }
-
- @Override
- public boolean getForwardLimitSwitchPressed(Type switchType) {
- return false;
- }
-
- @Override
- public boolean getReverseLimitSwitchPressed(Type switchType) {
- return false;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/actuators/mock_adapters/MockCANTalon.java b/src/main/java/xbot/common/controls/actuators/mock_adapters/MockCANTalon.java
deleted file mode 100644
index 3a70238f..00000000
--- a/src/main/java/xbot/common/controls/actuators/mock_adapters/MockCANTalon.java
+++ /dev/null
@@ -1,891 +0,0 @@
-package xbot.common.controls.actuators.mock_adapters;
-
-import java.math.BigDecimal;
-
-import com.ctre.phoenix.ErrorCode;
-import com.ctre.phoenix.ParamEnum;
-import com.ctre.phoenix.motion.MotionProfileStatus;
-import com.ctre.phoenix.motion.TrajectoryPoint;
-import com.ctre.phoenix.motorcontrol.ControlFrame;
-import com.ctre.phoenix.motorcontrol.ControlMode;
-import com.ctre.phoenix.motorcontrol.DemandType;
-import com.ctre.phoenix.motorcontrol.Faults;
-import com.ctre.phoenix.motorcontrol.FeedbackDevice;
-import com.ctre.phoenix.motorcontrol.IMotorController;
-import com.ctre.phoenix.motorcontrol.InvertType;
-import com.ctre.phoenix.motorcontrol.LimitSwitchNormal;
-import com.ctre.phoenix.motorcontrol.LimitSwitchSource;
-import com.ctre.phoenix.motorcontrol.NeutralMode;
-import com.ctre.phoenix.motorcontrol.RemoteFeedbackDevice;
-import com.ctre.phoenix.motorcontrol.RemoteLimitSwitchSource;
-import com.ctre.phoenix.motorcontrol.RemoteSensorSource;
-import com.ctre.phoenix.motorcontrol.SensorTerm;
-import com.ctre.phoenix.motorcontrol.StatusFrame;
-import com.ctre.phoenix.motorcontrol.StatusFrameEnhanced;
-import com.ctre.phoenix.motorcontrol.StickyFaults;
-import com.ctre.phoenix.motorcontrol.SupplyCurrentLimitConfiguration;
-import com.ctre.phoenix.motorcontrol.can.BaseTalon;
-import com.ctre.phoenix.sensors.CANCoder;
-import com.ctre.phoenix.sensors.SensorVelocityMeasPeriod;
-
-import org.apache.log4j.Logger;
-import org.json.JSONObject;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-import xbot.common.controls.actuators.XCANTalon;
-import xbot.common.controls.sensors.XEncoder;
-import xbot.common.controls.sensors.mock_adapters.MockEncoder;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.electrical_contract.CANTalonInfo;
-import xbot.common.logging.RobotAssertionManager;
-import xbot.common.math.MathUtils;
-import xbot.common.properties.PropertyFactory;
-import xbot.common.simulation.ISimulatableMotor;
-import xbot.common.simulation.ISimulatableSensor;
-
-public class MockCANTalon extends XCANTalon implements ISimulatableSensor, ISimulatableMotor {
-
- private static Logger log = Logger.getLogger(MockCANTalon.class);
-
- private int pulseWidthRiseToFallUs = 0;
-
- public final int deviceId;
- private double setpoint = 0;
- private double throttlePercent = 0;
- public XEncoder internalEncoder = null;
- double current = 0;
- int continuousCurrentLimit = 1000;
- double openLoopRamp = 0;
-
- private boolean forwardLimitSwitch;
- private boolean reverseLimitSwitch;
-
- double kp;
- double ki;
- double kd;
- double kf;
-
- private MockCANTalon master;
- private RobotAssertionManager assertionManager;
-
- private double simulationScalingValue;
-
- private boolean inverted;
- private boolean sensorPhaseInverted;
-
- @AssistedFactory
- public abstract static class MockCANTalonFactory implements XCANTalonFactory {
- public abstract MockCANTalon create(@Assisted("deviceInfo") CANTalonInfo deviceInfo);
- }
-
- @AssistedInject
- public MockCANTalon(@Assisted("deviceInfo") CANTalonInfo deviceInfo, PropertyFactory propMan, DevicePolice police,
- RobotAssertionManager assertionManager) {
- super(deviceInfo.channel, propMan, police);
- log.info("Creating CAN talon with device ID: " + deviceInfo.channel);
-
- this.deviceId = deviceInfo.channel;
- this.assertionManager = assertionManager;
- this.simulationScalingValue = deviceInfo.simulationScalingValue;
- double simulationScalingFloor = 0.00001;
- if (Math.abs(simulationScalingValue) < simulationScalingFloor) {
- log.error("Your scaling value was suspiciously low. Are you sure it should be smaller than "
- + simulationScalingFloor + "?");
- }
-
- setInverted(deviceInfo.inverted);
- if (deviceInfo.feedbackDevice != null) {
- configSelectedFeedbackSensor(deviceInfo.feedbackDevice, 0, 0);
- setSensorPhase(deviceInfo.feedbackDeviceInverted);
- }
- }
-
- @Override
- public void set(ControlMode Mode, double demand) {
- set(Mode, demand, 0);
- }
-
- public double getSetpoint() {
- return setpoint;
- }
-
- @Override
- public void set(ControlMode Mode, double demand0, double demand1) {
-
- this.setpoint = demand0 * (this.getInverted() ? -1 : 1);
-
- switch (Mode) {
- case Disabled:
- throttlePercent = 0;
- break;
- case PercentOutput:
- throttlePercent = setpoint;
- throttlePercent = MathUtils.constrainDoubleToRobotScale(throttlePercent);
- break;
- case Current:
- // Guess voltage by assuming a linear relationship between current and voltage,
- // bypassing PID
- throttlePercent = setpoint / 40.0;
- break;
- case MotionProfile:
- // This mode isn't supported in by the mock implementation (nor the real one)
- throttlePercent = 0;
- break;
- case Velocity:
- double rate = internalEncoder.getAdjustedRate();
- if (setpoint > rate) {
- throttlePercent = 1;
- }
- if (setpoint < rate) {
- throttlePercent = -1;
- }
- break;
- case Position:
- if (!Double.isFinite(this.kp)) {
- throttlePercent = 0;
- } else {
- // Highly efficient P(IDF) implementation
- throttlePercent = (this.setpoint - getPosition()) * this.kp;
- }
- break;
- case Follower:
- throttlePercent = master.getMotorOutputPercent();
- break;
- default:
- throttlePercent = 0;
- }
- }
-
- /**
- * Returns the low-level throttle percentage that would typically be sent to a motor.
- * For example, if a motor is configured as Inverted, and it was set to a value of 0.75:
- * getThrottlePercent (this method) would return -0.75
- * getMotorOutputPercent would return 0.75
- * As such, this is the method you would want to hook into consumers like a simulator, so that
- * changing inversion would affect them.
- * @return Motor throttle percentage (potentially inverted)
- */
- public double getThrottlePercent() {
- if (master == null) {
- return this.throttlePercent;
- } else {
- return this.master.getThrottlePercent();
- }
- }
-
- @Override
- public void neutralOutput() {
-
- }
-
- @Override
- public void setNeutralMode(NeutralMode neutralMode) {
-
- }
-
- @Override
- public void setSensorPhase(boolean PhaseSensor) {
- this.sensorPhaseInverted = PhaseSensor;
- }
-
- @Override
- public void setInverted(boolean invert) {
- this.inverted = invert;
- }
-
- @Override
- public boolean getInverted() {
- return this.inverted;
- }
-
- @Override
- public ErrorCode configOpenloopRamp(double secondsFromNeutralToFull, int timeoutMs) {
- openLoopRamp = secondsFromNeutralToFull;
- return null;
- }
-
- public double getOpenLoopRamp() {
- return openLoopRamp;
- }
-
- @Override
- public ErrorCode configClosedloopRamp(double secondsFromNeutralToFull, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configPeakOutputForward(double percentOut, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configPeakOutputReverse(double percentOut, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configNominalOutputForward(double percentOut, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configNominalOutputReverse(double percentOut, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configNeutralDeadband(double percentDeadband, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configVoltageCompSaturation(double voltage, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configVoltageMeasurementFilter(int filterWindowSamples, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public void enableVoltageCompensation(boolean enable) {
-
- }
-
- @Override
- public double getBusVoltage() {
-
- return 12;
- }
-
- @Override
- public double getMotorOutputPercent() {
- // if the Talon is set to invert, it will output negative voltages. This needs
- // to be taken into account.
-
- double inversionFactor = this.getInverted() ? -1 : 1;
- return this.getThrottlePercent() * inversionFactor;
- }
-
- @Override
- public double getMotorOutputVoltage() {
-
- return getMotorOutputPercent() * this.getBusVoltage();
- }
-
- @Override
- public double getOutputCurrent() {
-
- return current;
- }
-
- public void setOutputCurrent(double current) {
- this.current = current;
- }
-
- @Override
- public double getTemperature() {
-
- return 0;
- }
-
- @Override
- public ErrorCode configSelectedFeedbackSensor(RemoteFeedbackDevice feedbackDevice, int pidIdx, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configRemoteFeedbackFilter(int deviceID, RemoteSensorSource remoteSensorSource, int remoteOrdinal,
- int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configSensorTerm(SensorTerm sensorTerm, FeedbackDevice feedbackDevice, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configSelectedFeedbackSensor(FeedbackDevice feedbackDevice, int pidIdx, int timeoutMs) {
- if (feedbackDevice == FeedbackDevice.QuadEncoder || feedbackDevice == FeedbackDevice.CTRE_MagEncoder_Relative
- || feedbackDevice == FeedbackDevice.CTRE_MagEncoder_Absolute) {
- this.internalEncoder = new MockEncoder("Test", propMan);
- } else {
- assertionManager.fail(
- "Whatever you supplied is not supported by the test infrastructure! Update MockCANTalon to handle your scenario.");
- }
-
- return ErrorCode.OK;
- }
-
- @Override
- public double getSelectedSensorPosition(int pidIdx) {
-
- return (int) getPosition() * (sensorPhaseInverted ? -1 : 1);
- }
-
- @Override
- public double getSelectedSensorVelocity(int pidIdx) {
-
- return 0;
- }
-
- @Override
- public ErrorCode setSelectedSensorPosition(int sensorPos, int pidIdx, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode setControlFramePeriod(ControlFrame frame, int periodMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode setStatusFramePeriod(StatusFrame frame, int periodMs, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode setStatusFramePeriod(StatusFrameEnhanced frame, int periodMs, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public int getStatusFramePeriod(StatusFrame frame, int timeoutMs) {
-
- return 0;
- }
-
- @Override
- public int getStatusFramePeriod(StatusFrameEnhanced frame, int timeoutMs) {
-
- return 0;
- }
-
- @Override
- public ErrorCode configVelocityMeasurementWindow(int windowSize, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configForwardLimitSwitchSource(RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int deviceID, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configReverseLimitSwitchSource(RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int deviceID, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public void overrideLimitSwitchesEnable(boolean enable) {
-
- }
-
- @Override
- public ErrorCode configForwardLimitSwitchSource(LimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configReverseLimitSwitchSource(LimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configForwardSoftLimitThreshold(int forwardSensorLimit, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configReverseSoftLimitThreshold(int reverseSensorLimit, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configForwardSoftLimitEnable(boolean enable, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configReverseSoftLimitEnable(boolean enable, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public void overrideSoftLimitsEnable(boolean enable) {
-
- }
-
- public boolean isFwdLimitSwitchClosed() {
- return forwardLimitSwitch;
- }
-
- public void setForwardLimitSwitch(boolean value) {
- forwardLimitSwitch = value;
- }
-
- public boolean isRevLimitSwitchClosed() {
- return reverseLimitSwitch;
- }
-
- public void setReverseLimitSwitch(boolean value) {
- reverseLimitSwitch = value;
- }
-
- @Override
- public ErrorCode configPeakCurrentLimit(int amps, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configPeakCurrentDuration(int milliseconds, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configContinuousCurrentLimit(int amps, int timeoutMs) {
- continuousCurrentLimit = amps;
- return null;
- }
-
- public int getContinuousCurrentLimit() {
- return continuousCurrentLimit;
- }
-
- @Override
- public void enableCurrentLimit(boolean enable) {
-
- }
-
- @Override
- public ErrorCode config_kP(int slotIdx, double value, int timeoutMs) {
- this.kp = value;
- return null;
- }
-
- @Override
- public ErrorCode config_kI(int slotIdx, double value, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode config_kD(int slotIdx, double value, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode config_kF(int slotIdx, double value, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode config_IntegralZone(int slotIdx, int izone, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configAllowableClosedloopError(int slotIdx, int allowableCloseLoopError, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configMaxIntegralAccumulator(int slotIdx, double iaccum, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode setIntegralAccumulator(double iaccum, int pidIdx, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public double getClosedLoopError(int pidIdx) {
-
- return 0;
- }
-
- @Override
- public double getIntegralAccumulator(int pidIdx) {
-
- return 0;
- }
-
- @Override
- public double getErrorDerivative(int pidIdx) {
-
- return 0;
- }
-
- @Override
- public void selectProfileSlot(int slotIdx, int pidIdx) {
-
- }
-
- @Override
- public double getActiveTrajectoryPosition() {
-
- return 0;
- }
-
- @Override
- public double getActiveTrajectoryVelocity() {
-
- return 0;
- }
-
- @Override
- public double getActiveTrajectoryHeading() {
-
- return 0;
- }
-
- @Override
- public ErrorCode configMotionCruiseVelocity(int sensorUnitsPer100ms, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configMotionAcceleration(int sensorUnitsPer100msPerSec, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode clearMotionProfileTrajectories() {
-
- return null;
- }
-
- @Override
- public int getMotionProfileTopLevelBufferCount() {
-
- return 0;
- }
-
- @Override
- public ErrorCode pushMotionProfileTrajectory(TrajectoryPoint trajPt) {
-
- return null;
- }
-
- @Override
- public boolean isMotionProfileTopLevelBufferFull() {
-
- return false;
- }
-
- @Override
- public void processMotionProfileBuffer() {
-
- }
-
- @Override
- public ErrorCode getMotionProfileStatus(MotionProfileStatus statusToFill) {
-
- return null;
- }
-
- @Override
- public ErrorCode clearMotionProfileHasUnderrun(int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode changeMotionControlFramePeriod(int periodMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode getLastError() {
-
- return null;
- }
-
- @Override
- public ErrorCode getFaults(Faults toFill) {
-
- return null;
- }
-
- @Override
- public ErrorCode getStickyFaults(StickyFaults toFill) {
-
- return null;
- }
-
- @Override
- public ErrorCode clearStickyFaults(int timeoutMs) {
-
- return null;
- }
-
- @Override
- public int getFirmwareVersion() {
-
- return 0;
- }
-
- @Override
- public boolean hasResetOccurred() {
-
- return false;
- }
-
- @Override
- public ErrorCode configSetCustomParam(int newValue, int paramIndex, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public int configGetCustomParam(int paramIndex, int timoutMs) {
-
- return 0;
- }
-
- @Override
- public ErrorCode configSetParameter(ParamEnum param, double value, int subValue, int ordinal, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configSetParameter(int param, double value, int subValue, int ordinal, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public double configGetParameter(ParamEnum paramEnum, int ordinal, int timeoutMs) {
-
- return 0;
- }
-
- @Override
- public double configGetParameter(int paramEnum, int ordinal, int timeoutMs) {
-
- return 0;
- }
-
- @Override
- public int getBaseID() {
-
- return 0;
- }
-
- @Override
- public int getDeviceID() {
-
- return 0;
- }
-
- @Override
- public void follow(IMotorController masterToFollow) {
- master = (MockCANTalon) masterToFollow;
- }
-
- @Override
- public void valueUpdated() {
-
- }
-
- public double getPosition() {
- if (internalEncoder == null) {
- assertionManager.fail("Position requested before setting feedback device!");
- return 0;
- }
-
- return internalEncoder.getAdjustedDistance();
- }
-
- public void setPosition(double pos) {
- if (internalEncoder == null) {
- assertionManager.fail("Position set before setting feedback device!");
- } else {
- ((MockEncoder) internalEncoder).setDistance(pos);
- }
- }
-
- public void setRate(double rate) {
- if (internalEncoder == null) {
- assertionManager.fail("Rate set before setting feedback device!");
- } else {
- ((MockEncoder) internalEncoder).setRate(rate);
- }
- }
-
- @Override
- public void set(ControlMode Mode, double demand0, DemandType demand1Type, double demand1) {
-
- }
-
- @Override
- public ErrorCode configSelectedFeedbackCoefficient(double coefficient, int pidIdx, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configClosedLoopPeakOutput(int slotIdx, double percentOut, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configClosedLoopPeriod(int slotIdx, int loopTimeMs, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configAuxPIDPolarity(boolean invert, int timeoutMs) {
- return null;
- }
-
- @Override
- public double getClosedLoopTarget(int pidIdx) {
- return 0;
- }
-
- @Override
- public ErrorCode configMotionProfileTrajectoryPeriod(int baseTrajDurationMs, int timeoutMs) {
- return null;
- }
-
- @Override
- public ControlMode getControlMode() {
- return null;
- }
-
- @Override
- public ErrorCode configMotionSCurveStrength(int curveStrength, int timeoutMs) {
- return null;
- }
-
- @Override
- public int getPulseWidthRiseToFallUs() {
- return pulseWidthRiseToFallUs;
- }
-
- public void setPulseWidthRiseToFallUs(int value) {
- pulseWidthRiseToFallUs = value;
- }
-
- @Override
- public void ingestSimulationData(JSONObject payload) {
- BigDecimal intermediate = (BigDecimal) payload.get("EncoderTicks");
- setPosition((int) (intermediate.doubleValue() * simulationScalingValue));
- }
-
- @Override
- public JSONObject getSimulationData() {
- return buildMotorObject(policeTicket, (float)getThrottlePercent());
- }
-
- @Override
- public ErrorCode configSupplyCurrentLimit(SupplyCurrentLimitConfiguration currLimitCfg, int timeoutMs) {
- return null;
- }
-
- @Override
- public void setInverted(InvertType invertType) {
-
- }
-
- @Override
- public ErrorCode configRemoteFeedbackFilter(CANCoder canCoderRef, int remoteOrdinal, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configRemoteFeedbackFilter(BaseTalon talonRef, int remoteOrdinal, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode setSelectedSensorPosition(double sensorPos, int pidIdx, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configForwardSoftLimitThreshold(double forwardSensorLimit, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configReverseSoftLimitThreshold(double reverseSensorLimit, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode config_IntegralZone(int slotIdx, double izone, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configAllowableClosedloopError(int slotIdx, double allowableCloseLoopError, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configMotionCruiseVelocity(double sensorUnitsPer100ms, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configMotionAcceleration(double sensorUnitsPer100msPerSec, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configVelocityMeasurementPeriod(SensorVelocityMeasPeriod period, int timeoutMs) {
- return null;
- }
-
- @Override
- @SuppressWarnings( "deprecation" )
- public ErrorCode configVelocityMeasurementPeriod(com.ctre.phoenix.motorcontrol.VelocityMeasPeriod period, int timeoutMs) {
- return null;
- }
-}
diff --git a/src/main/java/xbot/common/controls/actuators/mock_adapters/MockCANVictorSPX.java b/src/main/java/xbot/common/controls/actuators/mock_adapters/MockCANVictorSPX.java
deleted file mode 100644
index 079bb81e..00000000
--- a/src/main/java/xbot/common/controls/actuators/mock_adapters/MockCANVictorSPX.java
+++ /dev/null
@@ -1,630 +0,0 @@
-package xbot.common.controls.actuators.mock_adapters;
-
-import com.ctre.phoenix.ErrorCode;
-import com.ctre.phoenix.ParamEnum;
-import com.ctre.phoenix.motion.MotionProfileStatus;
-import com.ctre.phoenix.motion.TrajectoryPoint;
-import com.ctre.phoenix.motorcontrol.ControlFrame;
-import com.ctre.phoenix.motorcontrol.ControlMode;
-import com.ctre.phoenix.motorcontrol.DemandType;
-import com.ctre.phoenix.motorcontrol.Faults;
-import com.ctre.phoenix.motorcontrol.FeedbackDevice;
-import com.ctre.phoenix.motorcontrol.IMotorController;
-import com.ctre.phoenix.motorcontrol.InvertType;
-import com.ctre.phoenix.motorcontrol.LimitSwitchNormal;
-import com.ctre.phoenix.motorcontrol.LimitSwitchSource;
-import com.ctre.phoenix.motorcontrol.NeutralMode;
-import com.ctre.phoenix.motorcontrol.RemoteFeedbackDevice;
-import com.ctre.phoenix.motorcontrol.RemoteLimitSwitchSource;
-import com.ctre.phoenix.motorcontrol.RemoteSensorSource;
-import com.ctre.phoenix.motorcontrol.SensorTerm;
-import com.ctre.phoenix.motorcontrol.StatusFrame;
-import com.ctre.phoenix.motorcontrol.StatusFrameEnhanced;
-import com.ctre.phoenix.motorcontrol.StickyFaults;
-import com.ctre.phoenix.motorcontrol.SupplyCurrentLimitConfiguration;
-import com.ctre.phoenix.motorcontrol.can.BaseTalon;
-import com.ctre.phoenix.sensors.CANCoder;
-import com.ctre.phoenix.sensors.SensorVelocityMeasPeriod;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import xbot.common.controls.actuators.XCANVictorSPX;
-import xbot.common.injection.DevicePolice;
-import xbot.common.properties.PropertyFactory;
-
-public class MockCANVictorSPX extends XCANVictorSPX {
-
- double power;
-
- @AssistedFactory
- public abstract static class MockCANVictorSPXFactory implements XCANVictorSPXFactory {
- public abstract MockCANVictorSPX create(@Assisted("deviceId") int deviceId);
- }
-
- @AssistedInject
- public MockCANVictorSPX(@Assisted("deviceId") int deviceId, PropertyFactory propMan, DevicePolice police) {
- super(deviceId, propMan, police);
- }
-
- //CHECKSTYLE:OFF
-
- @Override
- public void set(ControlMode Mode, double demand0, DemandType demand1Type, double demand1) {
- power = demand0;
- }
-
- @Override
- public ErrorCode configSelectedFeedbackCoefficient(double coefficient, int pidIdx, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configClosedLoopPeakOutput(int slotIdx, double percentOut, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configClosedLoopPeriod(int slotIdx, int loopTimeMs, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configAuxPIDPolarity(boolean invert, int timeoutMs) {
- return null;
- }
-
- @Override
- public double getClosedLoopTarget(int pidIdx) {
- return 0;
- }
-
- @Override
- public ErrorCode configMotionSCurveStrength(int curveStrength, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configMotionProfileTrajectoryPeriod(int baseTrajDurationMs, int timeoutMs) {
- return null;
- }
-
- @Override
- public ControlMode getControlMode() {
- return null;
- }
-
- @Override
- public void set(ControlMode Mode, double demand) {
-
- }
-
- @Override
- public void neutralOutput() {
-
- }
-
- @Override
- public void setNeutralMode(NeutralMode neutralMode) {
-
- }
-
- @Override
- public void setSensorPhase(boolean PhaseSensor) {
-
- }
-
- @Override
- public void setInverted(boolean invert) {
-
- }
-
- @Override
- public boolean getInverted() {
- return false;
- }
-
- @Override
- public ErrorCode configOpenloopRamp(double secondsFromNeutralToFull, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configClosedloopRamp(double secondsFromNeutralToFull, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configPeakOutputForward(double percentOut, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configPeakOutputReverse(double percentOut, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configNominalOutputForward(double percentOut, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configNominalOutputReverse(double percentOut, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configNeutralDeadband(double percentDeadband, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configVoltageCompSaturation(double voltage, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configVoltageMeasurementFilter(int filterWindowSamples, int timeoutMs) {
- return null;
- }
-
- @Override
- public void enableVoltageCompensation(boolean enable) {
-
- }
-
- @Override
- public double getBusVoltage() {
- return 0;
- }
-
- @Override
- public double getMotorOutputPercent() {
- return power;
- }
-
- @Override
- public double getMotorOutputVoltage() {
- return 0;
- }
-
- @Override
- public double getOutputCurrent() {
- return 0;
- }
-
- @Override
- public double getTemperature() {
- return 0;
- }
-
- @Override
- public ErrorCode configSelectedFeedbackSensor(RemoteFeedbackDevice feedbackDevice, int pidIdx, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configRemoteFeedbackFilter(int deviceID, RemoteSensorSource remoteSensorSource, int remoteOrdinal,
- int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configSensorTerm(SensorTerm sensorTerm, FeedbackDevice feedbackDevice, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configSelectedFeedbackSensor(FeedbackDevice feedbackDevice, int pidIdx, int timeoutMs) {
- return null;
- }
-
- @Override
- public double getSelectedSensorPosition(int pidIdx) {
- return 0;
- }
-
- @Override
- public double getSelectedSensorVelocity(int pidIdx) {
- return 0;
- }
-
- @Override
- public ErrorCode setSelectedSensorPosition(int sensorPos, int pidIdx, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode setControlFramePeriod(ControlFrame frame, int periodMs) {
- return null;
- }
-
- @Override
- public ErrorCode setStatusFramePeriod(StatusFrame frame, int periodMs, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode setStatusFramePeriod(StatusFrameEnhanced frame, int periodMs, int timeoutMs) {
- return null;
- }
-
- @Override
- public int getStatusFramePeriod(StatusFrame frame, int timeoutMs) {
- return 0;
- }
-
- @Override
- public int getStatusFramePeriod(StatusFrameEnhanced frame, int timeoutMs) {
- return 0;
- }
-
- @Override
- @SuppressWarnings("deprecation")
- public ErrorCode configVelocityMeasurementPeriod(com.ctre.phoenix.motorcontrol.VelocityMeasPeriod period, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configVelocityMeasurementWindow(int windowSize, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configForwardLimitSwitchSource(RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int deviceID, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configReverseLimitSwitchSource(RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int deviceID, int timeoutMs) {
- return null;
- }
-
- @Override
- public void overrideLimitSwitchesEnable(boolean enable) {
-
- }
-
- @Override
- public ErrorCode configForwardLimitSwitchSource(LimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configReverseLimitSwitchSource(LimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int timeoutMs) {
- return null;
- }
-
- @Override
- public boolean isFwdLimitSwitchClosed() {
- return false;
- }
-
- @Override
- public boolean isRevLimitSwitchClosed() {
- return false;
- }
-
- @Override
- public ErrorCode configForwardSoftLimitThreshold(int forwardSensorLimit, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configReverseSoftLimitThreshold(int reverseSensorLimit, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configForwardSoftLimitEnable(boolean enable, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configReverseSoftLimitEnable(boolean enable, int timeoutMs) {
- return null;
- }
-
- @Override
- public void overrideSoftLimitsEnable(boolean enable) {
-
- }
-
- @Override
- public ErrorCode configPeakCurrentLimit(int amps, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configPeakCurrentDuration(int milliseconds, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configContinuousCurrentLimit(int amps, int timeoutMs) {
- return null;
- }
-
- @Override
- public void enableCurrentLimit(boolean enable) {
-
- }
-
- @Override
- public ErrorCode config_kP(int slotIdx, double value, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode config_kI(int slotIdx, double value, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode config_kD(int slotIdx, double value, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode config_kF(int slotIdx, double value, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode config_IntegralZone(int slotIdx, int izone, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configAllowableClosedloopError(int slotIdx, int allowableCloseLoopError, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configMaxIntegralAccumulator(int slotIdx, double iaccum, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode setIntegralAccumulator(double iaccum, int pidIdx, int timeoutMs) {
- return null;
- }
-
- @Override
- public double getClosedLoopError(int pidIdx) {
- return 0;
- }
-
- @Override
- public double getIntegralAccumulator(int pidIdx) {
- return 0;
- }
-
- @Override
- public double getErrorDerivative(int pidIdx) {
- return 0;
- }
-
- @Override
- public void selectProfileSlot(int slotIdx, int pidIdx) {
-
- }
-
- @Override
- public double getActiveTrajectoryPosition() {
- return 0;
- }
-
- @Override
- public double getActiveTrajectoryVelocity() {
- return 0;
- }
-
- @Override
- public double getActiveTrajectoryHeading() {
- return 0;
- }
-
- @Override
- public ErrorCode configMotionCruiseVelocity(int sensorUnitsPer100ms, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configMotionAcceleration(int sensorUnitsPer100msPerSec, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode clearMotionProfileTrajectories() {
- return null;
- }
-
- @Override
- public int getMotionProfileTopLevelBufferCount() {
- return 0;
- }
-
- @Override
- public ErrorCode pushMotionProfileTrajectory(TrajectoryPoint trajPt) {
- return null;
- }
-
- @Override
- public boolean isMotionProfileTopLevelBufferFull() {
- return false;
- }
-
- @Override
- public void processMotionProfileBuffer() {
-
- }
-
- @Override
- public ErrorCode getMotionProfileStatus(MotionProfileStatus statusToFill) {
- return null;
- }
-
- @Override
- public ErrorCode clearMotionProfileHasUnderrun(int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode changeMotionControlFramePeriod(int periodMs) {
- return null;
- }
-
- @Override
- public ErrorCode getLastError() {
- return null;
- }
-
- @Override
- public ErrorCode getFaults(Faults toFill) {
- return null;
- }
-
- @Override
- public ErrorCode getStickyFaults(StickyFaults toFill) {
- return null;
- }
-
- @Override
- public ErrorCode clearStickyFaults(int timeoutMs) {
- return null;
- }
-
- @Override
- public int getFirmwareVersion() {
- return 0;
- }
-
- @Override
- public boolean hasResetOccurred() {
- return false;
- }
-
- @Override
- public ErrorCode configSetCustomParam(int newValue, int paramIndex, int timeoutMs) {
- return null;
- }
-
- @Override
- public int configGetCustomParam(int paramIndex, int timoutMs) {
- return 0;
- }
-
- @Override
- public ErrorCode configSetParameter(ParamEnum param, double value, int subValue, int ordinal, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configSetParameter(int param, double value, int subValue, int ordinal, int timeoutMs) {
- return null;
- }
-
- @Override
- public double configGetParameter(ParamEnum paramEnum, int ordinal, int timeoutMs) {
- return 0;
- }
-
- @Override
- public double configGetParameter(int paramEnum, int ordinal, int timeoutMs) {
- return 0;
- }
-
- @Override
- public int getBaseID() {
- return 0;
- }
-
- @Override
- public int getDeviceID() {
- return 0;
- }
-
- @Override
- public void follow(IMotorController masterToFollow) {
-
- }
-
- @Override
- public void valueUpdated() {
-
- }
-
- @Override
- public int getPulseWidthRiseToFallUs() {
- return 0;
- }
-
- @Override
- public ErrorCode configSupplyCurrentLimit(SupplyCurrentLimitConfiguration currLimitCfg, int timeoutMs) {
- return null;
- }
-
- @Override
- public void setInverted(InvertType invertType) {
-
- }
-
- @Override
- public ErrorCode configRemoteFeedbackFilter(CANCoder canCoderRef, int remoteOrdinal, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configRemoteFeedbackFilter(BaseTalon talonRef, int remoteOrdinal, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode setSelectedSensorPosition(double sensorPos, int pidIdx, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configForwardSoftLimitThreshold(double forwardSensorLimit, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configReverseSoftLimitThreshold(double reverseSensorLimit, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode config_IntegralZone(int slotIdx, double izone, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configAllowableClosedloopError(int slotIdx, double allowableCloseLoopError, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configMotionCruiseVelocity(double sensorUnitsPer100ms, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configMotionAcceleration(double sensorUnitsPer100msPerSec, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configVelocityMeasurementPeriod(SensorVelocityMeasPeriod period, int timeoutMs) {
- return null;
- }
-
- //CHECKSTYLE:ON
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/actuators/mock_adapters/MockLegacyCANTalon.java b/src/main/java/xbot/common/controls/actuators/mock_adapters/MockLegacyCANTalon.java
deleted file mode 100644
index 8a8410de..00000000
--- a/src/main/java/xbot/common/controls/actuators/mock_adapters/MockLegacyCANTalon.java
+++ /dev/null
@@ -1,669 +0,0 @@
-/*package xbot.common.controls.actuators.mock_adapters;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-
-import com.ctre.CANTalon;
-import com.ctre.CANTalon.FeedbackDevice;
-import com.ctre.CANTalon.FeedbackDeviceStatus;
-import com.ctre.CANTalon.StatusFrameRate;
-import com.ctre.CANTalon.TalonControlMode;
-import com.ctre.phoenix.motorcontrol.ControlMode;
-import javax.inject.Inject;
-import com.google.inject.assistedinject.Assisted;
-
-import edu.wpi.first.wpilibj.livewindow.LiveWindowSendable;
-import xbot.common.controls.MockRobotIO;
-import xbot.common.controls.actuators.XCANTalon;
-import xbot.common.controls.sensors.XEncoder;
-import xbot.common.controls.sensors.mock_adapters.MockEncoder;
-import xbot.common.math.MathUtils;
-import xbot.common.properties.XPropertyManager;
-
-public class MockCANTalon extends XCANTalon {
- public final int deviceId;
- private ControlMode controlMode;
- private ControlMode lastSetControlMode;
-
- private boolean outputInverted = false;
- private boolean closedLoopOutputInverted = false;
-
- private double setpoint = 0;
- private double throttlePercent = 0;
- private double motorCurrent = 0;
-
- private int currentProfile = 0;
- private Map profiles = new HashMap<>();
-
-
- @SuppressWarnings("unused")
- private static class ProfileParams
- {
- public double p;
- public double i;
- public double d;
- public double f;
- public double iZone;
- }
-
- private static final ProfileParams defaultParams = new ProfileParams();
-
- MockRobotIO mockRobotIO;
- public XEncoder internalEncoder = null;
-
- private static Logger log = Logger.getLogger(MockCANTalon.class);
-
- @Inject
- public MockCANTalon(@Assisted("deviceId") int deviceId, MockRobotIO mockRobotIO, XPropertyManager propMan) {
- super(deviceId, propMan);
- log.info("Creating CAN talon with device ID: " + deviceId);
-
- this.deviceId = deviceId;
- this.mockRobotIO = mockRobotIO;
- mockRobotIO.setCANTalon(deviceId, this);
-
- this.setControlMode(TalonControlMode.Disabled);
- }
-
- private void initCurrentProfileParams() {
- if(!this.profiles.containsKey(currentProfile)) {
- this.profiles.put(currentProfile, new ProfileParams());
- }
- }
-
- public double getThrottlePercent() {
- return this.throttlePercent;
- }
-
- @Override
- public LiveWindowSendable getLiveWindowSendable() {
- return null;
- }
-
- @Override
- public boolean isEnabled() {
- return controlMode != CANTalon.TalonControlMode.Disabled;
- }
-
- @Override
- public void enable() {
- controlMode = lastSetControlMode;
- }
-
- @Override
- public void disable() {
- controlMode = CANTalon.TalonControlMode.Disabled;
- }
-
- @Override
- public void setProfile(int profile) {
- this.currentProfile = profile;
- }
-
- @Override
- public TalonControlMode getControlMode() {
- return controlMode;
- }
-
- @Override
- public void setControlMode(TalonControlMode controlMode) {
- this.controlMode = controlMode;
- this.lastSetControlMode = controlMode;
- }
-
- @Override
- public boolean getBrakeEnableDuringNeutral() {
- // Brake isn't supported in mock environment.
- return false;
- }
-
- @Override
- public void setBrakeEnableDuringNeutral(boolean brake) {
- // Intentionally left blank. Brake isn't supported in mock environment.
- }
-
- @Override
- public void setStatusFrameRateMs(StatusFrameRate stateFrame, int periodMs) {
- // Intentionally left blank. There isn't an update rate in the mock environment.
- }
-
- @Override
- public void reset() {
- this.clearIAccum();
- this.disable();
- }
-
- @Override
- public int getDeviceID() {
- return this.deviceId;
- }
-
- @Override
- public double getOutputCurrent() {
- return motorCurrent;
- }
-
- public void setOutputCurrent(double current){
- motorCurrent = current;
- }
-
- @Override
- public double getOutputVoltage() {
- // if the Talon is set to invert, it will output negative voltages. This needs
- // to be taken into account.
-
-
- double inversionFactor = this.getInverted() ? -1 : 1;
- return this.getThrottlePercent() * this.getBusVoltage() * inversionFactor;
- }
-
- @Override
- public double getTemperature() {
- // No point in mocking this
- return 0;
- }
-
- @Override
- public double getBusVoltage() {
- return MockRobotIO.BUS_VOLTAGE;
- }
-
- @Override
- public long getFirmwareVersion() {
- return 0;
- }
-
- @Override
- public void clearStickyFaults() {
- // Intentionally left blank
- }
-
- @Override
- public int getFaultForwardLim() {
- // Intentionally left blank
- return 0;
- }
-
- @Override
- public int getFaultForwardSoftLim() {
- // Intentionally left blank
- return 0;
- }
-
- @Override
- public int getFaultHardwareFailure() {
- // Intentionally left blank
- return 0;
- }
-
- @Override
- public int getFaultOverTemp() {
- // Intentionally left blank
- return 0;
- }
-
- @Override
- public int getFaultReverseLim() {
- // Intentionally left blank
- return 0;
- }
-
- @Override
- public int getFaultReverseSoftLim() {
- // Intentionally left blank
- return 0;
- }
-
- @Override
- public int getFaultUnderVoltage() {
- // Intentionally left blank
- return 0;
- }
-
- @Override
- public int getStickyFaultForwardLim() {
- // Intentionally left blank
- return 0;
- }
-
- @Override
- public int getStickyFaultForwardSoftLim() {
- // Intentionally left blank
- return 0;
- }
-
- @Override
- public int getStickyFaultOverTemp() {
- // Intentionally left blank
- return 0;
- }
-
- @Override
- public int getStickyFaultReverseLim() {
- // Intentionally left blank
- return 0;
- }
-
- @Override
- public int getStickyFaultReverseSoftLim() {
- // Intentionally left blank
- return 0;
- }
-
- @Override
- public int getStickyFaultUnderVoltage() {
- // Intentionally left blank
- return 0;
- }
-
- @Override
- public double getP() {
- return this.profiles.getOrDefault(currentProfile, defaultParams).p;
- }
-
- @Override
- public double getI() {
- return this.profiles.getOrDefault(currentProfile, defaultParams).i;
- }
-
- @Override
- public double getD() {
- return this.profiles.getOrDefault(currentProfile, defaultParams).d;
- }
-
- @Override
- public double getF() {
- return this.profiles.getOrDefault(currentProfile, defaultParams).f;
- }
-
- @Override
- public void setP(double p) {
- initCurrentProfileParams();
- this.profiles.get(currentProfile).p = p;
- }
-
- @Override
- public void setI(double i) {
- initCurrentProfileParams();
- this.profiles.get(currentProfile).i = i;
- }
-
- @Override
- public void setD(double d) {
- initCurrentProfileParams();
- this.profiles.get(currentProfile).d = d;
- }
-
- @Override
- public void setF(double f) {
- initCurrentProfileParams();
- this.profiles.get(currentProfile).f = f;
-
- }
-
- @Override
- public void setPID(double p, double i, double d) {
- this.setP(p);
- this.setI(i);
- this.setD(d);
- }
-
- @Override
- public void clearIAccum() {
- // Intentionally left blank. The mock implementation does not use full PID.
- }
-
- @Override
- public int getClosedLoopError() {
- if(internalEncoder == null) {
- return 0;
- }
-
- double currentPos;
- if(controlMode == TalonControlMode.Position) {
- currentPos = internalEncoder.getAdjustedDistance();
- }
- else if (controlMode == TalonControlMode.Speed) {
- currentPos = internalEncoder.getAdjustedRate();
- }
- else {
- return 0;
- }
-
- return (int)(setpoint - currentPos);
- }
-
- @Override
- public void setAllowableClosedLoopError(int allowableError) {
- // Intentionally left blank. No point in doing the extra math in the mock impl.
- }
-
- @Override
- public double getIZone() {
- // There isn't a full PID implementation here, so we don't need windup prevention
- return Double.POSITIVE_INFINITY;
- }
-
- @Override
- public void setIZone(int iZone) {
- // Intentionally left blank.
- }
-
- @Override
- public long getIAccum() {
- // No full PID impl. in mock
- return 0;
- }
-
- @Override
- public void setClosedLoopRampRate(double rampRate) {
- // Intentionally left blank. The mock implementation does not handle ramping.
- }
-/*
- @Override
- public FeedbackDeviceStatus isSensorPresent(FeedbackDevice feedbackDevice) {
- // The mock implementation only supports quadrature encoders
- return feedbackDevice == FeedbackDevice.QuadEncoder ? FeedbackDeviceStatus.FeedbackStatusPresent : FeedbackDeviceStatus.FeedbackStatusNotPresent;
- }
-
- @Override
- public void setFeedbackDevice(FeedbackDevice device) {
- if(device == FeedbackDevice.QuadEncoder) {
- this.internalEncoder = new MockEncoder(propMan);
- }
- }
-
- @Override
- public void configEncoderCodesPerRev(int codesPerRev) {
- // This value isn't used and there is no getter that needs it, so we can ignore it.
- }
-
- @Override
- public void configPotentiometerTurns(int turns) {
- // Intentionally left blank. The mock implementation only supports quadrature encoders.
- }
-
- @Override
- public double getPosition() {
- if(internalEncoder == null) {
- log.warn("Position requested before setting feedback device!");
- return 0;
- }
-
- return internalEncoder.getAdjustedDistance();
- }
-
- @Override
- public void setPosition(double pos) {
- if(internalEncoder == null) {
- log.warn("Position set before setting feedback device!");
- }
- else {
- ((MockEncoder)internalEncoder).setDistance(pos);
- }
- }
-
- @Override
- public double getSpeed() {
- if(internalEncoder == null) {
- log.warn("Speed requested before setting feedback device!");
- return 0;
- }
-
- return this.getEncoderSpeed();
- }
-
- @Override
- public int getAnalogPosition() {
- // Analog feedback sensors aren't supported by mock impl.
- return 0;
- }
-
- @Override
- public void setAnalogPosition(int newPosition) {
- // Intentionally left blank. Analog feedback sensors aren't supported by mock impl.
- }
-
- @Override
- public int getAnalogPositionRaw() {
- // Analog feedback sensors aren't supported by mock impl.
- return 0;
- }
-
- @Override
- public int getAnalogSpeed() {
- // Analog feedback sensors aren't supported by mock impl.
- return 0;
- }
-
- @Override
- public int getEncoderPosition() {
- return internalEncoder == null ? 0 : (int) internalEncoder.getAdjustedDistance();
- }
-
- @Override
- public void setEncoderPosition(int newPosition) {
- if(internalEncoder == null) {
- // Because the nullity of internalEncoder is used to determine whether a
- // feedback device has been chosen, initializing it here will have the
- // unintended side-effect of no longer warning about an unset sensor.
- internalEncoder = new MockEncoder(propMan);
- }
-
- ((MockEncoder)internalEncoder).setDistance(newPosition);
- }
-
- @Override
- public int getEncoderSpeed() {
- return internalEncoder == null ? 0 : (int) internalEncoder.getAdjustedRate();
- }
-
- @Override
- public void reverseSensor(boolean flip) {
- if(internalEncoder != null) {
- internalEncoder.setInverted(flip);
- }
- }
-
- @Override
- public void enableZeroSensorPositionOnIndex(boolean enable, boolean risingEdge) {
- // Intentionally left blank. Mock does not implement index pin.
- }
-
- @Override
- public int getNumberOfQuadIndexRises() {
- // Mock does not implement index pin.
- return 0;
- }
-
- @Override
- public boolean getInverted() {
- return outputInverted;
- }
-
- @Override
- public void setInverted(boolean isInverted) {
- this.outputInverted = isInverted;
- }
-
- @Override
- public void setVoltageCompensationRampRate(double rampRate) {
- // Intentionally left blank. Mock impl. doesn't support ramping.
- }
-
- @Override
- public void configNominalOutputVoltage(double forwardVoltage, double reverseVoltage) {
- // Intentionally left blank. Min output voltages aren't necessary in mock environment.
- }
-
- @Override
- public void configPeakOutputVoltage(double forwardVoltage, double reverseVoltage) {
- // Intentionally left blank. Max output voltages aren't necessary in mock environment.
- }
-
- @Override
- public int getForwardSoftLimit() {
- // Soft limits aren't implemented in mock environment.
- return Integer.MAX_VALUE;
- }
-
- @Override
- public int getReverseSoftLimit() {
- // Soft limits aren't implemented in mock environment.
- return Integer.MIN_VALUE;
- }
-
- @Override
- public void setForwardSoftLimit(double forwardLimit) {
- // Intentionally left blank. Soft limits aren't implemented in mock environment.
- }
-
- @Override
- public void setReverseSoftLimit(double reverseLimit) {
- // Intentionally left blank. Soft limits aren't implemented in mock environment.
- }
-
- @Override
- public boolean isForwardSoftLimitEnabled() {
- // Soft limits aren't implemented in mock environment.
- return false;
- }
-
- @Override
- public boolean isReverseSoftLimitEnabled() {
- // Soft limits aren't implemented in mock environment.
- return false;
- }
-
- @Override
- public void enableForwardSoftLimit(boolean enable) {
- // Intentionally left blank. Soft limits aren't implemented in mock environment.
- }
-
- @Override
- public void enableReverseSoftLimit(boolean enable) {
- // Intentionally left blank. Soft limits aren't implemented in mock environment.
- }
-
- @Override
- public void enableLimitSwitches(boolean forwardEnabled, boolean reverseEnabled) {
- // Intentionally left blank. Limit switches aren't implemented in mock environment.
- }
-
- @Override
- public boolean isForwardLimitSwitchClosed() {
- // Limit switches aren't implemented in mock environment.
- return false;
- }
-
- @Override
- public boolean isReverseLimitSwitchClosed() {
- // Limit switches aren't implemented in mock environment.
- return false;
- }
-
- @Override
- public void configForwardLimitSwitchNormallyOpen(boolean normallyOpen) {
- // Intentionally left blank. Limit switches aren't implemented in mock environment.
- }
-
- @Override
- public void configReverseLimitSwitchNormallyOpen(boolean normallyOpen) {
- // Intentionally left blank. Limit switches aren't implemented in mock environment.
- }
-
- @Override
- public double get() {
- switch(controlMode) {
- case Disabled:
- return 0;
- case Voltage:
- return getOutputVoltage();
- case PercentVbus:
- return setpoint;
- case Current:
- return this.getOutputCurrent();
- case MotionProfile:
- // This mode isn't supported in by the mock implementation (nor the real one)
- return 0;
- case Speed:
- return this.getSpeed();
- case Position:
- return this.getPosition();
- case Follower:
- MockCANTalon master = mockRobotIO.getCANTalon((int)setpoint);
- return master.getOutputVoltage() / master.getBusVoltage()
- * getClosedLoopOutputInversionFactor();
- default:
- return 0;
- }
- }
-
-
- public double getSetpoint() {
- return setpoint;
- }
-
- @Override
- public void set(double outputValue) {
- this.setpoint = outputValue;
-
- switch(controlMode) {
- case Disabled:
- throttlePercent = 0;
- break;
- case Voltage:
- throttlePercent = setpoint / this.getBusVoltage();
- break;
- case PercentVbus:
- throttlePercent = MathUtils.constrainDouble(setpoint, -1, 1);
- break;
- case Current:
- // Guess voltage by assuming a linear relationship between current and voltage, bypassing PID
- throttlePercent = setpoint / MockRobotIO.NOMINAL_MOTOR_CURRENT;
- break;
- case MotionProfile:
- // This mode isn't supported in by the mock implementation (nor the real one)
- throttlePercent = 0;
- break;
- case Speed:
- case Position:
- if(!Double.isFinite(this.getP())) {
- throttlePercent = 0;
- }
- else {
- // Highly efficient P(IDF) implementation
- throttlePercent = this.getClosedLoopError() * this.getP();
- }
- break;
- case Follower:
- throttlePercent = mockRobotIO.getCANTalon((int)setpoint).getThrottlePercent();
- break;
- default:
- throttlePercent = 0;
- }
-
- mockRobotIO.setPWM(-deviceId, this.getOutputVoltage() / this.getBusVoltage());
- }
-
- @Override
- public void enableCurrentLimit(boolean enable) {
- // no op
- }
-
- @Override
- public void setCurrentLimit(int amps) {
- // no op
- }
-
- public void reverseOutput(boolean isInverted) {
- closedLoopOutputInverted = isInverted;
- }
-
- private double getClosedLoopOutputInversionFactor() {
- return closedLoopOutputInverted ? 1 : -1;
- }
-}
-*/
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/actuators/mock_adapters/MockRelay.java b/src/main/java/xbot/common/controls/actuators/mock_adapters/MockRelay.java
deleted file mode 100644
index 88b760ea..00000000
--- a/src/main/java/xbot/common/controls/actuators/mock_adapters/MockRelay.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package xbot.common.controls.actuators.mock_adapters;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import edu.wpi.first.wpilibj.Relay.Value;
-import xbot.common.controls.actuators.XRelay;
-import xbot.common.injection.DevicePolice;
-
-public class MockRelay extends XRelay {
-
- private Value internalValue;
-
- @AssistedFactory
- public abstract static class MockRelayFactory implements XRelayFactory {
- public abstract MockRelay create(@Assisted("channel") int channel);
- }
-
- @AssistedInject
- public MockRelay(@Assisted("channel") int channel, DevicePolice police) {
- super(channel, police);
-
- internalValue = Value.kOff;
- }
- @Override
- public void set(Value value) {
- internalValue = value;
- }
-
- public Value get() {
- return internalValue;
- }
-
-}
diff --git a/src/main/java/xbot/common/controls/actuators/wpi_adapters/CANSparkMaxWpiAdapter.java b/src/main/java/xbot/common/controls/actuators/wpi_adapters/CANSparkMaxWpiAdapter.java
deleted file mode 100644
index 7524fa9c..00000000
--- a/src/main/java/xbot/common/controls/actuators/wpi_adapters/CANSparkMaxWpiAdapter.java
+++ /dev/null
@@ -1,599 +0,0 @@
-package xbot.common.controls.actuators.wpi_adapters;
-
-import com.revrobotics.CANSparkMax;
-import com.revrobotics.CANSparkMax.ControlType;
-import com.revrobotics.CANSparkMax.ExternalFollower;
-import com.revrobotics.CANSparkMax.FaultID;
-import com.revrobotics.CANSparkMax.IdleMode;
-import com.revrobotics.CANSparkMax.SoftLimitDirection;
-import com.revrobotics.CANSparkMaxLowLevel.MotorType;
-import com.revrobotics.CANSparkMaxLowLevel.PeriodicFrame;
-import com.revrobotics.MotorFeedbackSensor;
-import com.revrobotics.REVLibError;
-import com.revrobotics.RelativeEncoder;
-import com.revrobotics.SparkMaxAnalogSensor;
-import com.revrobotics.SparkMaxAnalogSensor.Mode;
-import com.revrobotics.SparkMaxLimitSwitch;
-import com.revrobotics.SparkMaxPIDController;
-import com.revrobotics.SparkMaxPIDController.AccelStrategy;
-import com.revrobotics.SparkMaxPIDController.ArbFFUnits;
-import com.revrobotics.SparkMaxRelativeEncoder.Type;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-import xbot.common.controls.actuators.XCANSparkMax;
-import xbot.common.controls.actuators.XCANSparkMaxPIDProperties;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.electrical_contract.DeviceInfo;
-import xbot.common.properties.PropertyFactory;
-
-public class CANSparkMaxWpiAdapter extends XCANSparkMax {
-
- private CANSparkMax internalSpark;
-
- @AssistedFactory
- public abstract static class CANSparkMaxWpiAdapterFactory extends XCANSparkMaxFactory {
- public abstract CANSparkMaxWpiAdapter create(
- @Assisted("deviceInfo") DeviceInfo deviceInfo,
- @Assisted("owningSystemPrefix") String owningSystemPrefix,
- @Assisted("name") String name,
- @Assisted("defaultPIDProperties") XCANSparkMaxPIDProperties defaultPIDProperties);
- }
-
- @AssistedInject
- public CANSparkMaxWpiAdapter(@Assisted("deviceInfo") DeviceInfo deviceInfo,
- @Assisted("owningSystemPrefix") String owningSystemPrefix, @Assisted("name") String name,
- PropertyFactory propMan, DevicePolice police,
- @Assisted("defaultPIDProperties") XCANSparkMaxPIDProperties defaultPIDProperties) {
- super(deviceInfo, owningSystemPrefix, name, propMan, police, defaultPIDProperties);
- internalSpark = new CANSparkMax(deviceInfo.channel, MotorType.kBrushless);
- setInverted(deviceInfo.inverted);
- }
-
- @Override
- public CANSparkMax getInternalSparkMax() {
- return internalSpark;
- }
-
- public void close() {
- internalSpark.close();
- }
-
- @Override
- public REVLibError follow(XCANSparkMax leader) {
- return internalSpark.follow(leader.getInternalSparkMax());
- }
-
- @Override
- public REVLibError follow(XCANSparkMax leader, boolean invert) {
- return internalSpark.follow(leader.getInternalSparkMax(), invert);
- }
-
- public REVLibError follow(CANSparkMax leader) {
- return internalSpark.follow(leader);
- }
-
- public REVLibError follow(CANSparkMax leader, boolean invert) {
- return internalSpark.follow(leader, invert);
- }
-
- public REVLibError follow(ExternalFollower leader, int deviceID) {
- return internalSpark.follow(leader, deviceID);
- }
-
- public REVLibError follow(ExternalFollower leader, int deviceID, boolean invert) {
- return internalSpark.follow(leader, deviceID, invert);
- }
-
- public int getFirmwareVersion() {
- return internalSpark.getFirmwareVersion();
- }
-
- public void setControlFramePeriodMs(int periodMs) {
- internalSpark.setControlFramePeriodMs(periodMs);
- }
-
- public String getFirmwareString() {
- return internalSpark.getFirmwareString();
- }
-
- public byte[] getSerialNumber() {
- return internalSpark.getSerialNumber();
- }
-
- public int getDeviceId() {
- return internalSpark.getDeviceId();
- }
-
- public void stopMotor() {
- internalSpark.stopMotor();
- }
-
- public MotorType getMotorType() {
- return internalSpark.getMotorType();
- }
-
- public REVLibError setPeriodicFramePeriod(PeriodicFrame frame, int periodMs) {
- return internalSpark.setPeriodicFramePeriod(frame, periodMs);
- }
-
- public float getSafeFloat(float f) {
- return internalSpark.getSafeFloat(f);
- }
-
- public int hashCode() {
- return internalSpark.hashCode();
- }
-
- public void set(double speed) {
- internalSpark.set(speed);
- }
-
- public void setVoltage(double outputVolts) {
- internalSpark.setVoltage(outputVolts);
- }
-
- public double get() {
- return internalSpark.get();
- }
-
- public void setInverted(boolean isInverted) {
- internalSpark.setInverted(isInverted);
- }
-
- public boolean getInverted() {
- return internalSpark.getInverted();
- }
-
- public void disable() {
- internalSpark.disable();
- }
-
- public RelativeEncoder getEncoder(Type encoderType, int countsPerRev) {
- return internalSpark.getEncoder(encoderType, countsPerRev);
- }
-
- public RelativeEncoder getAlternateEncoder(int countsPerRev) {
- return internalSpark.getAlternateEncoder(countsPerRev);
- }
-
- public RelativeEncoder getAlternateEncoder(com.revrobotics.SparkMaxAlternateEncoder.Type encoderType,
- int countsPerRev) {
- return internalSpark.getAlternateEncoder(encoderType, countsPerRev);
- }
-
- public REVLibError restoreFactoryDefaults() {
- return internalSpark.restoreFactoryDefaults();
- }
-
- public REVLibError restoreFactoryDefaults(boolean persist) {
- return internalSpark.restoreFactoryDefaults(persist);
- }
-
- public SparkMaxAnalogSensor getAnalog(Mode mode) {
- return internalSpark.getAnalog(mode);
- }
-
- public SparkMaxPIDController getPIDController() {
- return internalSpark.getPIDController();
- }
-
- public SparkMaxLimitSwitch getForwardLimitSwitch(com.revrobotics.SparkMaxLimitSwitch.Type switchType) {
- return internalSpark.getForwardLimitSwitch(switchType);
- }
-
- public SparkMaxLimitSwitch getReverseLimitSwitch(com.revrobotics.SparkMaxLimitSwitch.Type switchType) {
- return internalSpark.getReverseLimitSwitch(switchType);
- }
-
- public REVLibError setSmartCurrentLimit(int limit) {
- return internalSpark.setSmartCurrentLimit(limit);
- }
-
- public REVLibError setSmartCurrentLimit(int stallLimit, int freeLimit) {
- return internalSpark.setSmartCurrentLimit(stallLimit, freeLimit);
- }
-
- public REVLibError setSmartCurrentLimit(int stallLimit, int freeLimit, int limitRPM) {
- return internalSpark.setSmartCurrentLimit(stallLimit, freeLimit, limitRPM);
- }
-
- public REVLibError setSecondaryCurrentLimit(double limit) {
- return internalSpark.setSecondaryCurrentLimit(limit);
- }
-
- public REVLibError setSecondaryCurrentLimit(double limit, int chopCycles) {
- return internalSpark.setSecondaryCurrentLimit(limit, chopCycles);
- }
-
- public REVLibError setIdleMode(IdleMode mode) {
- return internalSpark.setIdleMode(mode);
- }
-
- public IdleMode getIdleMode() {
- return internalSpark.getIdleMode();
- }
-
- public REVLibError enableVoltageCompensation(double nominalVoltage) {
- return internalSpark.enableVoltageCompensation(nominalVoltage);
- }
-
- public REVLibError disableVoltageCompensation() {
- return internalSpark.disableVoltageCompensation();
- }
-
- public double getVoltageCompensationNominalVoltage() {
- return internalSpark.getVoltageCompensationNominalVoltage();
- }
-
- public REVLibError setOpenLoopRampRate(double rate) {
- return internalSpark.setOpenLoopRampRate(rate);
- }
-
- public REVLibError setClosedLoopRampRate(double rate) {
- return internalSpark.setClosedLoopRampRate(rate);
- }
-
- public double getOpenLoopRampRate() {
- return internalSpark.getOpenLoopRampRate();
- }
-
- public double getClosedLoopRampRate() {
- return internalSpark.getClosedLoopRampRate();
- }
-
- public boolean isFollower() {
- return internalSpark.isFollower();
- }
-
- public short getFaults() {
- return internalSpark.getFaults();
- }
-
- public short getStickyFaults() {
- return internalSpark.getStickyFaults();
- }
-
- public boolean getFault(FaultID faultID) {
- return internalSpark.getFault(faultID);
- }
-
- public boolean getStickyFault(FaultID faultID) {
- return internalSpark.getStickyFault(faultID);
- }
-
- public double getBusVoltage() {
- return internalSpark.getBusVoltage();
- }
-
- public double getAppliedOutput() {
- return internalSpark.getAppliedOutput();
- }
-
- public double getOutputCurrent() {
- return internalSpark.getOutputCurrent();
- }
-
- public double getMotorTemperature() {
- return internalSpark.getMotorTemperature();
- }
-
- public REVLibError clearFaults() {
- return internalSpark.clearFaults();
- }
-
- public REVLibError burnFlash() {
- return internalSpark.burnFlash();
- }
-
- public REVLibError setCANTimeout(int milliseconds) {
- return internalSpark.setCANTimeout(milliseconds);
- }
-
- public REVLibError enableSoftLimit(SoftLimitDirection direction, boolean enable) {
- return internalSpark.enableSoftLimit(direction, enable);
- }
-
- public REVLibError setSoftLimit(SoftLimitDirection direction, float limit) {
- return internalSpark.setSoftLimit(direction, limit);
- }
-
- public double getSoftLimit(SoftLimitDirection direction) {
- return internalSpark.getSoftLimit(direction);
- }
-
- public boolean isSoftLimitEnabled(SoftLimitDirection direction) {
- return internalSpark.isSoftLimitEnabled(direction);
- }
-
- public REVLibError getLastError() {
- return internalSpark.getLastError();
- }
-
- RelativeEncoder ce;
- public double getPosition() {
- return getEncoderInstance().getPosition();
- }
-
- public double getVelocity() {
- return getEncoderInstance().getVelocity();
- }
-
- public REVLibError setPosition(double position) {
- return getEncoderInstance().setPosition(position);
- }
-
- public REVLibError setPositionConversionFactor(double factor) {
- return getEncoderInstance().setPositionConversionFactor(factor);
- }
-
- public REVLibError setVelocityConversionFactor(double factor) {
- return getEncoderInstance().setVelocityConversionFactor(factor);
- }
-
- public double getPositionConversionFactor() {
- return getEncoderInstance().getPositionConversionFactor();
- }
-
- public double getVelocityConversionFactor() {
- return getEncoderInstance().getVelocityConversionFactor();
- }
-
- public REVLibError setAverageDepth(int depth) {
- return getEncoderInstance().setAverageDepth(depth);
- }
-
- public int getAverageDepth() {
- return getEncoderInstance().getAverageDepth();
- }
-
- public REVLibError setMeasurementPeriod(int period_ms) {
- return getEncoderInstance().setMeasurementPeriod(period_ms);
- }
-
- public int getMeasurementPeriod() {
- return getEncoderInstance().getMeasurementPeriod();
- }
-
- public int getCountsPerRevolution() {
- return getEncoderInstance().getCountsPerRevolution();
- }
-
- public REVLibError setEncoderInverted(boolean inverted) {
- return getEncoderInstance().setInverted(inverted);
- }
-
- private RelativeEncoder getEncoderInstance() {
- if (ce == null) {
- ce = internalSpark.getEncoder();
- }
- return ce;
- }
-
- SparkMaxPIDController pc;
-
- private SparkMaxPIDController getPIDControllerInstance() {
- if (pc==null) {
- pc = internalSpark.getPIDController();
- }
- return pc;
- }
-
- public REVLibError setP(double gain) {
- return getPIDControllerInstance().setP(gain);
- }
-
- public REVLibError setP(double gain, int slotID) {
- return getPIDControllerInstance().setP(gain, slotID);
- }
-
- public REVLibError setI(double gain) {
- return getPIDControllerInstance().setI(gain);
- }
-
- public REVLibError setI(double gain, int slotID) {
- return getPIDControllerInstance().setI(gain, slotID);
- }
-
- public REVLibError setD(double gain) {
- return getPIDControllerInstance().setD(gain);
- }
-
- public REVLibError setD(double gain, int slotID) {
- return getPIDControllerInstance().setD(gain, slotID);
- }
-
- public REVLibError setDFilter(double gain) {
- return getPIDControllerInstance().setDFilter(gain);
- }
-
- public REVLibError setDFilter(double gain, int slotID) {
- return getPIDControllerInstance().setDFilter(gain, slotID);
- }
-
- public REVLibError setFF(double gain) {
- return getPIDControllerInstance().setFF(gain);
- }
-
- public REVLibError setFF(double gain, int slotID) {
- return getPIDControllerInstance().setFF(gain, slotID);
- }
-
- public REVLibError setIZone(double iZone) {
- return getPIDControllerInstance().setIZone(iZone);
- }
-
- public REVLibError setIZone(double iZone, int slotID) {
- return getPIDControllerInstance().setIZone(iZone, slotID);
- }
-
- public REVLibError setOutputRange(double min, double max) {
- return getPIDControllerInstance().setOutputRange(min, max);
- }
-
- public REVLibError setOutputRange(double min, double max, int slotID) {
- return getPIDControllerInstance().setOutputRange(min, max, slotID);
- }
-
- public double getP() {
- return getPIDControllerInstance().getP();
- }
-
- public double getP(int slotID) {
- return getPIDControllerInstance().getP(slotID);
- }
-
- public double getI() {
- return getPIDControllerInstance().getI();
- }
-
- public double getI(int slotID) {
- return getPIDControllerInstance().getI(slotID);
- }
-
- public double getD() {
- return getPIDControllerInstance().getD();
- }
-
- public double getD(int slotID) {
- return getPIDControllerInstance().getD(slotID);
- }
-
- public double getDFilter(int slotID) {
- return getPIDControllerInstance().getDFilter(slotID);
- }
-
- public double getFF() {
- return getPIDControllerInstance().getFF();
- }
-
- public double getFF(int slotID) {
- return getPIDControllerInstance().getFF(slotID);
- }
-
- public double getIZone() {
- return getPIDControllerInstance().getIZone();
- }
-
- public double getIZone(int slotID) {
- return getPIDControllerInstance().getIZone(slotID);
- }
-
- public double getOutputMin() {
- return getPIDControllerInstance().getOutputMin();
- }
-
- public double getOutputMin(int slotID) {
- return getPIDControllerInstance().getOutputMin(slotID);
- }
-
- public double getOutputMax() {
- return getPIDControllerInstance().getOutputMax();
- }
-
- public double getOutputMax(int slotID) {
- return getPIDControllerInstance().getOutputMax(slotID);
- }
-
- public REVLibError setSmartMotionMaxVelocity(double maxVel, int slotID) {
- return getPIDControllerInstance().setSmartMotionMaxVelocity(maxVel, slotID);
- }
-
- public REVLibError setSmartMotionMaxAccel(double maxAccel, int slotID) {
- return getPIDControllerInstance().setSmartMotionMaxAccel(maxAccel, slotID);
- }
-
- public REVLibError setSmartMotionMinOutputVelocity(double minVel, int slotID) {
- return getPIDControllerInstance().setSmartMotionMinOutputVelocity(minVel, slotID);
- }
-
- public REVLibError setSmartMotionAllowedClosedLoopError(double allowedErr, int slotID) {
- return getPIDControllerInstance().setSmartMotionAllowedClosedLoopError(allowedErr, slotID);
- }
-
- public REVLibError setSmartMotionAccelStrategy(AccelStrategy accelStrategy, int slotID) {
- return getPIDControllerInstance().setSmartMotionAccelStrategy(accelStrategy, slotID);
- }
-
- public double getSmartMotionMaxVelocity(int slotID) {
- return getPIDControllerInstance().getSmartMotionMaxVelocity(slotID);
- }
-
- public double getSmartMotionMaxAccel(int slotID) {
- return getPIDControllerInstance().getSmartMotionMaxAccel(slotID);
- }
-
- public double getSmartMotionMinOutputVelocity(int slotID) {
- return getPIDControllerInstance().getSmartMotionMinOutputVelocity(slotID);
- }
-
- public double getSmartMotionAllowedClosedLoopError(int slotID) {
- return getPIDControllerInstance().getSmartMotionAllowedClosedLoopError(slotID);
- }
-
- public AccelStrategy getSmartMotionAccelStrategy(int slotID) {
- return getPIDControllerInstance().getSmartMotionAccelStrategy(slotID);
- }
-
- public REVLibError setIMaxAccum(double iMaxAccum, int slotID) {
- return getPIDControllerInstance().setIMaxAccum(iMaxAccum, slotID);
- }
-
- public double getIMaxAccum(int slotID) {
- return getPIDControllerInstance().getIMaxAccum(slotID);
- }
-
- public REVLibError setIAccum(double iAccum) {
- return getPIDControllerInstance().setIAccum(iAccum);
- }
-
- public double getIAccum() {
- return getPIDControllerInstance().getIAccum();
- }
-
- public REVLibError setFeedbackDevice(MotorFeedbackSensor sensor) {
- return getPIDControllerInstance().setFeedbackDevice(sensor);
- }
-
- public REVLibError setReference(double value, ControlType ctrl) {
- return getPIDControllerInstance().setReference(value, ctrl);
- }
-
- public REVLibError setReference(double value, ControlType ctrl, int pidSlot) {
- return getPIDControllerInstance().setReference(value, ctrl, pidSlot);
- }
-
- public REVLibError setReference(double value, ControlType ctrl, int pidSlot, double arbFeedforward) {
- return getPIDControllerInstance().setReference(value, ctrl, pidSlot, arbFeedforward);
- }
-
- public REVLibError setReference(double value, ControlType ctrl, int pidSlot, double arbFeedforward,
- ArbFFUnits arbFFUnits) {
- return getPIDControllerInstance().setReference(value, ctrl, pidSlot, arbFeedforward, arbFFUnits);
- }
-
- public String toString() {
- return getPIDControllerInstance().toString();
- }
-
- @Override
- public void setForwardLimitSwitch(com.revrobotics.SparkMaxLimitSwitch.Type switchType, boolean enabled) {
- internalSpark.getForwardLimitSwitch(switchType).enableLimitSwitch(enabled);
- }
-
- @Override
- public void setReverseLimitSwitch(com.revrobotics.SparkMaxLimitSwitch.Type switchType, boolean enabled) {
- internalSpark.getReverseLimitSwitch(switchType).enableLimitSwitch(enabled);
- }
-
- @Override
- public boolean getForwardLimitSwitchPressed(com.revrobotics.SparkMaxLimitSwitch.Type switchType) {
- return internalSpark.getForwardLimitSwitch(switchType).isPressed();
- }
-
- @Override
- public boolean getReverseLimitSwitchPressed(com.revrobotics.SparkMaxLimitSwitch.Type switchType) {
- return internalSpark.getReverseLimitSwitch(switchType).isPressed();
- }
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/actuators/wpi_adapters/CANTalonWPIAdapter.java b/src/main/java/xbot/common/controls/actuators/wpi_adapters/CANTalonWPIAdapter.java
deleted file mode 100644
index 28115b81..00000000
--- a/src/main/java/xbot/common/controls/actuators/wpi_adapters/CANTalonWPIAdapter.java
+++ /dev/null
@@ -1,580 +0,0 @@
-package xbot.common.controls.actuators.wpi_adapters;
-
-import com.ctre.phoenix.ErrorCode;
-import com.ctre.phoenix.ParamEnum;
-import com.ctre.phoenix.motion.MotionProfileStatus;
-import com.ctre.phoenix.motion.TrajectoryPoint;
-import com.ctre.phoenix.motorcontrol.ControlFrame;
-import com.ctre.phoenix.motorcontrol.ControlMode;
-import com.ctre.phoenix.motorcontrol.DemandType;
-import com.ctre.phoenix.motorcontrol.Faults;
-import com.ctre.phoenix.motorcontrol.FeedbackDevice;
-import com.ctre.phoenix.motorcontrol.IMotorController;
-import com.ctre.phoenix.motorcontrol.InvertType;
-import com.ctre.phoenix.motorcontrol.LimitSwitchNormal;
-import com.ctre.phoenix.motorcontrol.LimitSwitchSource;
-import com.ctre.phoenix.motorcontrol.NeutralMode;
-import com.ctre.phoenix.motorcontrol.RemoteFeedbackDevice;
-import com.ctre.phoenix.motorcontrol.RemoteLimitSwitchSource;
-import com.ctre.phoenix.motorcontrol.RemoteSensorSource;
-import com.ctre.phoenix.motorcontrol.SensorCollection;
-import com.ctre.phoenix.motorcontrol.SensorTerm;
-import com.ctre.phoenix.motorcontrol.StatusFrame;
-import com.ctre.phoenix.motorcontrol.StatusFrameEnhanced;
-import com.ctre.phoenix.motorcontrol.StickyFaults;
-import com.ctre.phoenix.motorcontrol.SupplyCurrentLimitConfiguration;
-import com.ctre.phoenix.motorcontrol.can.BaseTalon;
-import com.ctre.phoenix.motorcontrol.can.TalonSRX;
-import com.ctre.phoenix.sensors.CANCoder;
-import com.ctre.phoenix.sensors.SensorVelocityMeasPeriod;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import xbot.common.controls.actuators.XCANTalon;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.electrical_contract.CANTalonInfo;
-import xbot.common.properties.PropertyFactory;
-
-public class CANTalonWPIAdapter extends XCANTalon {
-
- private TalonSRX internalTalon;
- SensorCollection sensorCollection;
-
- @AssistedFactory
- public abstract static class CANTalonWPIAdapterFactory implements XCANTalonFactory {
- public abstract CANTalonWPIAdapter create(@Assisted("deviceInfo") CANTalonInfo deviceInfo);
- }
-
- @AssistedInject
- public CANTalonWPIAdapter(@Assisted("deviceInfo") CANTalonInfo deviceInfo, PropertyFactory propMan, DevicePolice police) {
- super(deviceInfo.channel, propMan, police);
- internalTalon = new TalonSRX(deviceInfo.channel);
- setInverted(deviceInfo.inverted);
- if (deviceInfo.feedbackDevice != null) {
- configSelectedFeedbackSensor(deviceInfo.feedbackDevice, 0, 0);
- setSensorPhase(deviceInfo.feedbackDeviceInverted);
- }
- }
-
- public ErrorCode setStatusFramePeriod(StatusFrameEnhanced frame, int periodMs, int timeoutMs) {
- return internalTalon.setStatusFramePeriod(frame, periodMs, timeoutMs);
- }
-
- public int getStatusFramePeriod(StatusFrameEnhanced frame, int timeoutMs) {
- return internalTalon.getStatusFramePeriod(frame, timeoutMs);
- }
-
- @SuppressWarnings("deprecation")
- public ErrorCode configVelocityMeasurementPeriod(com.ctre.phoenix.motorcontrol.VelocityMeasPeriod period, int timeoutMs) {
- return internalTalon.configVelocityMeasurementPeriod(period, timeoutMs);
- }
-
- public ErrorCode configVelocityMeasurementWindow(int windowSize, int timeoutMs) {
- return internalTalon.configVelocityMeasurementWindow(windowSize, timeoutMs);
- }
-
- public ErrorCode configForwardLimitSwitchSource(LimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int timeoutMs) {
- return internalTalon.configForwardLimitSwitchSource(type, normalOpenOrClose, timeoutMs);
- }
-
- public ErrorCode configReverseLimitSwitchSource(LimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int timeoutMs) {
- return internalTalon.configReverseLimitSwitchSource(type, normalOpenOrClose, timeoutMs);
- }
-
- public ErrorCode configPeakCurrentLimit(int amps, int timeoutMs) {
- return internalTalon.configPeakCurrentLimit(amps, timeoutMs);
- }
-
- public long getHandle() {
- return internalTalon.getHandle();
- }
-
- public int getDeviceID() {
- return internalTalon.getDeviceID();
- }
-
- public void set(ControlMode mode, double outputValue) {
- internalTalon.set(mode, outputValue);
- }
-
- public ErrorCode configPeakCurrentDuration(int milliseconds, int timeoutMs) {
- return internalTalon.configPeakCurrentDuration(milliseconds, timeoutMs);
- }
-
- public ErrorCode configContinuousCurrentLimit(int amps, int timeoutMs) {
- return internalTalon.configContinuousCurrentLimit(amps, timeoutMs);
- }
-/*
- public boolean equals(Object obj) {
- return internalTalon.equals(obj);
- }
-*/
- public void enableCurrentLimit(boolean enable) {
- internalTalon.enableCurrentLimit(enable);
- }
-
- public void neutralOutput() {
- internalTalon.neutralOutput();
- }
-
- public void setNeutralMode(NeutralMode neutralMode) {
- internalTalon.setNeutralMode(neutralMode);
- }
-
- public void setSensorPhase(boolean PhaseSensor) {
- internalTalon.setSensorPhase(PhaseSensor);
- }
-
- public void setInverted(boolean invert) {
- internalTalon.setInverted(invert);
- }
-
- public boolean getInverted() {
- return internalTalon.getInverted();
- }
-
- public ErrorCode configOpenloopRamp(double secondsFromNeutralToFull, int timeoutMs) {
- return internalTalon.configOpenloopRamp(secondsFromNeutralToFull, timeoutMs);
- }
-
- public ErrorCode configClosedloopRamp(double secondsFromNeutralToFull, int timeoutMs) {
- return internalTalon.configClosedloopRamp(secondsFromNeutralToFull, timeoutMs);
- }
-
- public ErrorCode configPeakOutputForward(double percentOut, int timeoutMs) {
- return internalTalon.configPeakOutputForward(percentOut, timeoutMs);
- }
-
- public ErrorCode configPeakOutputReverse(double percentOut, int timeoutMs) {
- return internalTalon.configPeakOutputReverse(percentOut, timeoutMs);
- }
-
- public ErrorCode configNominalOutputForward(double percentOut, int timeoutMs) {
- return internalTalon.configNominalOutputForward(percentOut, timeoutMs);
- }
-
- public ErrorCode configNominalOutputReverse(double percentOut, int timeoutMs) {
- return internalTalon.configNominalOutputReverse(percentOut, timeoutMs);
- }
-
- public String toString() {
- return internalTalon.toString();
- }
-
- public ErrorCode configNeutralDeadband(double percentDeadband, int timeoutMs) {
- return internalTalon.configNeutralDeadband(percentDeadband, timeoutMs);
- }
-
- public ErrorCode configVoltageCompSaturation(double voltage, int timeoutMs) {
- return internalTalon.configVoltageCompSaturation(voltage, timeoutMs);
- }
-
- public ErrorCode configVoltageMeasurementFilter(int filterWindowSamples, int timeoutMs) {
- return internalTalon.configVoltageMeasurementFilter(filterWindowSamples, timeoutMs);
- }
-
- public void enableVoltageCompensation(boolean enable) {
- internalTalon.enableVoltageCompensation(enable);
- }
-
- public double getBusVoltage() {
- return internalTalon.getBusVoltage();
- }
-
- public double getMotorOutputPercent() {
- return internalTalon.getMotorOutputPercent();
- }
-
- public double getMotorOutputVoltage() {
- return internalTalon.getMotorOutputVoltage();
- }
-
- public double getOutputCurrent() {
- return internalTalon.getStatorCurrent();
- }
-
- public double getTemperature() {
- return internalTalon.getTemperature();
- }
-
- public ErrorCode configSelectedFeedbackSensor(RemoteFeedbackDevice feedbackDevice, int pidIdx, int timeoutMs) {
- return internalTalon.configSelectedFeedbackSensor(feedbackDevice, pidIdx, timeoutMs);
- }
-
- public ErrorCode configSelectedFeedbackSensor(FeedbackDevice feedbackDevice, int pidIdx, int timeoutMs) {
- return internalTalon.configSelectedFeedbackSensor(feedbackDevice, pidIdx, timeoutMs);
- }
-
- public ErrorCode configRemoteFeedbackFilter(int deviceID, RemoteSensorSource remoteSensorSource, int remoteOrdinal,
- int timeoutMs) {
- return internalTalon.configRemoteFeedbackFilter(deviceID, remoteSensorSource, remoteOrdinal, timeoutMs);
- }
-
- public ErrorCode configSensorTerm(SensorTerm sensorTerm, FeedbackDevice feedbackDevice, int timeoutMs) {
- return internalTalon.configSensorTerm(sensorTerm, feedbackDevice, timeoutMs);
- }
-
- public double getSelectedSensorPosition(int pidIdx) {
- return internalTalon.getSelectedSensorPosition(pidIdx);
- }
-
- public double getSelectedSensorVelocity(int pidIdx) {
- return internalTalon.getSelectedSensorVelocity(pidIdx);
- }
-
- public ErrorCode setSelectedSensorPosition(int sensorPos, int pidIdx, int timeoutMs) {
- return internalTalon.setSelectedSensorPosition(sensorPos, pidIdx, timeoutMs);
- }
-
- public ErrorCode setControlFramePeriod(ControlFrame frame, int periodMs) {
- return internalTalon.setControlFramePeriod(frame, periodMs);
- }
-
- public ErrorCode setControlFramePeriod(int frame, int periodMs) {
- return internalTalon.setControlFramePeriod(frame, periodMs);
- }
-
- public ErrorCode setStatusFramePeriod(int frameValue, int periodMs, int timeoutMs) {
- return internalTalon.setStatusFramePeriod(frameValue, periodMs, timeoutMs);
- }
-
- public ErrorCode setStatusFramePeriod(StatusFrame frame, int periodMs, int timeoutMs) {
- return internalTalon.setStatusFramePeriod(frame, periodMs, timeoutMs);
- }
-
- public int getStatusFramePeriod(int frame, int timeoutMs) {
- return internalTalon.getStatusFramePeriod(frame, timeoutMs);
- }
-
- public int getStatusFramePeriod(StatusFrame frame, int timeoutMs) {
- return internalTalon.getStatusFramePeriod(frame, timeoutMs);
- }
-
- public ErrorCode configForwardLimitSwitchSource(RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int deviceID, int timeoutMs) {
- return internalTalon.configForwardLimitSwitchSource(type, normalOpenOrClose, deviceID, timeoutMs);
- }
-
- public ErrorCode configReverseLimitSwitchSource(RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int deviceID, int timeoutMs) {
- return internalTalon.configReverseLimitSwitchSource(type, normalOpenOrClose, deviceID, timeoutMs);
- }
-
- public void overrideLimitSwitchesEnable(boolean enable) {
- internalTalon.overrideLimitSwitchesEnable(enable);
- }
-
- public ErrorCode configForwardSoftLimitThreshold(int forwardSensorLimit, int timeoutMs) {
- return internalTalon.configForwardSoftLimitThreshold(forwardSensorLimit, timeoutMs);
- }
-
- public ErrorCode configReverseSoftLimitThreshold(int reverseSensorLimit, int timeoutMs) {
- return internalTalon.configReverseSoftLimitThreshold(reverseSensorLimit, timeoutMs);
- }
-
- public ErrorCode configForwardSoftLimitEnable(boolean enable, int timeoutMs) {
- return internalTalon.configForwardSoftLimitEnable(enable, timeoutMs);
- }
-
- public ErrorCode configReverseSoftLimitEnable(boolean enable, int timeoutMs) {
- return internalTalon.configReverseSoftLimitEnable(enable, timeoutMs);
- }
-
- public void overrideSoftLimitsEnable(boolean enable) {
- internalTalon.overrideSoftLimitsEnable(enable);
- }
-
- public boolean isFwdLimitSwitchClosed() {
- return internalTalon.getSensorCollection().isFwdLimitSwitchClosed();
- }
-
- public boolean isRevLimitSwitchClosed() {
- return internalTalon.getSensorCollection().isRevLimitSwitchClosed();
- }
-
- public ErrorCode config_kP(int slotIdx, double value, int timeoutMs) {
- return internalTalon.config_kP(slotIdx, value, timeoutMs);
- }
-
- public ErrorCode config_kI(int slotIdx, double value, int timeoutMs) {
- return internalTalon.config_kI(slotIdx, value, timeoutMs);
- }
-
- public ErrorCode config_kD(int slotIdx, double value, int timeoutMs) {
- return internalTalon.config_kD(slotIdx, value, timeoutMs);
- }
-
- public ErrorCode config_kF(int slotIdx, double value, int timeoutMs) {
- return internalTalon.config_kF(slotIdx, value, timeoutMs);
- }
-
- public ErrorCode config_IntegralZone(int slotIdx, int izone, int timeoutMs) {
- return internalTalon.config_IntegralZone(slotIdx, izone, timeoutMs);
- }
-
- public ErrorCode configAllowableClosedloopError(int slotIdx, int allowableClosedLoopError, int timeoutMs) {
- return internalTalon.configAllowableClosedloopError(slotIdx, allowableClosedLoopError, timeoutMs);
- }
-
- public ErrorCode configMaxIntegralAccumulator(int slotIdx, double iaccum, int timeoutMs) {
- return internalTalon.configMaxIntegralAccumulator(slotIdx, iaccum, timeoutMs);
- }
-
- public ErrorCode setIntegralAccumulator(double iaccum, int pidIdx, int timeoutMs) {
- return internalTalon.setIntegralAccumulator(iaccum, pidIdx, timeoutMs);
- }
-
- public double getClosedLoopError(int pidIdx) {
- return internalTalon.getClosedLoopError(pidIdx);
- }
-
- public double getIntegralAccumulator(int pidIdx) {
- return internalTalon.getIntegralAccumulator(pidIdx);
- }
-
- public double getErrorDerivative(int pidIdx) {
- return internalTalon.getErrorDerivative(pidIdx);
- }
-
- public void selectProfileSlot(int slotIdx, int pidIdx) {
- internalTalon.selectProfileSlot(slotIdx, pidIdx);
- }
-
- public double getActiveTrajectoryPosition() {
- return internalTalon.getActiveTrajectoryPosition();
- }
-
- public double getActiveTrajectoryVelocity() {
- return internalTalon.getActiveTrajectoryVelocity();
- }
-
- public ErrorCode configMotionCruiseVelocity(int sensorUnitsPer100ms, int timeoutMs) {
- return internalTalon.configMotionCruiseVelocity(sensorUnitsPer100ms, timeoutMs);
- }
-
- public ErrorCode configMotionAcceleration(int sensorUnitsPer100msPerSec, int timeoutMs) {
- return internalTalon.configMotionAcceleration(sensorUnitsPer100msPerSec, timeoutMs);
- }
-
- public ErrorCode clearMotionProfileTrajectories() {
- return internalTalon.clearMotionProfileTrajectories();
- }
-
- public int getMotionProfileTopLevelBufferCount() {
- return internalTalon.getMotionProfileTopLevelBufferCount();
- }
-
- public ErrorCode pushMotionProfileTrajectory(TrajectoryPoint trajPt) {
- return internalTalon.pushMotionProfileTrajectory(trajPt);
- }
-
- public boolean isMotionProfileTopLevelBufferFull() {
- return internalTalon.isMotionProfileTopLevelBufferFull();
- }
-
- public void processMotionProfileBuffer() {
- internalTalon.processMotionProfileBuffer();
- }
-
- public ErrorCode getMotionProfileStatus(MotionProfileStatus statusToFill) {
- return internalTalon.getMotionProfileStatus(statusToFill);
- }
-
- public ErrorCode clearMotionProfileHasUnderrun(int timeoutMs) {
- return internalTalon.clearMotionProfileHasUnderrun(timeoutMs);
- }
-
- public ErrorCode changeMotionControlFramePeriod(int periodMs) {
- return internalTalon.changeMotionControlFramePeriod(periodMs);
- }
-
- public ErrorCode getLastError() {
- return internalTalon.getLastError();
- }
-
- public ErrorCode getFaults(Faults toFill) {
- return internalTalon.getFaults(toFill);
- }
-
- public ErrorCode getStickyFaults(StickyFaults toFill) {
- return internalTalon.getStickyFaults(toFill);
- }
-
- public ErrorCode clearStickyFaults(int timeoutMs) {
- return internalTalon.clearStickyFaults(timeoutMs);
- }
-
- public int getFirmwareVersion() {
- return internalTalon.getFirmwareVersion();
- }
-
- public boolean hasResetOccurred() {
- return internalTalon.hasResetOccurred();
- }
-
- public ErrorCode configSetCustomParam(int newValue, int paramIndex, int timeoutMs) {
- return internalTalon.configSetCustomParam(newValue, paramIndex, timeoutMs);
- }
-
- public int configGetCustomParam(int paramIndex, int timoutMs) {
- return internalTalon.configGetCustomParam(paramIndex, timoutMs);
- }
-
- public ErrorCode configSetParameter(ParamEnum param, double value, int subValue, int ordinal, int timeoutMs) {
- return internalTalon.configSetParameter(param, value, subValue, ordinal, timeoutMs);
- }
-
- public ErrorCode configSetParameter(int param, double value, int subValue, int ordinal, int timeoutMs) {
- return internalTalon.configSetParameter(param, value, subValue, ordinal, timeoutMs);
- }
-
- public double configGetParameter(ParamEnum param, int ordinal, int timeoutMs) {
- return internalTalon.configGetParameter(param, ordinal, timeoutMs);
- }
-
- public double configGetParameter(int param, int ordinal, int timeoutMs) {
- return internalTalon.configGetParameter(param, ordinal, timeoutMs);
- }
-
- public int getBaseID() {
- return internalTalon.getBaseID();
- }
-
- public void follow(IMotorController masterToFollow) {
- internalTalon.follow(masterToFollow);
- }
-
- public void valueUpdated() {
- internalTalon.valueUpdated();
- }
-
- public SensorCollection getSensorCollection() {
- return internalTalon.getSensorCollection();
- }
-
- public ControlMode getControlMode() {
- return internalTalon.getControlMode();
- }
-
- @Override
- public void set(ControlMode Mode, double demand0, DemandType demand1Type, double demand1) {
- internalTalon.set(Mode, demand0, demand1Type, demand1);
- }
-
- @Override
- public ErrorCode configSelectedFeedbackCoefficient(double coefficient, int pidIdx, int timeoutMs) {
- return internalTalon.configSelectedFeedbackCoefficient(coefficient, pidIdx, timeoutMs);
- }
-
- @Override
- public ErrorCode configClosedLoopPeakOutput(int slotIdx, double percentOut, int timeoutMs) {
- return internalTalon.configClosedLoopPeakOutput(slotIdx, percentOut, timeoutMs);
- }
-
- @Override
- public ErrorCode configClosedLoopPeriod(int slotIdx, int loopTimeMs, int timeoutMs) {
- return internalTalon.configClosedLoopPeriod(slotIdx, loopTimeMs, timeoutMs);
- }
-
- @Override
- public ErrorCode configAuxPIDPolarity(boolean invert, int timeoutMs) {
- return internalTalon.configAuxPIDPolarity(invert, timeoutMs);
- }
-
- @Override
- public double getClosedLoopTarget(int pidIdx) {
- return internalTalon.getClosedLoopTarget(pidIdx);
- }
-
- @Override
- public ErrorCode configMotionProfileTrajectoryPeriod(int baseTrajDurationMs, int timeoutMs) {
- return internalTalon.configMotionProfileTrajectoryPeriod(baseTrajDurationMs, timeoutMs);
- }
-
- @Override
- public ErrorCode configMotionSCurveStrength(int curveStrength, int timeoutMs) {
- return internalTalon.configMotionSCurveStrength(curveStrength, timeoutMs);
- }
-
- private SensorCollection getSensorCollectionInstance() {
- if (sensorCollection == null) {
- sensorCollection = internalTalon.getSensorCollection();
- }
- return sensorCollection;
- }
-
- @Override
- public int getPulseWidthRiseToFallUs() {
- return getSensorCollectionInstance().getPulseWidthRiseToRiseUs();
- }
-
- @Override
- public ErrorCode configSupplyCurrentLimit(SupplyCurrentLimitConfiguration currLimitCfg, int timeoutMs) {
- return null;
- }
-
- @Override
- public void setInverted(InvertType invertType) {
-
- }
-
- @Override
- public ErrorCode configRemoteFeedbackFilter(CANCoder canCoderRef, int remoteOrdinal, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configRemoteFeedbackFilter(BaseTalon talonRef, int remoteOrdinal, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode setSelectedSensorPosition(double sensorPos, int pidIdx, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configForwardSoftLimitThreshold(double forwardSensorLimit, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configReverseSoftLimitThreshold(double reverseSensorLimit, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode config_IntegralZone(int slotIdx, double izone, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configAllowableClosedloopError(int slotIdx, double allowableCloseLoopError, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configMotionCruiseVelocity(double sensorUnitsPer100ms, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configMotionAcceleration(double sensorUnitsPer100msPerSec, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configVelocityMeasurementPeriod(SensorVelocityMeasPeriod period, int timeoutMs) {
- return null;
- }
-
- @Override
- public double getActiveTrajectoryHeading() {
- return 0;
- }
-
-}
diff --git a/src/main/java/xbot/common/controls/actuators/wpi_adapters/CANVictorSPXWpiAdapter.java b/src/main/java/xbot/common/controls/actuators/wpi_adapters/CANVictorSPXWpiAdapter.java
deleted file mode 100644
index f9919518..00000000
--- a/src/main/java/xbot/common/controls/actuators/wpi_adapters/CANVictorSPXWpiAdapter.java
+++ /dev/null
@@ -1,975 +0,0 @@
-package xbot.common.controls.actuators.wpi_adapters;
-
-import com.ctre.phoenix.ErrorCode;
-import com.ctre.phoenix.ParamEnum;
-import com.ctre.phoenix.motion.BufferedTrajectoryPointStream;
-import com.ctre.phoenix.motion.MotionProfileStatus;
-import com.ctre.phoenix.motion.TrajectoryPoint;
-import com.ctre.phoenix.motorcontrol.ControlFrame;
-import com.ctre.phoenix.motorcontrol.ControlMode;
-import com.ctre.phoenix.motorcontrol.DemandType;
-import com.ctre.phoenix.motorcontrol.Faults;
-import com.ctre.phoenix.motorcontrol.FeedbackDevice;
-import com.ctre.phoenix.motorcontrol.FollowerType;
-import com.ctre.phoenix.motorcontrol.IMotorController;
-import com.ctre.phoenix.motorcontrol.InvertType;
-import com.ctre.phoenix.motorcontrol.LimitSwitchNormal;
-import com.ctre.phoenix.motorcontrol.LimitSwitchSource;
-import com.ctre.phoenix.motorcontrol.NeutralMode;
-import com.ctre.phoenix.motorcontrol.RemoteFeedbackDevice;
-import com.ctre.phoenix.motorcontrol.RemoteLimitSwitchSource;
-import com.ctre.phoenix.motorcontrol.RemoteSensorSource;
-import com.ctre.phoenix.motorcontrol.SensorTerm;
-import com.ctre.phoenix.motorcontrol.StatusFrame;
-import com.ctre.phoenix.motorcontrol.StatusFrameEnhanced;
-import com.ctre.phoenix.motorcontrol.StickyFaults;
-import com.ctre.phoenix.motorcontrol.SupplyCurrentLimitConfiguration;
-import com.ctre.phoenix.motorcontrol.can.BaseTalon;
-import com.ctre.phoenix.motorcontrol.can.FilterConfiguration;
-import com.ctre.phoenix.motorcontrol.can.SlotConfiguration;
-import com.ctre.phoenix.motorcontrol.can.VictorSPX;
-import com.ctre.phoenix.motorcontrol.can.VictorSPXConfiguration;
-import com.ctre.phoenix.motorcontrol.can.VictorSPXPIDSetConfiguration;
-import com.ctre.phoenix.sensors.CANCoder;
-import com.ctre.phoenix.sensors.SensorVelocityMeasPeriod;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import xbot.common.controls.actuators.XCANVictorSPX;
-import xbot.common.injection.DevicePolice;
-import xbot.common.properties.PropertyFactory;
-
-public class CANVictorSPXWpiAdapter extends XCANVictorSPX {
-
- final VictorSPX internalVictor;
-
- @AssistedFactory
- public abstract static class CANVictorSPXWpiAdapterFactory implements XCANVictorSPXFactory {
- public abstract CANVictorSPXWpiAdapter create(@Assisted("deviceId") int deviceId);
- }
-
- @AssistedInject
- public CANVictorSPXWpiAdapter(@Assisted("deviceId") int deviceId, PropertyFactory propMan, DevicePolice police) {
- super(deviceId, propMan, police);
- internalVictor = new VictorSPX(deviceId);
- }
-
- //CHECKSTYLE:OFF
-
- public ErrorCode DestroyObject() {
- return internalVictor.DestroyObject();
- }
-
- public boolean equals(Object obj) {
- return internalVictor.equals(obj);
- }
-
- public long getHandle() {
- return internalVictor.getHandle();
- }
-
- public int getDeviceID() {
- return internalVictor.getDeviceID();
- }
-
- public void getPIDConfigs(VictorSPXPIDSetConfiguration pid, int pidIdx, int timeoutMs) {
- internalVictor.getPIDConfigs(pid, pidIdx, timeoutMs);
- }
-
- public int hashCode() {
- return internalVictor.hashCode();
- }
-
- public void set(ControlMode mode, double outputValue) {
- internalVictor.set(mode, outputValue);
- }
-
- public void getPIDConfigs(VictorSPXPIDSetConfiguration pid) {
- internalVictor.getPIDConfigs(pid);
- }
-
- public ErrorCode configAllSettings(VictorSPXConfiguration allConfigs, int timeoutMs) {
- return internalVictor.configAllSettings(allConfigs, timeoutMs);
- }
-
- public void set(ControlMode mode, double demand0, DemandType demand1Type, double demand1) {
- internalVictor.set(mode, demand0, demand1Type, demand1);
- }
-
- public ErrorCode configAllSettings(VictorSPXConfiguration allConfigs) {
- return internalVictor.configAllSettings(allConfigs);
- }
-
- public void getAllConfigs(VictorSPXConfiguration allConfigs, int timeoutMs) {
- internalVictor.getAllConfigs(allConfigs, timeoutMs);
- }
-
- public void neutralOutput() {
- internalVictor.neutralOutput();
- }
-
- public void setNeutralMode(NeutralMode neutralMode) {
- internalVictor.setNeutralMode(neutralMode);
- }
-
- public void getAllConfigs(VictorSPXConfiguration allConfigs) {
- internalVictor.getAllConfigs(allConfigs);
- }
-
- public void setSensorPhase(boolean PhaseSensor) {
- internalVictor.setSensorPhase(PhaseSensor);
- }
-
- public void setInverted(boolean invert) {
- internalVictor.setInverted(invert);
- }
-
- public void setInverted(InvertType invertType) {
- internalVictor.setInverted(invertType);
- }
-
- public boolean getInverted() {
- return internalVictor.getInverted();
- }
-
- public ErrorCode configFactoryDefault(int timeoutMs) {
- return internalVictor.configFactoryDefault(timeoutMs);
- }
-
- public ErrorCode configFactoryDefault() {
- return internalVictor.configFactoryDefault();
- }
-
- public ErrorCode configOpenloopRamp(double secondsFromNeutralToFull, int timeoutMs) {
- return internalVictor.configOpenloopRamp(secondsFromNeutralToFull, timeoutMs);
- }
-
- public ErrorCode configOpenloopRamp(double secondsFromNeutralToFull) {
- return internalVictor.configOpenloopRamp(secondsFromNeutralToFull);
- }
-
- public ErrorCode configClosedloopRamp(double secondsFromNeutralToFull, int timeoutMs) {
- return internalVictor.configClosedloopRamp(secondsFromNeutralToFull, timeoutMs);
- }
-
- public ErrorCode configClosedloopRamp(double secondsFromNeutralToFull) {
- return internalVictor.configClosedloopRamp(secondsFromNeutralToFull);
- }
-
- public ErrorCode configPeakOutputForward(double percentOut, int timeoutMs) {
- return internalVictor.configPeakOutputForward(percentOut, timeoutMs);
- }
-
- public ErrorCode configPeakOutputForward(double percentOut) {
- return internalVictor.configPeakOutputForward(percentOut);
- }
-
- public ErrorCode configPeakOutputReverse(double percentOut, int timeoutMs) {
- return internalVictor.configPeakOutputReverse(percentOut, timeoutMs);
- }
-
- public ErrorCode configPeakOutputReverse(double percentOut) {
- return internalVictor.configPeakOutputReverse(percentOut);
- }
-
- public ErrorCode configNominalOutputForward(double percentOut, int timeoutMs) {
- return internalVictor.configNominalOutputForward(percentOut, timeoutMs);
- }
-
- public ErrorCode configNominalOutputForward(double percentOut) {
- return internalVictor.configNominalOutputForward(percentOut);
- }
-
- public ErrorCode configNominalOutputReverse(double percentOut, int timeoutMs) {
- return internalVictor.configNominalOutputReverse(percentOut, timeoutMs);
- }
-
- public ErrorCode configNominalOutputReverse(double percentOut) {
- return internalVictor.configNominalOutputReverse(percentOut);
- }
-
- public ErrorCode configNeutralDeadband(double percentDeadband, int timeoutMs) {
- return internalVictor.configNeutralDeadband(percentDeadband, timeoutMs);
- }
-
- public ErrorCode configNeutralDeadband(double percentDeadband) {
- return internalVictor.configNeutralDeadband(percentDeadband);
- }
-
- public ErrorCode configVoltageCompSaturation(double voltage, int timeoutMs) {
- return internalVictor.configVoltageCompSaturation(voltage, timeoutMs);
- }
-
- public ErrorCode configVoltageCompSaturation(double voltage) {
- return internalVictor.configVoltageCompSaturation(voltage);
- }
-
- public ErrorCode configVoltageMeasurementFilter(int filterWindowSamples, int timeoutMs) {
- return internalVictor.configVoltageMeasurementFilter(filterWindowSamples, timeoutMs);
- }
-
- public ErrorCode configVoltageMeasurementFilter(int filterWindowSamples) {
- return internalVictor.configVoltageMeasurementFilter(filterWindowSamples);
- }
-
- public void enableVoltageCompensation(boolean enable) {
- internalVictor.enableVoltageCompensation(enable);
- }
-
- public double getBusVoltage() {
- return internalVictor.getBusVoltage();
- }
-
- public double getMotorOutputPercent() {
- return internalVictor.getMotorOutputPercent();
- }
-
- public double getMotorOutputVoltage() {
- return internalVictor.getMotorOutputVoltage();
- }
-
- public double getTemperature() {
- return internalVictor.getTemperature();
- }
-
- public ErrorCode configSelectedFeedbackSensor(RemoteFeedbackDevice feedbackDevice, int pidIdx, int timeoutMs) {
- return internalVictor.configSelectedFeedbackSensor(feedbackDevice, pidIdx, timeoutMs);
- }
-
- public ErrorCode configSelectedFeedbackSensor(RemoteFeedbackDevice feedbackDevice) {
- return internalVictor.configSelectedFeedbackSensor(feedbackDevice);
- }
-
- public ErrorCode configSelectedFeedbackSensor(FeedbackDevice feedbackDevice, int pidIdx, int timeoutMs) {
- return internalVictor.configSelectedFeedbackSensor(feedbackDevice, pidIdx, timeoutMs);
- }
-
- public ErrorCode configSelectedFeedbackSensor(FeedbackDevice feedbackDevice) {
- return internalVictor.configSelectedFeedbackSensor(feedbackDevice);
- }
-
- public ErrorCode configSelectedFeedbackCoefficient(double coefficient, int pidIdx, int timeoutMs) {
- return internalVictor.configSelectedFeedbackCoefficient(coefficient, pidIdx, timeoutMs);
- }
-
- public ErrorCode configSelectedFeedbackCoefficient(double coefficient) {
- return internalVictor.configSelectedFeedbackCoefficient(coefficient);
- }
-
- public ErrorCode configRemoteFeedbackFilter(int deviceID, RemoteSensorSource remoteSensorSource, int remoteOrdinal,
- int timeoutMs) {
- return internalVictor.configRemoteFeedbackFilter(deviceID, remoteSensorSource, remoteOrdinal, timeoutMs);
- }
-
- public ErrorCode configRemoteFeedbackFilter(int deviceID, RemoteSensorSource remoteSensorSource,
- int remoteOrdinal) {
- return internalVictor.configRemoteFeedbackFilter(deviceID, remoteSensorSource, remoteOrdinal);
- }
-
- public ErrorCode configSensorTerm(SensorTerm sensorTerm, FeedbackDevice feedbackDevice, int timeoutMs) {
- return internalVictor.configSensorTerm(sensorTerm, feedbackDevice, timeoutMs);
- }
-
- public ErrorCode configSensorTerm(SensorTerm sensorTerm, FeedbackDevice feedbackDevice) {
- return internalVictor.configSensorTerm(sensorTerm, feedbackDevice);
- }
-
- public ErrorCode configSensorTerm(SensorTerm sensorTerm, RemoteFeedbackDevice feedbackDevice, int timeoutMs) {
- return internalVictor.configSensorTerm(sensorTerm, feedbackDevice, timeoutMs);
- }
-
- public ErrorCode configSensorTerm(SensorTerm sensorTerm, RemoteFeedbackDevice feedbackDevice) {
- return internalVictor.configSensorTerm(sensorTerm, feedbackDevice);
- }
-
- public double getSelectedSensorPosition(int pidIdx) {
- return internalVictor.getSelectedSensorPosition(pidIdx);
- }
-
- public double getSelectedSensorPosition() {
- return internalVictor.getSelectedSensorPosition();
- }
-
- public double getSelectedSensorVelocity(int pidIdx) {
- return internalVictor.getSelectedSensorVelocity(pidIdx);
- }
-
- public double getSelectedSensorVelocity() {
- return internalVictor.getSelectedSensorVelocity();
- }
-
- public ErrorCode setSelectedSensorPosition(int sensorPos, int pidIdx, int timeoutMs) {
- return internalVictor.setSelectedSensorPosition(sensorPos, pidIdx, timeoutMs);
- }
-
- public ErrorCode setSelectedSensorPosition(int sensorPos) {
- return internalVictor.setSelectedSensorPosition(sensorPos);
- }
-
- public ErrorCode setControlFramePeriod(ControlFrame frame, int periodMs) {
- return internalVictor.setControlFramePeriod(frame, periodMs);
- }
-
- public ErrorCode setControlFramePeriod(int frame, int periodMs) {
- return internalVictor.setControlFramePeriod(frame, periodMs);
- }
-
- public ErrorCode setStatusFramePeriod(int frameValue, int periodMs, int timeoutMs) {
- return internalVictor.setStatusFramePeriod(frameValue, periodMs, timeoutMs);
- }
-
- public ErrorCode setStatusFramePeriod(int frameValue, int periodMs) {
- return internalVictor.setStatusFramePeriod(frameValue, periodMs);
- }
-
- public ErrorCode setStatusFramePeriod(StatusFrame frame, int periodMs, int timeoutMs) {
- return internalVictor.setStatusFramePeriod(frame, periodMs, timeoutMs);
- }
-
- public ErrorCode setStatusFramePeriod(StatusFrame frame, int periodMs) {
- return internalVictor.setStatusFramePeriod(frame, periodMs);
- }
-
- public int getStatusFramePeriod(int frame, int timeoutMs) {
- return internalVictor.getStatusFramePeriod(frame, timeoutMs);
- }
-
- public int getStatusFramePeriod(int frame) {
- return internalVictor.getStatusFramePeriod(frame);
- }
-
- public int getStatusFramePeriod(StatusFrame frame, int timeoutMs) {
- return internalVictor.getStatusFramePeriod(frame, timeoutMs);
- }
-
- public int getStatusFramePeriod(StatusFrame frame) {
- return internalVictor.getStatusFramePeriod(frame);
- }
-
- public int getStatusFramePeriod(StatusFrameEnhanced frame, int timeoutMs) {
- return internalVictor.getStatusFramePeriod(frame, timeoutMs);
- }
-
- public int getStatusFramePeriod(StatusFrameEnhanced frame) {
- return internalVictor.getStatusFramePeriod(frame);
- }
-
- @SuppressWarnings("deprecation")
- public ErrorCode configVelocityMeasurementPeriod(com.ctre.phoenix.motorcontrol.VelocityMeasPeriod period, int timeoutMs) {
- return internalVictor.configVelocityMeasurementPeriod(period, timeoutMs);
- }
-
- @SuppressWarnings("deprecation")
- public ErrorCode configVelocityMeasurementPeriod(com.ctre.phoenix.motorcontrol.VelocityMeasPeriod period) {
- return internalVictor.configVelocityMeasurementPeriod(period);
- }
-
- public ErrorCode configVelocityMeasurementWindow(int windowSize, int timeoutMs) {
- return internalVictor.configVelocityMeasurementWindow(windowSize, timeoutMs);
- }
-
- public ErrorCode configVelocityMeasurementWindow(int windowSize) {
- return internalVictor.configVelocityMeasurementWindow(windowSize);
- }
-
- public ErrorCode configForwardLimitSwitchSource(RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int deviceID, int timeoutMs) {
- return internalVictor.configForwardLimitSwitchSource(type, normalOpenOrClose, deviceID, timeoutMs);
- }
-
- public ErrorCode configForwardLimitSwitchSource(RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int deviceID) {
- return internalVictor.configForwardLimitSwitchSource(type, normalOpenOrClose, deviceID);
- }
-
- public ErrorCode configReverseLimitSwitchSource(RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int deviceID, int timeoutMs) {
- return internalVictor.configReverseLimitSwitchSource(type, normalOpenOrClose, deviceID, timeoutMs);
- }
-
- public ErrorCode configReverseLimitSwitchSource(RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int deviceID) {
- return internalVictor.configReverseLimitSwitchSource(type, normalOpenOrClose, deviceID);
- }
-
- public ErrorCode configForwardLimitSwitchSource(LimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int timeoutMs) {
- return internalVictor.configForwardLimitSwitchSource(type, normalOpenOrClose, timeoutMs);
- }
-
- public ErrorCode configForwardLimitSwitchSource(LimitSwitchSource type, LimitSwitchNormal normalOpenOrClose) {
- return internalVictor.configForwardLimitSwitchSource(type, normalOpenOrClose);
- }
-
- public void overrideLimitSwitchesEnable(boolean enable) {
- internalVictor.overrideLimitSwitchesEnable(enable);
- }
-
- public ErrorCode configForwardSoftLimitThreshold(int forwardSensorLimit, int timeoutMs) {
- return internalVictor.configForwardSoftLimitThreshold(forwardSensorLimit, timeoutMs);
- }
-
- public ErrorCode configForwardSoftLimitThreshold(int forwardSensorLimit) {
- return internalVictor.configForwardSoftLimitThreshold(forwardSensorLimit);
- }
-
- public ErrorCode configReverseSoftLimitThreshold(int reverseSensorLimit, int timeoutMs) {
- return internalVictor.configReverseSoftLimitThreshold(reverseSensorLimit, timeoutMs);
- }
-
- public ErrorCode configReverseSoftLimitThreshold(int reverseSensorLimit) {
- return internalVictor.configReverseSoftLimitThreshold(reverseSensorLimit);
- }
-
- public ErrorCode configForwardSoftLimitEnable(boolean enable, int timeoutMs) {
- return internalVictor.configForwardSoftLimitEnable(enable, timeoutMs);
- }
-
- public ErrorCode configForwardSoftLimitEnable(boolean enable) {
- return internalVictor.configForwardSoftLimitEnable(enable);
- }
-
- public ErrorCode configReverseSoftLimitEnable(boolean enable, int timeoutMs) {
- return internalVictor.configReverseSoftLimitEnable(enable, timeoutMs);
- }
-
- public ErrorCode configReverseSoftLimitEnable(boolean enable) {
- return internalVictor.configReverseSoftLimitEnable(enable);
- }
-
- public void overrideSoftLimitsEnable(boolean enable) {
- internalVictor.overrideSoftLimitsEnable(enable);
- }
-
- public ErrorCode config_kP(int slotIdx, double value, int timeoutMs) {
- return internalVictor.config_kP(slotIdx, value, timeoutMs);
- }
-
- public ErrorCode config_kP(int slotIdx, double value) {
- return internalVictor.config_kP(slotIdx, value);
- }
-
- public ErrorCode config_kI(int slotIdx, double value, int timeoutMs) {
- return internalVictor.config_kI(slotIdx, value, timeoutMs);
- }
-
- public ErrorCode config_kI(int slotIdx, double value) {
- return internalVictor.config_kI(slotIdx, value);
- }
-
- public ErrorCode config_kD(int slotIdx, double value, int timeoutMs) {
- return internalVictor.config_kD(slotIdx, value, timeoutMs);
- }
-
- public ErrorCode config_kD(int slotIdx, double value) {
- return internalVictor.config_kD(slotIdx, value);
- }
-
- public ErrorCode config_kF(int slotIdx, double value, int timeoutMs) {
- return internalVictor.config_kF(slotIdx, value, timeoutMs);
- }
-
- public ErrorCode config_kF(int slotIdx, double value) {
- return internalVictor.config_kF(slotIdx, value);
- }
-
- public ErrorCode config_IntegralZone(int slotIdx, int izone, int timeoutMs) {
- return internalVictor.config_IntegralZone(slotIdx, izone, timeoutMs);
- }
-
- public ErrorCode config_IntegralZone(int slotIdx, int izone) {
- return internalVictor.config_IntegralZone(slotIdx, izone);
- }
-
- public ErrorCode configAllowableClosedloopError(int slotIdx, int allowableClosedLoopError, int timeoutMs) {
- return internalVictor.configAllowableClosedloopError(slotIdx, allowableClosedLoopError, timeoutMs);
- }
-
- public ErrorCode configAllowableClosedloopError(int slotIdx, int allowableClosedLoopError) {
- return internalVictor.configAllowableClosedloopError(slotIdx, allowableClosedLoopError);
- }
-
- public ErrorCode configMaxIntegralAccumulator(int slotIdx, double iaccum, int timeoutMs) {
- return internalVictor.configMaxIntegralAccumulator(slotIdx, iaccum, timeoutMs);
- }
-
- public ErrorCode configMaxIntegralAccumulator(int slotIdx, double iaccum) {
- return internalVictor.configMaxIntegralAccumulator(slotIdx, iaccum);
- }
-
- public ErrorCode configClosedLoopPeakOutput(int slotIdx, double percentOut, int timeoutMs) {
- return internalVictor.configClosedLoopPeakOutput(slotIdx, percentOut, timeoutMs);
- }
-
- public ErrorCode configClosedLoopPeakOutput(int slotIdx, double percentOut) {
- return internalVictor.configClosedLoopPeakOutput(slotIdx, percentOut);
- }
-
- public ErrorCode configClosedLoopPeriod(int slotIdx, int loopTimeMs, int timeoutMs) {
- return internalVictor.configClosedLoopPeriod(slotIdx, loopTimeMs, timeoutMs);
- }
-
- public ErrorCode configClosedLoopPeriod(int slotIdx, int loopTimeMs) {
- return internalVictor.configClosedLoopPeriod(slotIdx, loopTimeMs);
- }
-
- public ErrorCode configAuxPIDPolarity(boolean invert, int timeoutMs) {
- return internalVictor.configAuxPIDPolarity(invert, timeoutMs);
- }
-
- public ErrorCode configAuxPIDPolarity(boolean invert) {
- return internalVictor.configAuxPIDPolarity(invert);
- }
-
- public ErrorCode setIntegralAccumulator(double iaccum, int pidIdx, int timeoutMs) {
- return internalVictor.setIntegralAccumulator(iaccum, pidIdx, timeoutMs);
- }
-
- public ErrorCode setIntegralAccumulator(double iaccum) {
- return internalVictor.setIntegralAccumulator(iaccum);
- }
-
- public double getClosedLoopError(int pidIdx) {
- return internalVictor.getClosedLoopError(pidIdx);
- }
-
- public double getClosedLoopError() {
- return internalVictor.getClosedLoopError();
- }
-
- public double getIntegralAccumulator(int pidIdx) {
- return internalVictor.getIntegralAccumulator(pidIdx);
- }
-
- public double getIntegralAccumulator() {
- return internalVictor.getIntegralAccumulator();
- }
-
- public double getErrorDerivative(int pidIdx) {
- return internalVictor.getErrorDerivative(pidIdx);
- }
-
- public double getErrorDerivative() {
- return internalVictor.getErrorDerivative();
- }
-
- public void selectProfileSlot(int slotIdx, int pidIdx) {
- internalVictor.selectProfileSlot(slotIdx, pidIdx);
- }
-
- public double getClosedLoopTarget(int pidIdx) {
- return internalVictor.getClosedLoopTarget(pidIdx);
- }
-
- public double getClosedLoopTarget() {
- return internalVictor.getClosedLoopTarget();
- }
-
- public double getActiveTrajectoryPosition() {
- return internalVictor.getActiveTrajectoryPosition();
- }
-
- public double getActiveTrajectoryPosition(int pidIdx) {
- return internalVictor.getActiveTrajectoryPosition(pidIdx);
- }
-
- public double getActiveTrajectoryVelocity() {
- return internalVictor.getActiveTrajectoryVelocity();
- }
-
- public double getActiveTrajectoryVelocity(int pidIdx) {
- return internalVictor.getActiveTrajectoryVelocity(pidIdx);
- }
-
- public double getActiveTrajectoryArbFeedFwd() {
- return internalVictor.getActiveTrajectoryArbFeedFwd();
- }
-
- public double getActiveTrajectoryArbFeedFwd(int pidIdx) {
- return internalVictor.getActiveTrajectoryArbFeedFwd(pidIdx);
- }
-
- public ErrorCode configMotionCruiseVelocity(int sensorUnitsPer100ms, int timeoutMs) {
- return internalVictor.configMotionCruiseVelocity(sensorUnitsPer100ms, timeoutMs);
- }
-
- public ErrorCode configMotionCruiseVelocity(int sensorUnitsPer100ms) {
- return internalVictor.configMotionCruiseVelocity(sensorUnitsPer100ms);
- }
-
- public ErrorCode configMotionAcceleration(int sensorUnitsPer100msPerSec, int timeoutMs) {
- return internalVictor.configMotionAcceleration(sensorUnitsPer100msPerSec, timeoutMs);
- }
-
- public ErrorCode configMotionAcceleration(int sensorUnitsPer100msPerSec) {
- return internalVictor.configMotionAcceleration(sensorUnitsPer100msPerSec);
- }
-
- public ErrorCode configMotionSCurveStrength(int curveStrength, int timeoutMs) {
- return internalVictor.configMotionSCurveStrength(curveStrength, timeoutMs);
- }
-
- public ErrorCode configMotionSCurveStrength(int curveStrength) {
- return internalVictor.configMotionSCurveStrength(curveStrength);
- }
-
- public ErrorCode clearMotionProfileTrajectories() {
- return internalVictor.clearMotionProfileTrajectories();
- }
-
- public int getMotionProfileTopLevelBufferCount() {
- return internalVictor.getMotionProfileTopLevelBufferCount();
- }
-
- public ErrorCode pushMotionProfileTrajectory(TrajectoryPoint trajPt) {
- return internalVictor.pushMotionProfileTrajectory(trajPt);
- }
-
- public ErrorCode startMotionProfile(BufferedTrajectoryPointStream stream, int minBufferedPts,
- ControlMode motionProfControlMode) {
- return internalVictor.startMotionProfile(stream, minBufferedPts, motionProfControlMode);
- }
-
- public boolean isMotionProfileFinished() {
- return internalVictor.isMotionProfileFinished();
- }
-
- public boolean isMotionProfileTopLevelBufferFull() {
- return internalVictor.isMotionProfileTopLevelBufferFull();
- }
-
- public void processMotionProfileBuffer() {
- internalVictor.processMotionProfileBuffer();
- }
-
- public ErrorCode getMotionProfileStatus(MotionProfileStatus statusToFill) {
- return internalVictor.getMotionProfileStatus(statusToFill);
- }
-
- public ErrorCode clearMotionProfileHasUnderrun(int timeoutMs) {
- return internalVictor.clearMotionProfileHasUnderrun(timeoutMs);
- }
-
- public ErrorCode clearMotionProfileHasUnderrun() {
- return internalVictor.clearMotionProfileHasUnderrun();
- }
-
- public ErrorCode changeMotionControlFramePeriod(int periodMs) {
- return internalVictor.changeMotionControlFramePeriod(periodMs);
- }
-
- public ErrorCode configMotionProfileTrajectoryPeriod(int baseTrajDurationMs, int timeoutMs) {
- return internalVictor.configMotionProfileTrajectoryPeriod(baseTrajDurationMs, timeoutMs);
- }
-
- public ErrorCode configMotionProfileTrajectoryPeriod(int baseTrajDurationMs) {
- return internalVictor.configMotionProfileTrajectoryPeriod(baseTrajDurationMs);
- }
-
- public ErrorCode configMotionProfileTrajectoryInterpolationEnable(boolean enable, int timeoutMs) {
- return internalVictor.configMotionProfileTrajectoryInterpolationEnable(enable, timeoutMs);
- }
-
- public ErrorCode configMotionProfileTrajectoryInterpolationEnable(boolean enable) {
- return internalVictor.configMotionProfileTrajectoryInterpolationEnable(enable);
- }
-
- public ErrorCode configFeedbackNotContinuous(boolean feedbackNotContinuous, int timeoutMs) {
- return internalVictor.configFeedbackNotContinuous(feedbackNotContinuous, timeoutMs);
- }
-
- public ErrorCode configRemoteSensorClosedLoopDisableNeutralOnLOS(boolean remoteSensorClosedLoopDisableNeutralOnLOS,
- int timeoutMs) {
- return internalVictor.configRemoteSensorClosedLoopDisableNeutralOnLOS(remoteSensorClosedLoopDisableNeutralOnLOS,
- timeoutMs);
- }
-
- public ErrorCode configClearPositionOnLimitF(boolean clearPositionOnLimitF, int timeoutMs) {
- return internalVictor.configClearPositionOnLimitF(clearPositionOnLimitF, timeoutMs);
- }
-
- public ErrorCode configClearPositionOnLimitR(boolean clearPositionOnLimitR, int timeoutMs) {
- return internalVictor.configClearPositionOnLimitR(clearPositionOnLimitR, timeoutMs);
- }
-
- public ErrorCode configClearPositionOnQuadIdx(boolean clearPositionOnQuadIdx, int timeoutMs) {
- return internalVictor.configClearPositionOnQuadIdx(clearPositionOnQuadIdx, timeoutMs);
- }
-
- public ErrorCode configLimitSwitchDisableNeutralOnLOS(boolean limitSwitchDisableNeutralOnLOS, int timeoutMs) {
- return internalVictor.configLimitSwitchDisableNeutralOnLOS(limitSwitchDisableNeutralOnLOS, timeoutMs);
- }
-
- public ErrorCode configSoftLimitDisableNeutralOnLOS(boolean softLimitDisableNeutralOnLOS, int timeoutMs) {
- return internalVictor.configSoftLimitDisableNeutralOnLOS(softLimitDisableNeutralOnLOS, timeoutMs);
- }
-
- public ErrorCode configPulseWidthPeriod_EdgesPerRot(int pulseWidthPeriod_EdgesPerRot, int timeoutMs) {
- return internalVictor.configPulseWidthPeriod_EdgesPerRot(pulseWidthPeriod_EdgesPerRot, timeoutMs);
- }
-
- public ErrorCode configPulseWidthPeriod_FilterWindowSz(int pulseWidthPeriod_FilterWindowSz, int timeoutMs) {
- return internalVictor.configPulseWidthPeriod_FilterWindowSz(pulseWidthPeriod_FilterWindowSz, timeoutMs);
- }
-
- public ErrorCode getLastError() {
- return internalVictor.getLastError();
- }
-
- public ErrorCode getFaults(Faults toFill) {
- return internalVictor.getFaults(toFill);
- }
-
- public ErrorCode getStickyFaults(StickyFaults toFill) {
- return internalVictor.getStickyFaults(toFill);
- }
-
- public ErrorCode clearStickyFaults(int timeoutMs) {
- return internalVictor.clearStickyFaults(timeoutMs);
- }
-
- public ErrorCode clearStickyFaults() {
- return internalVictor.clearStickyFaults();
- }
-
- public int getFirmwareVersion() {
- return internalVictor.getFirmwareVersion();
- }
-
- public boolean hasResetOccurred() {
- return internalVictor.hasResetOccurred();
- }
-
- public ErrorCode configSetCustomParam(int newValue, int paramIndex, int timeoutMs) {
- return internalVictor.configSetCustomParam(newValue, paramIndex, timeoutMs);
- }
-
- public ErrorCode configSetCustomParam(int newValue, int paramIndex) {
- return internalVictor.configSetCustomParam(newValue, paramIndex);
- }
-
- public int configGetCustomParam(int paramIndex, int timeoutMs) {
- return internalVictor.configGetCustomParam(paramIndex, timeoutMs);
- }
-
- public int configGetCustomParam(int paramIndex) {
- return internalVictor.configGetCustomParam(paramIndex);
- }
-
- public ErrorCode configSetParameter(ParamEnum param, double value, int subValue, int ordinal, int timeoutMs) {
- return internalVictor.configSetParameter(param, value, subValue, ordinal, timeoutMs);
- }
-
- public ErrorCode configSetParameter(ParamEnum param, double value, int subValue, int ordinal) {
- return internalVictor.configSetParameter(param, value, subValue, ordinal);
- }
-
- public ErrorCode configSetParameter(int param, double value, int subValue, int ordinal, int timeoutMs) {
- return internalVictor.configSetParameter(param, value, subValue, ordinal, timeoutMs);
- }
-
- public ErrorCode configSetParameter(int param, double value, int subValue, int ordinal) {
- return internalVictor.configSetParameter(param, value, subValue, ordinal);
- }
-
- public double configGetParameter(ParamEnum param, int ordinal, int timeoutMs) {
- return internalVictor.configGetParameter(param, ordinal, timeoutMs);
- }
-
- public double configGetParameter(ParamEnum param, int ordinal) {
- return internalVictor.configGetParameter(param, ordinal);
- }
-
- public double configGetParameter(int param, int ordinal, int timeoutMs) {
- return internalVictor.configGetParameter(param, ordinal, timeoutMs);
- }
-
- public double configGetParameter(int param, int ordinal) {
- return internalVictor.configGetParameter(param, ordinal);
- }
-
- public int getBaseID() {
- return internalVictor.getBaseID();
- }
-
- public ControlMode getControlMode() {
- return internalVictor.getControlMode();
- }
-
- public void follow(IMotorController masterToFollow, FollowerType followerType) {
- internalVictor.follow(masterToFollow, followerType);
- }
-
- public void follow(IMotorController masterToFollow) {
- internalVictor.follow(masterToFollow);
- }
-
- public String toString() {
- return internalVictor.toString();
- }
-
- public void valueUpdated() {
- internalVictor.valueUpdated();
- }
-
- @Deprecated
- public ErrorCode configureSlot(SlotConfiguration slot) {
- return internalVictor.configureSlot(slot);
- }
-
- @Deprecated
- public ErrorCode configureSlot(SlotConfiguration slot, int slotIdx, int timeoutMs) {
- return internalVictor.configureSlot(slot, slotIdx, timeoutMs);
- }
-
- public void getSlotConfigs(SlotConfiguration slot, int slotIdx, int timeoutMs) {
- internalVictor.getSlotConfigs(slot, slotIdx, timeoutMs);
- }
-
- public void getSlotConfigs(SlotConfiguration slot) {
- internalVictor.getSlotConfigs(slot);
- }
-
- @Deprecated
- public ErrorCode configureFilter(FilterConfiguration filter, int ordinal, int timeoutMs,
- boolean enableOptimizations) {
- return internalVictor.configureFilter(filter, ordinal, timeoutMs, enableOptimizations);
- }
-
- @Deprecated
- public ErrorCode configureFilter(FilterConfiguration filter, int ordinal, int timeoutMs) {
- return internalVictor.configureFilter(filter, ordinal, timeoutMs);
- }
-
- @Deprecated
- public ErrorCode configureFilter(FilterConfiguration filter) {
- return internalVictor.configureFilter(filter);
- }
-
- public void getFilterConfigs(FilterConfiguration filter, int ordinal, int timeoutMs) {
- internalVictor.getFilterConfigs(filter, ordinal, timeoutMs);
- }
-
-
- public void getFilterConfigs(FilterConfiguration filter) {
- internalVictor.getFilterConfigs(filter);
- }
-
- ///
- // The Victor can't do anything below this line.
- ///
-
- @Override
- public double getOutputCurrent() {
- return 0;
- }
-
- @Override
- public ErrorCode setStatusFramePeriod(StatusFrameEnhanced frame, int periodMs, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configReverseLimitSwitchSource(LimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int timeoutMs) {
- return null;
- }
-
- @Override
- public boolean isFwdLimitSwitchClosed() {
- return false;
- }
-
- @Override
- public boolean isRevLimitSwitchClosed() {
- return false;
- }
-
- @Override
- public ErrorCode configPeakCurrentLimit(int amps, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configPeakCurrentDuration(int milliseconds, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configContinuousCurrentLimit(int amps, int timeoutMs) {
- return null;
- }
-
- @Override
- public void enableCurrentLimit(boolean enable) {
- }
-
- @Override
- public int getPulseWidthRiseToFallUs() {
- return 0;
- }
-
- @Override
- public ErrorCode configSupplyCurrentLimit(SupplyCurrentLimitConfiguration currLimitCfg, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configRemoteFeedbackFilter(CANCoder canCoderRef, int remoteOrdinal, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configRemoteFeedbackFilter(BaseTalon talonRef, int remoteOrdinal, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode setSelectedSensorPosition(double sensorPos, int pidIdx, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configForwardSoftLimitThreshold(double forwardSensorLimit, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configReverseSoftLimitThreshold(double reverseSensorLimit, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode config_IntegralZone(int slotIdx, double izone, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configAllowableClosedloopError(int slotIdx, double allowableCloseLoopError, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configMotionCruiseVelocity(double sensorUnitsPer100ms, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configMotionAcceleration(double sensorUnitsPer100msPerSec, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configVelocityMeasurementPeriod(SensorVelocityMeasPeriod period, int timeoutMs) {
- return null;
- }
-
- @Override
- public double getActiveTrajectoryHeading() {
- return 0;
- }
-
- //CHECKSTYLE:ON
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/actuators/wpi_adapters/CompressorWPIAdapter.java b/src/main/java/xbot/common/controls/actuators/wpi_adapters/CompressorWPIAdapter.java
deleted file mode 100644
index 64a00bbe..00000000
--- a/src/main/java/xbot/common/controls/actuators/wpi_adapters/CompressorWPIAdapter.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package xbot.common.controls.actuators.wpi_adapters;
-
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import edu.wpi.first.wpilibj.Compressor;
-import edu.wpi.first.wpilibj.PneumaticsModuleType;
-import xbot.common.controls.actuators.XCompressor;
-
-public class CompressorWPIAdapter extends XCompressor {
- Compressor compressor;
-
- @AssistedFactory
- public abstract static class CompressorWPIAdapterFactory implements XCompressorFactory {
- public abstract CompressorWPIAdapter create();
- }
-
- @AssistedInject
- public CompressorWPIAdapter() {
- this.compressor = new Compressor(PneumaticsModuleType.REVPH);
- }
-
- @Override
- public void disable() {
- compressor.disable();
- }
-
- @Override
- public void enable() {
- compressor.enableDigital();
- }
-
- @Override
- public boolean isEnabled() {
- return compressor.isEnabled();
- }
-}
diff --git a/src/main/java/xbot/common/controls/actuators/wpi_adapters/DigitalOutputWPIAdapter.java b/src/main/java/xbot/common/controls/actuators/wpi_adapters/DigitalOutputWPIAdapter.java
deleted file mode 100644
index f48c377b..00000000
--- a/src/main/java/xbot/common/controls/actuators/wpi_adapters/DigitalOutputWPIAdapter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package xbot.common.controls.actuators.wpi_adapters;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import edu.wpi.first.wpilibj.DigitalOutput;
-import xbot.common.controls.actuators.XDigitalOutput;
-import xbot.common.injection.DevicePolice;
-
-public class DigitalOutputWPIAdapter extends XDigitalOutput {
-
- DigitalOutput adapter;
-
- @AssistedFactory
- public abstract static class DigitalOutputWPIAdapterFactory implements XDigitalOutputFactory {
- public abstract DigitalOutputWPIAdapter create(@Assisted("channel") int channel);
- }
-
- @AssistedInject
- public DigitalOutputWPIAdapter(@Assisted("channel") int channel, DevicePolice police) {
- super(channel, police);
- adapter = new DigitalOutput(channel);
- }
-
- public void set(boolean value) {
- adapter.set(value);
- }
-
- public DigitalOutput getWPIDigitalOutput() {
- return adapter;
- }
-
- @Override
- public void setPWMRate(double frequency) {
- adapter.setPWMRate(frequency);
- }
-
- @Override
- public void enablePWM(double initialDutyCycle) {
- adapter.enablePWM(initialDutyCycle);
- }
-
- @Override
- public void updateDutyCycle(double dutyCycle) {
- adapter.updateDutyCycle(dutyCycle);
- }
-
- @Override
- public void disablePWM() {
- adapter.disablePWM();
- }
-
- @Override
- public boolean get() {
- return adapter.get();
- }
-}
diff --git a/src/main/java/xbot/common/controls/actuators/wpi_adapters/PWMWPIAdapter.java b/src/main/java/xbot/common/controls/actuators/wpi_adapters/PWMWPIAdapter.java
deleted file mode 100644
index 74915ee4..00000000
--- a/src/main/java/xbot/common/controls/actuators/wpi_adapters/PWMWPIAdapter.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package xbot.common.controls.actuators.wpi_adapters;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import edu.wpi.first.wpilibj.PWM;
-import xbot.common.controls.actuators.XPWM;
-import xbot.common.injection.DevicePolice;
-
-public class PWMWPIAdapter extends XPWM
-{
- private PWM pwm;
-
- @AssistedFactory
- public abstract static class PWMWPIAdapterFactory implements XPWMFactory {
- public abstract PWMWPIAdapter create(@Assisted("channel") int channel);
- }
-
- @AssistedInject
- public PWMWPIAdapter(@Assisted("channel") int channel, DevicePolice police)
- {
- super(channel, police);
- pwm = new PWM(channel);
- }
-
- @Override
- public void setRaw(int value) {
- pwm.setRaw(value);
- }
-
- @Override
- public int getRaw() {
- return pwm.getRaw();
- }
-
- @Override
- public void setSigned(double value) {
- pwm.setSpeed(value);
- }
-
- @Override
- public double getSigned() {
- return pwm.getSpeed();
- }
-
- @Override
- public void setUnsigned(double value) {
- pwm.setPosition(value);
- }
-
- @Override
- public double getUnsigned() {
- return pwm.getPosition();
- }
-}
diff --git a/src/main/java/xbot/common/controls/actuators/wpi_adapters/RelayWPIAdapter.java b/src/main/java/xbot/common/controls/actuators/wpi_adapters/RelayWPIAdapter.java
deleted file mode 100644
index dffaa1bf..00000000
--- a/src/main/java/xbot/common/controls/actuators/wpi_adapters/RelayWPIAdapter.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package xbot.common.controls.actuators.wpi_adapters;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import edu.wpi.first.wpilibj.Relay;
-import edu.wpi.first.wpilibj.Relay.Value;
-import xbot.common.controls.actuators.XRelay;
-import xbot.common.injection.DevicePolice;
-
-public class RelayWPIAdapter extends XRelay {
-
- Relay internalRelay;
-
- @AssistedFactory
- public abstract static class RelayWPIAdapterFactory implements XRelayFactory {
- public abstract RelayWPIAdapter create(@Assisted("channel") int channel);
- }
-
- @AssistedInject
- public RelayWPIAdapter(@Assisted("channel") int channel, DevicePolice police) {
- super(channel, police);
- internalRelay = new Relay(channel);
- }
-
- @Override
- public void set(Value value) {
- internalRelay.set(value);
- }
-}
diff --git a/src/main/java/xbot/common/controls/actuators/wpi_adapters/ServoWPIAdapter.java b/src/main/java/xbot/common/controls/actuators/wpi_adapters/ServoWPIAdapter.java
deleted file mode 100644
index a58d584e..00000000
--- a/src/main/java/xbot/common/controls/actuators/wpi_adapters/ServoWPIAdapter.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package xbot.common.controls.actuators.wpi_adapters;
-
-import xbot.common.controls.actuators.XServo;
-import xbot.common.injection.DevicePolice;
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import edu.wpi.first.wpilibj.Servo;
-
-public class ServoWPIAdapter extends XServo{
-
- Servo servo;
-
- @AssistedFactory
- public abstract static class ServoWPIAdapterFactory implements XServoFactory {
- public abstract ServoWPIAdapter create(@Assisted("channel") int channel);
- }
-
- @AssistedInject
- public ServoWPIAdapter(@Assisted("channel") int channel, DevicePolice police) {
- super(channel, police);
- this.servo = new Servo(channel);
- }
-
- @Override
- public void set(double value) {
- this.servo.set(value);
- }
-}
diff --git a/src/main/java/xbot/common/controls/actuators/wpi_adapters/SolenoidWPIAdapter.java b/src/main/java/xbot/common/controls/actuators/wpi_adapters/SolenoidWPIAdapter.java
deleted file mode 100644
index afed150e..00000000
--- a/src/main/java/xbot/common/controls/actuators/wpi_adapters/SolenoidWPIAdapter.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package xbot.common.controls.actuators.wpi_adapters;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import edu.wpi.first.wpilibj.PneumaticsModuleType;
-import edu.wpi.first.wpilibj.Solenoid;
-import xbot.common.controls.actuators.XSolenoid;
-import xbot.common.injection.DevicePolice;
-
-public class SolenoidWPIAdapter extends XSolenoid {
-
- private static final int SOLENOID_CHANNEL_COUNT = 16;
-
- Solenoid solenoid;
-
- @AssistedFactory
- public abstract static class SolenoidWPIAdapterFactory implements XSolenoidFactory {
- public abstract SolenoidWPIAdapter create(@Assisted("channel") int channel);
- }
-
- @AssistedInject
- public SolenoidWPIAdapter(@Assisted("channel") int channel, DevicePolice police) {
- super(channel, police);
- this.solenoid = new Solenoid(PneumaticsModuleType.REVPH, channel);
- }
-
- @Override
- public void set(boolean on) {
- this.solenoid.set(on);
- }
-
- @Override
- public boolean get() {
- return this.solenoid.get();
- }
-
- @Override
- public int getMaxSupportedChannel() {
- return SOLENOID_CHANNEL_COUNT - 1;
- }
-}
diff --git a/src/main/java/xbot/common/controls/actuators/wpi_adapters/SpeedControllerWPIAdapter.java b/src/main/java/xbot/common/controls/actuators/wpi_adapters/SpeedControllerWPIAdapter.java
deleted file mode 100644
index 4a2583b9..00000000
--- a/src/main/java/xbot/common/controls/actuators/wpi_adapters/SpeedControllerWPIAdapter.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package xbot.common.controls.actuators.wpi_adapters;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import edu.wpi.first.wpilibj.motorcontrol.PWMMotorController;
-import edu.wpi.first.wpilibj.motorcontrol.Talon;
-import xbot.common.controls.actuators.XSpeedController;
-import xbot.common.injection.DevicePolice;
-
-public class SpeedControllerWPIAdapter extends XSpeedController
-{
- private PWMMotorController controller;
-
- @AssistedFactory
- public abstract static class SpeedControllerWPIAdapterFactory implements XSpeedControllerFactory {
- public abstract SpeedControllerWPIAdapter create(@Assisted("channel") int channel);
- }
-
- @AssistedInject
- public SpeedControllerWPIAdapter(@Assisted("channel") int channel, DevicePolice police)
- {
- super(channel, police);
- controller = new Talon(channel);
- }
-
- public double get()
- {
- return controller.get();
- }
-
- public void set(double value)
- {
- controller.set(value);
- }
-}
diff --git a/src/main/java/xbot/common/controls/actuators/wpi_adapters/VictorAppearingAsTalonWPIAdapter.java b/src/main/java/xbot/common/controls/actuators/wpi_adapters/VictorAppearingAsTalonWPIAdapter.java
deleted file mode 100644
index 13112238..00000000
--- a/src/main/java/xbot/common/controls/actuators/wpi_adapters/VictorAppearingAsTalonWPIAdapter.java
+++ /dev/null
@@ -1,725 +0,0 @@
-package xbot.common.controls.actuators.wpi_adapters;
-
-import com.ctre.phoenix.ErrorCode;
-import com.ctre.phoenix.ParamEnum;
-import com.ctre.phoenix.motion.MotionProfileStatus;
-import com.ctre.phoenix.motion.TrajectoryPoint;
-import com.ctre.phoenix.motorcontrol.ControlFrame;
-import com.ctre.phoenix.motorcontrol.ControlMode;
-import com.ctre.phoenix.motorcontrol.DemandType;
-import com.ctre.phoenix.motorcontrol.Faults;
-import com.ctre.phoenix.motorcontrol.FeedbackDevice;
-import com.ctre.phoenix.motorcontrol.IMotorController;
-import com.ctre.phoenix.motorcontrol.InvertType;
-import com.ctre.phoenix.motorcontrol.LimitSwitchNormal;
-import com.ctre.phoenix.motorcontrol.LimitSwitchSource;
-import com.ctre.phoenix.motorcontrol.NeutralMode;
-import com.ctre.phoenix.motorcontrol.RemoteFeedbackDevice;
-import com.ctre.phoenix.motorcontrol.RemoteLimitSwitchSource;
-import com.ctre.phoenix.motorcontrol.RemoteSensorSource;
-import com.ctre.phoenix.motorcontrol.SensorTerm;
-import com.ctre.phoenix.motorcontrol.StatusFrame;
-import com.ctre.phoenix.motorcontrol.StatusFrameEnhanced;
-import com.ctre.phoenix.motorcontrol.StickyFaults;
-import com.ctre.phoenix.motorcontrol.SupplyCurrentLimitConfiguration;
-import com.ctre.phoenix.motorcontrol.can.BaseTalon;
-import com.ctre.phoenix.sensors.CANCoder;
-import com.ctre.phoenix.sensors.SensorVelocityMeasPeriod;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedInject;
-
-import edu.wpi.first.wpilibj.motorcontrol.PWMMotorController;
-import edu.wpi.first.wpilibj.motorcontrol.Victor;
-import xbot.common.controls.actuators.XCANTalon;
-import xbot.common.injection.DevicePolice;
-import xbot.common.logging.RobotAssertionManager;
-import xbot.common.properties.PropertyFactory;
-
-public class VictorAppearingAsTalonWPIAdapter extends XCANTalon {
- RobotAssertionManager assertionManager;
- PWMMotorController internalSpeedController;
- int deviceId;
-
- @AssistedInject
- public VictorAppearingAsTalonWPIAdapter(
- @Assisted("deviceId") int deviceId,
- RobotAssertionManager assertionManager,
- PropertyFactory propMan,
- DevicePolice police) {
- super(deviceId, propMan, police);
- internalSpeedController = new Victor(deviceId);
- this.deviceId = deviceId;
- this.assertionManager = assertionManager;
- }
-
- @Override
- public void set(ControlMode mode, double demand) {
- if (mode == ControlMode.PercentOutput) {
- internalSpeedController.set(demand);
- }
- else {
- internalSpeedController.set(0);
- assertionManager.fail(
- VictorAppearingAsTalonWPIAdapter.class.getSimpleName()
- + " can only be used in PercentOutput mode;"
- + " currently set to " + mode);
- }
- }
-
- @Override
- public void set(ControlMode Mode, double demand0, DemandType demand1Type, double demand1) {
-
- }
-
- @Override
- public void set(ControlMode mode, double demand0, double demand1) {
- this.simpleSet(demand0);
-
- }
-
- @Override
- public void neutralOutput() {
-
- this.simpleSet(0);
- }
-
- @Override
- public void setNeutralMode(NeutralMode neutralMode) {
-
- }
-
- @Override
- public void setSensorPhase(boolean phaseSensor) {
-
- }
-
- @Override
- public void setInverted(boolean invert) {
-
- internalSpeedController.setInverted(invert);
- }
-
- @Override
- public boolean getInverted() {
-
- return internalSpeedController.getInverted();
- }
-
- @Override
- public ErrorCode configOpenloopRamp(double secondsFromNeutralToFull, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configClosedloopRamp(double secondsFromNeutralToFull, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configPeakOutputForward(double percentOut, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configPeakOutputReverse(double percentOut, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configNominalOutputForward(double percentOut, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configNominalOutputReverse(double percentOut, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configNeutralDeadband(double percentDeadband, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configVoltageCompSaturation(double voltage, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configVoltageMeasurementFilter(int filterWindowSamples, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public void enableVoltageCompensation(boolean enable) {
-
- }
-
- @Override
- public double getBusVoltage() {
-
- return 0;
- }
-
- @Override
- public double getMotorOutputPercent() {
-
- return internalSpeedController.get();
- }
-
- @Override
- public double getMotorOutputVoltage() {
-
- return 0;
- }
-
- @Override
- public double getOutputCurrent() {
-
- return 0;
- }
-
- @Override
- public double getTemperature() {
-
- return 0;
- }
-
- @Override
- public ErrorCode configSelectedFeedbackSensor(RemoteFeedbackDevice feedbackDevice, int pidIdx, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configSelectedFeedbackSensor(FeedbackDevice feedbackDevice, int pidIdx, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configRemoteFeedbackFilter(int deviceID, RemoteSensorSource remoteSensorSource, int remoteOrdinal,
- int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configSensorTerm(SensorTerm sensorTerm, FeedbackDevice feedbackDevice, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public double getSelectedSensorPosition(int pidIdx) {
-
- return 0;
- }
-
- @Override
- public double getSelectedSensorVelocity(int pidIdx) {
-
- return 0;
- }
-
- @Override
- public ErrorCode setSelectedSensorPosition(int sensorPos, int pidIdx, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode setControlFramePeriod(ControlFrame frame, int periodMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode setStatusFramePeriod(StatusFrame frame, int periodMs, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode setStatusFramePeriod(StatusFrameEnhanced frame, int periodMs, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public int getStatusFramePeriod(StatusFrame frame, int timeoutMs) {
-
- return 0;
- }
-
- @Override
- public int getStatusFramePeriod(StatusFrameEnhanced frame, int timeoutMs) {
-
- return 0;
- }
-
- @Override
- public ErrorCode configVelocityMeasurementWindow(int windowSize, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configForwardLimitSwitchSource(RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int deviceID, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configForwardLimitSwitchSource(LimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configReverseLimitSwitchSource(RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int deviceID, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configReverseLimitSwitchSource(LimitSwitchSource type, LimitSwitchNormal normalOpenOrClose,
- int timeoutMs) {
-
- return null;
- }
-
- @Override
- public void overrideLimitSwitchesEnable(boolean enable) {
-
- }
-
- @Override
- public ErrorCode configForwardSoftLimitThreshold(int forwardSensorLimit, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configReverseSoftLimitThreshold(int reverseSensorLimit, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configForwardSoftLimitEnable(boolean enable, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configReverseSoftLimitEnable(boolean enable, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public void overrideSoftLimitsEnable(boolean enable) {
-
- }
-
- @Override
- public ErrorCode configPeakCurrentLimit(int amps, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configPeakCurrentDuration(int milliseconds, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configContinuousCurrentLimit(int amps, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public void enableCurrentLimit(boolean enable) {
-
- }
-
- @Override
- public ErrorCode config_kP(int slotIdx, double value, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode config_kI(int slotIdx, double value, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode config_kD(int slotIdx, double value, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode config_kF(int slotIdx, double value, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode config_IntegralZone(int slotIdx, int izone, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configAllowableClosedloopError(int slotIdx, int allowableCloseLoopError, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configMaxIntegralAccumulator(int slotIdx, double iaccum, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode setIntegralAccumulator(double iaccum, int pidIdx, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public double getClosedLoopError(int pidIdx) {
-
- return 0;
- }
-
- @Override
- public double getIntegralAccumulator(int pidIdx) {
-
- return 0;
- }
-
- @Override
- public double getErrorDerivative(int pidIdx) {
-
- return 0;
- }
-
- @Override
- public void selectProfileSlot(int slotIdx, int pidIdx) {
-
- }
-
- @Override
- public double getActiveTrajectoryPosition() {
-
- return 0;
- }
-
- @Override
- public double getActiveTrajectoryVelocity() {
-
- return 0;
- }
-
- @Override
- public double getActiveTrajectoryHeading() {
-
- return 0;
- }
-
- @Override
- public ErrorCode configMotionCruiseVelocity(int sensorUnitsPer100ms, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configMotionAcceleration(int sensorUnitsPer100msPerSec, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode clearMotionProfileTrajectories() {
-
- return null;
- }
-
- @Override
- public int getMotionProfileTopLevelBufferCount() {
-
- return 0;
- }
-
- @Override
- public ErrorCode pushMotionProfileTrajectory(TrajectoryPoint trajPt) {
-
- return null;
- }
-
- @Override
- public boolean isMotionProfileTopLevelBufferFull() {
-
- return false;
- }
-
- @Override
- public void processMotionProfileBuffer() {
-
- }
-
- @Override
- public ErrorCode getMotionProfileStatus(MotionProfileStatus statusToFill) {
-
- return null;
- }
-
- @Override
- public ErrorCode clearMotionProfileHasUnderrun(int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode changeMotionControlFramePeriod(int periodMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode getLastError() {
-
- return null;
- }
-
- @Override
- public ErrorCode getFaults(Faults toFill) {
-
- return null;
- }
-
- @Override
- public ErrorCode getStickyFaults(StickyFaults toFill) {
-
- return null;
- }
-
- @Override
- public ErrorCode clearStickyFaults(int timeoutMs) {
-
- return null;
- }
-
- @Override
- public int getFirmwareVersion() {
-
- return 0;
- }
-
- @Override
- public boolean hasResetOccurred() {
-
- return false;
- }
-
- @Override
- public ErrorCode configSetCustomParam(int newValue, int paramIndex, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public int configGetCustomParam(int paramIndex, int timoutMs) {
-
- return 0;
- }
-
- @Override
- public ErrorCode configSetParameter(ParamEnum param, double value, int subValue, int ordinal, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public ErrorCode configSetParameter(int param, double value, int subValue, int ordinal, int timeoutMs) {
-
- return null;
- }
-
- @Override
- public double configGetParameter(ParamEnum paramEnum, int ordinal, int timeoutMs) {
-
- return 0;
- }
-
- @Override
- public double configGetParameter(int paramEnum, int ordinal, int timeoutMs) {
-
- return 0;
- }
-
- @Override
- public int getBaseID() {
- return deviceId;
- }
-
- @Override
- public int getDeviceID() {
- return deviceId;
- }
-
- @Override
- public void follow(IMotorController masterToFollow) {
-
- }
-
- @Override
- public void valueUpdated() {
-
- }
-
- // This will never work - victors do not have this capability.
- @Override
- public boolean isFwdLimitSwitchClosed() {
- return false;
- }
-
- // This will never work - victors do not have this capability.
- @Override
- public boolean isRevLimitSwitchClosed() {
- return false;
- }
-
- @Override
- public ErrorCode configSelectedFeedbackCoefficient(double coefficient, int pidIdx, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configClosedLoopPeakOutput(int slotIdx, double percentOut, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configClosedLoopPeriod(int slotIdx, int loopTimeMs, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configAuxPIDPolarity(boolean invert, int timeoutMs) {
- return null;
- }
-
- @Override
- public double getClosedLoopTarget(int pidIdx) {
- return 0;
- }
-
- @Override
- public ErrorCode configMotionProfileTrajectoryPeriod(int baseTrajDurationMs, int timeoutMs) {
- return null;
- }
-
- @Override
- public ControlMode getControlMode() {
- return null;
- }
-
- @Override
- public ErrorCode configMotionSCurveStrength(int curveStrength, int timeoutMs) {
- return null;
- }
-
- @Override
- public int getPulseWidthRiseToFallUs() {
- return 0;
- }
-
- @Override
- public ErrorCode configSupplyCurrentLimit(SupplyCurrentLimitConfiguration currLimitCfg, int timeoutMs) {
- return null;
- }
-
- @Override
- public void setInverted(InvertType invertType) {
-
- }
-
- @Override
- public ErrorCode configRemoteFeedbackFilter(CANCoder canCoderRef, int remoteOrdinal, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configRemoteFeedbackFilter(BaseTalon talonRef, int remoteOrdinal, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode setSelectedSensorPosition(double sensorPos, int pidIdx, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configForwardSoftLimitThreshold(double forwardSensorLimit, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configReverseSoftLimitThreshold(double reverseSensorLimit, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode config_IntegralZone(int slotIdx, double izone, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configAllowableClosedloopError(int slotIdx, double allowableCloseLoopError, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configMotionCruiseVelocity(double sensorUnitsPer100ms, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configMotionAcceleration(double sensorUnitsPer100msPerSec, int timeoutMs) {
- return null;
- }
-
- @Override
- public ErrorCode configVelocityMeasurementPeriod(SensorVelocityMeasPeriod period, int timeoutMs) {
- return null;
- }
-
- @Override
- @SuppressWarnings("deprecation")
- public ErrorCode configVelocityMeasurementPeriod(com.ctre.phoenix.motorcontrol.VelocityMeasPeriod period, int timeoutMs) {
- return null;
- }
-
-}
diff --git a/src/main/java/xbot/common/controls/sensors/AnalogDistanceSensor.java b/src/main/java/xbot/common/controls/sensors/AnalogDistanceSensor.java
deleted file mode 100644
index 216b3d19..00000000
--- a/src/main/java/xbot/common/controls/sensors/AnalogDistanceSensor.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package xbot.common.controls.sensors;
-
-import org.apache.log4j.Logger;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import xbot.common.controls.sensors.XAnalogInput.XAnalogInputFactory;
-import xbot.common.properties.DoubleProperty;
-import xbot.common.properties.PropertyFactory;
-
-import java.util.function.DoubleFunction;
-
-public class AnalogDistanceSensor extends XAnalogDistanceSensor {
-
- private static final int NUM_AVERAGE_BITS = 2;
-
- public XAnalogInput input;
-
- private DoubleProperty voltageOffset;
- private DoubleProperty distanceOffset;
- private DoubleProperty scalarMultiplier;
-
- private boolean isAveragingEnabled = false;
-
- private static final Logger log = Logger.getLogger(AnalogDistanceSensor.class);
-
- @AssistedFactory
- public abstract static class AnalogDistanceSensorFactory implements XAnalogDistanceSensorFactory {
- public abstract AnalogDistanceSensor create(
- @Assisted("channel") int channel,
- @Assisted("voltageMap") DoubleFunction voltageMap,
- @Assisted("prefix") String prefix);
- }
-
- @AssistedInject
- public AnalogDistanceSensor(
- XAnalogInputFactory analogInputFactory,
- @Assisted("channel") int channel,
- @Assisted("voltageMap") DoubleFunction voltageMap,
- @Assisted("prefix") String prefix,
- PropertyFactory propMan) {
- super(channel, voltageMap);
-
- log.info("Initializing...");
- this.input = analogInputFactory.create(channel);
- propMan.setPrefix(prefix);
- voltageOffset = propMan.createPersistentProperty("Distance sensor " + input.getChannel() + " voltage offset",
- 0d);
- distanceOffset = propMan.createPersistentProperty("Distance sensor " + input.getChannel() + " distance offset",
- 0d);
- scalarMultiplier = propMan
- .createPersistentProperty("Distance sensor " + input.getChannel() + "scalar multiplier", 1d);
- }
-
- @Override
- public double getDistance() {
- double voltage = isAveragingEnabled ? input.getAverageVoltage() : input.getVoltage();
- return (voltageMap.apply(voltage + voltageOffset.get()) + distanceOffset.get()) * scalarMultiplier.get();
- }
-
- @Override
- public void setAveraging(boolean shouldAverage) {
- isAveragingEnabled = shouldAverage;
- input.setAverageBits(shouldAverage ? NUM_AVERAGE_BITS : 0);
- }
-
- public void setVoltageOffset(double offset) {
- voltageOffset.set(offset);
- }
-
- public void setDistanceOffset(double offset) {
- distanceOffset.set(offset);
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/DistanceSensor.java b/src/main/java/xbot/common/controls/sensors/DistanceSensor.java
deleted file mode 100644
index bffacc22..00000000
--- a/src/main/java/xbot/common/controls/sensors/DistanceSensor.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package xbot.common.controls.sensors;
-
-public interface DistanceSensor {
-
- public double getDistance();
-
- public void setAveraging(boolean shouldAverage);
-}
diff --git a/src/main/java/xbot/common/controls/sensors/DistanceSensorPair.java b/src/main/java/xbot/common/controls/sensors/DistanceSensorPair.java
deleted file mode 100644
index 84f7eab4..00000000
--- a/src/main/java/xbot/common/controls/sensors/DistanceSensorPair.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package xbot.common.controls.sensors;
-
-public interface DistanceSensorPair {
- public DistanceSensor getSensorA();
- public DistanceSensor getSensorB();
-
- public void update();
-}
diff --git a/src/main/java/xbot/common/controls/sensors/IGamepad.java b/src/main/java/xbot/common/controls/sensors/IGamepad.java
deleted file mode 100644
index ed5a28f0..00000000
--- a/src/main/java/xbot/common/controls/sensors/IGamepad.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package xbot.common.controls.sensors;
-
-import xbot.common.math.XYPair;
-
-public interface IGamepad {
-
- public XYPair getLeftVector();
- public XYPair getRightVector();
-
- public double getLeftTrigger();
- public double getRightTrigger();
-
- public void setLeftInversion(boolean xInverted, boolean yInverted);
- public void setRightInversion(boolean xInverted, boolean yInverted);
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/sensors/MultiplexedLidarPair.java b/src/main/java/xbot/common/controls/sensors/MultiplexedLidarPair.java
deleted file mode 100644
index 15a62367..00000000
--- a/src/main/java/xbot/common/controls/sensors/MultiplexedLidarPair.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package xbot.common.controls.sensors;
-
-import org.apache.log4j.Logger;
-
-import xbot.common.properties.PropertyFactory;
-import edu.wpi.first.wpilibj.I2C;
-import edu.wpi.first.wpilibj.I2C.Port;
-
-public class MultiplexedLidarPair implements DistanceSensorPair {
-
- private Logger log = Logger.getLogger(MultiplexedLidarPair.class);
-
- private byte lidarMuxIdA;
- private byte lidarMuxIdB;
-
- private I2C i2c;
- private byte[] distanceA;
- private byte[] distanceB;
-
- private final int mux_address = 0x70;
- private final int lidar_address = 0x62;
- private final int lidar_config_register = 0x00;
- private final int lidar_distance_register = 0x8f;
-
- private DistanceSensor sensorA;
- private DistanceSensor sensorB;
-
- public MultiplexedLidarPair(Port port, byte lidarMuxIdA, byte lidarMuxIdB, PropertyFactory propMan) {
-
- log.info("Creating MultiplexedLidarPair on port: " + port.toString());
-
- this.lidarMuxIdA = lidarMuxIdA;
- this.lidarMuxIdB = lidarMuxIdB;
-
- i2c = new I2C(port, lidar_address);
-
- distanceA = new byte[2];
- distanceB = new byte[2];
-
- sensorA = new DistanceSensor() {
-
- @Override
- public void setAveraging(boolean shouldAverage) {
- // Intentionally left blank
- }
-
- @Override
- public double getDistance() {
- return (int) Integer.toUnsignedLong(distanceA[0] << 8) + Byte.toUnsignedInt(distanceA[1]);
- }
- };
-
- sensorB = new DistanceSensor() {
-
- @Override
- public void setAveraging(boolean shouldAverage) {
- // Intentionally left blank
- }
-
- @Override
- public double getDistance() {
- return (int) Integer.toUnsignedLong(distanceB[0] << 8) + Byte.toUnsignedInt(distanceB[1]);
- }
- };
-
- initiateMeasurements();
- }
-
- @Override
- public DistanceSensor getSensorA() {
- return sensorA;
- }
-
- @Override
- public DistanceSensor getSensorB() {
- return sensorB;
- }
-
- private void initiateMeasurements() {
- i2c.write(mux_address, 1 << lidarMuxIdA);
- i2c.write(lidar_config_register, 0x04);
- i2c.write(mux_address, 1 << lidarMuxIdB);
- i2c.write(lidar_config_register, 0x04);
- }
-
- @Override
- public void update() {
- // This sensor must be asked to take a distance measurement before
- // updated data is available. Because there is a required delay
- // between asking for a measurement and retrieving the value, we ask for
- // a value at the end of the loop and wait for the next iteration.
-
- i2c.write(mux_address, 1 << lidarMuxIdA);
- i2c.read(lidar_distance_register, 2, distanceA);
- i2c.write(mux_address, 1 << lidarMuxIdB);
- i2c.read(lidar_distance_register, 2, distanceB);
-
- initiateMeasurements();
- }
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/sensors/SimulatedAnalogDistanceSensor.java b/src/main/java/xbot/common/controls/sensors/SimulatedAnalogDistanceSensor.java
deleted file mode 100644
index a64ca441..00000000
--- a/src/main/java/xbot/common/controls/sensors/SimulatedAnalogDistanceSensor.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package xbot.common.controls.sensors;
-
-import java.math.BigDecimal;
-import java.util.function.DoubleFunction;
-
-import org.json.JSONObject;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.DevicePolice.DeviceType;
-import xbot.common.properties.PropertyFactory;
-import xbot.common.simulation.ISimulatableSensor;
-
-public class SimulatedAnalogDistanceSensor extends XAnalogDistanceSensor implements ISimulatableSensor {
-
- private double distance;
-
- @AssistedFactory
- public abstract static class SimulatedAnalogDistanceSensorFactory implements XAnalogDistanceSensorFactory {
- public abstract SimulatedAnalogDistanceSensor create(
- @Assisted("channel") int channel,
- @Assisted("voltageMap") DoubleFunction voltageMap,
- @Assisted("prefix") String prefix);
- }
-
- @AssistedInject
- public SimulatedAnalogDistanceSensor(@Assisted("channel") int channel,
- @Assisted("voltageMap") DoubleFunction voltageMap, @Assisted("prefix") String prefix,
- PropertyFactory propMan, DevicePolice police) {
- super(channel, voltageMap);
-
- police.registerDevice(DeviceType.Analog, channel, this);
- }
-
- @Override
- public double getDistance() {
- return distance;
- }
-
- public void setDistance(double distance) {
- this.distance = distance;
- }
-
- @Override
- public void setAveraging(boolean shouldAverage) {
- }
-
- @Override
- public void setVoltageOffset(double offset) {
- }
-
- @Override
- public void setDistanceOffset(double offset) {
- }
-
- @Override
- public void ingestSimulationData(JSONObject payload) {
- // Some sort of BigDecimal issue
- BigDecimal intermediate = (BigDecimal) payload.get("Distance");
- setDistance(intermediate.doubleValue());
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/sensors/TalonCurrentMonitor.java b/src/main/java/xbot/common/controls/sensors/TalonCurrentMonitor.java
deleted file mode 100644
index a7f89bfd..00000000
--- a/src/main/java/xbot/common/controls/sensors/TalonCurrentMonitor.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package xbot.common.controls.sensors;
-
-import java.util.ArrayDeque;
-import xbot.common.controls.actuators.XCANTalon;
-
-public class TalonCurrentMonitor {
-
- XCANTalon talon;
- final int current_averaging_window=25;
- ArrayDeque currentHistory;
-
- public TalonCurrentMonitor(XCANTalon talon) {
- this.talon = talon;
- currentHistory = new ArrayDeque();
- }
-
- public void updateCurrent() {
- currentHistory.addFirst(talon.getOutputCurrent());
- if (currentHistory.size() > current_averaging_window) {
- currentHistory.removeLast();
- }
- }
-
- public double calculateAverageCurrent() {
- double sum = 0;
- for (Double current : currentHistory) {
- sum += current;
- }
- return sum / currentHistory.size();
- }
-
- public double calculatePeakCurrent() {
- double peakCurrent = 0;
- currentHistory.addFirst(talon.getOutputCurrent());
- if (!currentHistory.isEmpty()) {
- for (Double current : currentHistory) {
- if (peakCurrent < current) {
- peakCurrent = current;
- }
- }
- }
- return peakCurrent;
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/XAS5600.java b/src/main/java/xbot/common/controls/sensors/XAS5600.java
deleted file mode 100644
index 3b4916ae..00000000
--- a/src/main/java/xbot/common/controls/sensors/XAS5600.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package xbot.common.controls.sensors;
-
-import org.apache.log4j.Logger;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import xbot.common.controls.actuators.XCANTalon;
-
-public class XAS5600 {
-
- XCANTalon talon;
- int lastValue = Integer.MIN_VALUE;
- protected Logger log = Logger.getLogger(XAS5600.class);
-
- @AssistedFactory
- public abstract static class XAS5600Factory {
- public abstract XAS5600 create(@Assisted("talon") XCANTalon talon);
- }
-
- @AssistedInject
- public XAS5600(@Assisted("talon") XCANTalon talon) {
- this.talon = talon;
- log.info("Creating XAS5600 using Talon with ID:" + talon.getDeviceID());
- }
-
- public int getPosition() {
- int raw = talon.getPulseWidthRiseToFallUs();
- if (raw == 0) {
- int lastValue = this.lastValue;
- if (lastValue == Integer.MIN_VALUE) {
- return 0;
- }
- return lastValue;
- }
- int actualValue = Math.min(4096, raw - 128);
- lastValue = actualValue;
- return actualValue;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/sensors/XAbsoluteEncoder.java b/src/main/java/xbot/common/controls/sensors/XAbsoluteEncoder.java
deleted file mode 100644
index e7d75d91..00000000
--- a/src/main/java/xbot/common/controls/sensors/XAbsoluteEncoder.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package xbot.common.controls.sensors;
-
-import xbot.common.injection.electrical_contract.DeviceInfo;
-import xbot.common.resiliency.DeviceHealth;
-
-public abstract class XAbsoluteEncoder {
-
- public interface XAbsoluteEncoderFactory {
- XAbsoluteEncoder create(DeviceInfo deviceInfo, String owningSystemPrefix);
- }
-
- public abstract int getDeviceId();
-
- public abstract double getPosition();
-
- public abstract double getAbsolutePosition();
-
- public abstract double getVelocity();
-
- public abstract void setPosition(double newPostition);
-
- public abstract DeviceHealth getHealth();
-}
diff --git a/src/main/java/xbot/common/controls/sensors/XAnalogDistanceSensor.java b/src/main/java/xbot/common/controls/sensors/XAnalogDistanceSensor.java
deleted file mode 100644
index 96d38ce3..00000000
--- a/src/main/java/xbot/common/controls/sensors/XAnalogDistanceSensor.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package xbot.common.controls.sensors;
-
-import java.util.function.DoubleFunction;
-
-public abstract class XAnalogDistanceSensor implements DistanceSensor {
-
- DoubleFunction voltageMap;
-
- public interface XAnalogDistanceSensorFactory {
- XAnalogDistanceSensor create(
- int channel,
- DoubleFunction voltageMap,
- String prefix);
- }
-
- protected XAnalogDistanceSensor(
- int channel,
- DoubleFunction voltageMap) {
- this.voltageMap = voltageMap;
- }
-
- public abstract double getDistance();
-
- public abstract void setAveraging(boolean shouldAverage);
-
- public abstract void setVoltageOffset(double offset);
-
- public abstract void setDistanceOffset(double offset);
-
- public static class VoltageMaps
- {
- public static final double sharp0A51SK(double voltage)
- {
- // 3.6601x4 - 20.375x3 + 41.593x2 - 38.528x + 15.848
- return (3.6601 * Math.pow(voltage, 4d))
- - (20.375 * Math.pow(voltage, 3d))
- + (41.593 * Math.pow(voltage, 2d))
- - (38.528 * voltage)
- + 15.848;
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/sensors/XAnalogInput.java b/src/main/java/xbot/common/controls/sensors/XAnalogInput.java
deleted file mode 100644
index 26760aed..00000000
--- a/src/main/java/xbot/common/controls/sensors/XAnalogInput.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package xbot.common.controls.sensors;
-
-import xbot.common.controls.XBaseIO;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.DevicePolice.DeviceType;
-
-public abstract class XAnalogInput implements XBaseIO {
-
- protected int channel;
-
- public interface XAnalogInputFactory {
- XAnalogInput create(int channel);
- }
-
- public XAnalogInput(int channel, DevicePolice police) {
- this.channel = channel;
- police.registerDevice(DeviceType.Analog, channel, this);
- }
-
- public abstract double getVoltage();
-
- public abstract double getAverageVoltage();
-
- public abstract void setAverageBits(int bits);
-
- public abstract boolean getAsDigital(double threshold);
-}
diff --git a/src/main/java/xbot/common/controls/sensors/XCANCoder.java b/src/main/java/xbot/common/controls/sensors/XCANCoder.java
deleted file mode 100644
index 542d85a4..00000000
--- a/src/main/java/xbot/common/controls/sensors/XCANCoder.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package xbot.common.controls.sensors;
-
-import com.ctre.phoenix.ErrorCode;
-import com.ctre.phoenix.sensors.CANCoderFaults;
-import com.ctre.phoenix.sensors.CANCoderStatusFrame;
-import com.ctre.phoenix.sensors.CANCoderStickyFaults;
-
-import xbot.common.injection.electrical_contract.DeviceInfo;
-
-public abstract class XCANCoder extends XAbsoluteEncoder {
-
- public interface XCANCoderFactory extends XAbsoluteEncoderFactory {
- XCANCoder create(DeviceInfo deviceInfo, String owningSystemPrefix);
- }
-
- public abstract ErrorCode setStatusFramePeriod(CANCoderStatusFrame frame, int periodMs);
-
- public abstract int getStatusFramePeriod(CANCoderStatusFrame frame);
-
- public abstract ErrorCode getFaults(CANCoderFaults toFill);
-
- public abstract ErrorCode getStickyFaults(CANCoderStickyFaults toFill);
-
- public abstract ErrorCode clearStickyFaults();
-
- public abstract boolean hasResetOccurred();
-}
diff --git a/src/main/java/xbot/common/controls/sensors/XDigitalInput.java b/src/main/java/xbot/common/controls/sensors/XDigitalInput.java
deleted file mode 100644
index 28ae024f..00000000
--- a/src/main/java/xbot/common/controls/sensors/XDigitalInput.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package xbot.common.controls.sensors;
-
-import xbot.common.controls.XBaseIO;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.DevicePolice.DeviceType;
-
-public abstract class XDigitalInput implements XBaseIO {
-
- boolean inverted;
-
- public interface XDigitalInputFactory {
- XDigitalInput create(int channel);
- }
-
- public XDigitalInput(DevicePolice police, int channel) {
- police.registerDevice(DeviceType.DigitalIO, channel, this);
- }
-
- public boolean get() {
- return getRaw() ^ inverted;
- }
-
- public void setInverted(boolean inverted) {
- this.inverted = inverted;
- }
-
- public boolean getInverted() {
- return inverted;
- }
-
- protected abstract boolean getRaw();
-}
diff --git a/src/main/java/xbot/common/controls/sensors/XDutyCycleEncoder.java b/src/main/java/xbot/common/controls/sensors/XDutyCycleEncoder.java
deleted file mode 100644
index 3639e4f2..00000000
--- a/src/main/java/xbot/common/controls/sensors/XDutyCycleEncoder.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package xbot.common.controls.sensors;
-
-import edu.wpi.first.math.geometry.Rotation2d;
-import xbot.common.controls.XBaseIO;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.electrical_contract.DeviceInfo;
-import xbot.common.math.ContiguousDouble;
-import xbot.common.math.WrappedRotation2d;
-
-public abstract class XDutyCycleEncoder implements XBaseIO {
-
- protected int channel;
- protected boolean inverted;
-
- public interface XDutyCycleEncoderFactory {
- XDutyCycleEncoder create(DeviceInfo deviceInfo);
- }
-
- public XDutyCycleEncoder(DeviceInfo info, DevicePolice police) {
- this.channel = info.channel;
- police.registerDevice(DevicePolice.DeviceType.DigitalIO, channel, this);
- setInverted(info.inverted);
- }
-
- protected abstract double getAbsoluteRawPosition();
-
- /**
- * Typically not recommended - use {@link #getWrappedPosition()} instead.
- * @return the absolute position of the encoder in degrees from (0, 360)
- */
- public Rotation2d getAbsolutePosition() {
- return new Rotation2d(getAbsoluteRawPosition()*2*Math.PI * inversionFactor());
- }
-
- public double getAbsoluteDegrees() {
- return getAbsoluteRawPosition() * 360 * inversionFactor();
- }
-
- /**
- * @return the absolute position of the encoder in degrees from (-180, 180)
- */
- public WrappedRotation2d getWrappedPosition() {
- return WrappedRotation2d.fromRotation2d(getAbsolutePosition());
- }
-
- @Override
- public int getChannel() {
- return channel;
- }
-
- public void setInverted(boolean inverted) {
- this.inverted = inverted;
- }
-
- protected double inversionFactor() {
- return inverted ? -1 : 1;
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/XEncoder.java b/src/main/java/xbot/common/controls/sensors/XEncoder.java
deleted file mode 100644
index 6fae282c..00000000
--- a/src/main/java/xbot/common/controls/sensors/XEncoder.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package xbot.common.controls.sensors;
-
-import java.util.function.Supplier;
-
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.DevicePolice.DeviceType;
-import xbot.common.properties.DoubleProperty;
-import xbot.common.properties.PropertyFactory;
-
-public abstract class XEncoder {
-
- protected boolean isInverted;
- protected DoubleProperty distancePerPulse;
- protected Supplier distancePerPulseSupplier;
-
- public interface XEncoderFactory {
- XEncoder create(
- String name,
- int aChannel,
- int bChannel,
- double defaultDistancePerPulse);
- }
-
- public XEncoder(
- String name,
- int aChannel,
- int bChannel,
- double defaultDistancePerPulse,
- PropertyFactory propMan,
- DevicePolice police) {
- propMan.setPrefix(name);
- distancePerPulse = propMan.createPersistentProperty("DistancePerPulse", defaultDistancePerPulse);
- setDistancePerPulseSupplier(() -> distancePerPulse.get());
- police.registerDevice(DeviceType.DigitalIO, aChannel, this);
- police.registerDevice(DeviceType.DigitalIO, bChannel, this);
- }
-
- public XEncoder(String prefix, PropertyFactory propMan) {
- propMan.setPrefix(prefix);
- var distancePerPulseProp = propMan.createPersistentProperty("Test" + "DistancePerPulse", 1);
- setDistancePerPulseSupplier(() -> distancePerPulseProp.get());
- }
-
- public void setDistancePerPulseSupplier(Supplier supplier) {
- distancePerPulseSupplier = supplier;
- }
-
- public XEncoder(Supplier distancePerPulse) {
- setDistancePerPulseSupplier(distancePerPulse);
- }
-
- public double getAdjustedDistance() {
- return getDistance() * (isInverted ? -1d : 1d) * distancePerPulseSupplier.get();
- }
-
- public double getAdjustedRate() {
- return getRate() * (isInverted ? -1d : 1d) * distancePerPulseSupplier.get();
- }
-
- public void setInverted(boolean inverted) {
- this.isInverted = inverted;
- }
-
- protected abstract double getRate();
- protected abstract double getDistance();
-
- public abstract void setSamplesToAverage(int samples);
-}
diff --git a/src/main/java/xbot/common/controls/sensors/XFTCGamepad.java b/src/main/java/xbot/common/controls/sensors/XFTCGamepad.java
deleted file mode 100644
index 490c398f..00000000
--- a/src/main/java/xbot/common/controls/sensors/XFTCGamepad.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package xbot.common.controls.sensors;
-
-import xbot.common.controls.sensors.buttons.AdvancedJoystickButtonTrigger.AdvancedJoystickButtonTriggerFactory;
-import xbot.common.controls.sensors.buttons.AdvancedPovButtonTrigger.AdvancedPovButtonTriggerFactory;
-import xbot.common.controls.sensors.buttons.AnalogHIDButtonTrigger.AnalogHIDButtonTriggerFactory;
-import xbot.common.injection.DevicePolice;
-import xbot.common.logging.RobotAssertionManager;
-import xbot.common.math.XYPair;
-
-public abstract class XFTCGamepad extends XJoystick implements IGamepad {
-
- public interface XFTCGamepadFactory {
- XFTCGamepad create(int port, int numButtons);
- }
-
- public XFTCGamepad(int port, AdvancedJoystickButtonTriggerFactory joystickButtonFactory,
- AdvancedPovButtonTriggerFactory povButtonFactory, AnalogHIDButtonTriggerFactory analogHidButtonFactory,
- RobotAssertionManager assertionManager, int numButtons, DevicePolice police) {
- super(port, joystickButtonFactory, povButtonFactory, analogHidButtonFactory, assertionManager, numButtons,
- police);
- }
-
- protected int getLeftJoystickXAxis() {
- return 0;
- }
-
- protected int getLeftJoystickYAxis() {
- return 1;
- }
-
- protected int getRightJoystickXAxis() {
- return 4;
- }
-
- protected int getRightJoystickYAxis() {
- return 5;
- }
-
- protected int getLeftTriggerAxis() {
- return 2;
- }
-
- protected int getRightTriggerAxis() {
- return 3;
- }
-
- public XYPair getLeftVector() {
- return this.getVectorForAxisPair(
- getLeftJoystickXAxis(),
- getLeftJoystickYAxis());
- }
-
- public XYPair getRightVector() {
- return this.getVectorForAxisPair(
- getRightJoystickXAxis(),
- getRightJoystickYAxis());
- }
-
- public double getLeftTrigger() {
- return getRawAxis(getLeftTriggerAxis());
- }
-
- public double getRightTrigger() {
- return getRawAxis(getRightTriggerAxis());
- }
-
- public void setLeftInversion(boolean xInverted, boolean yInverted) {
- setAxisInverted(getLeftJoystickXAxis(), xInverted);
- setAxisInverted(getLeftJoystickYAxis(), yInverted);
- }
-
- public void setRightInversion(boolean xInverted, boolean yInverted) {
- setAxisInverted(getRightJoystickXAxis(), xInverted);
- setAxisInverted(getRightJoystickYAxis(), yInverted);
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/XGyro.java b/src/main/java/xbot/common/controls/sensors/XGyro.java
deleted file mode 100644
index cd2f2269..00000000
--- a/src/main/java/xbot/common/controls/sensors/XGyro.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package xbot.common.controls.sensors;
-
-import edu.wpi.first.wpilibj.I2C;
-import edu.wpi.first.wpilibj.SPI;
-import edu.wpi.first.wpilibj.SerialPort;
-import xbot.common.math.WrappedRotation2d;
-
-public abstract class XGyro
-{
- public enum ImuType {
- nav6,
- navX,
- mock
- }
-
- protected ImuType imuType;
-
- public abstract static class XGyroFactory {
- protected abstract XGyro create(SPI.Port spiPort, SerialPort.Port serialPort, I2C.Port i2cPort);
-
- public XGyro create() {
- return create(SPI.Port.kMXP);
- }
-
- public XGyro create(SPI.Port spiPort) {
- return create(spiPort, null, null);
- }
-
- public XGyro create(SerialPort.Port serialPort) {
- return create(null, serialPort, null);
- }
-
- public XGyro create(I2C.Port i2cPort) {
- return create(null, null, i2cPort);
- }
- }
-
- protected XGyro(ImuType imuType)
- {
- this.imuType = imuType;
- }
-
- public abstract boolean isBroken();
-
- protected ImuType getImuType() {
- return imuType;
- }
-
- // Below are the "safe" methods that return gyro information. They pay attention
- // to the state of the gyro, and as such will ideally not cause exceptions.
-
- /**
- * In degrees
- */
- public WrappedRotation2d getHeading() {
- if (!isBroken()) {
- return WrappedRotation2d.fromDegrees(getDeviceYaw());
- }
- return WrappedRotation2d.fromDegrees(0);
- }
-
- public double getRoll() {
- if (!isBroken()) {
- return getDeviceRoll();
- }
- return 0;
- }
-
- public double getPitch() {
- if (!isBroken()) {
- return getDevicePitch();
- }
- return 0;
- }
-
- public double getYawAngularVelocity() {
- if (!isBroken()) {
- return getDeviceYawAngularVelocity();
- }
- return 0;
- }
-
- // What follows are the primitive "gets" for the gyro. These aren't protected,
- // and could cause exceptions if called while they gyro is not connected.
-
- public abstract boolean isConnected();
-
- /**
- * In degrees
- */
- protected abstract double getDeviceRoll();
-
- /**
- * In degrees
- */
- protected abstract double getDevicePitch();
-
- /**
- * In degrees
- */
- protected abstract double getDeviceYaw();
-
- /**
- * In degrees per second
- */
- protected abstract double getDeviceYawAngularVelocity();
-
-
- public abstract double getDeviceVelocityX();
-
- public abstract double getDeviceVelocityY();
-
- public abstract double getDeviceVelocityZ();
-
- public abstract double getDeviceRawAccelX();
-
- public abstract double getDeviceRawAccelY();
-
- public abstract double getDeviceRawAccelZ();
-}
diff --git a/src/main/java/xbot/common/controls/sensors/XJoystick.java b/src/main/java/xbot/common/controls/sensors/XJoystick.java
deleted file mode 100644
index 34a49a8c..00000000
--- a/src/main/java/xbot/common/controls/sensors/XJoystick.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package xbot.common.controls.sensors;
-
-import java.util.HashMap;
-
-import org.apache.log4j.Logger;
-
-import edu.wpi.first.wpilibj.GenericHID;
-import xbot.common.controls.sensors.buttons.AdvancedJoystickButtonTrigger;
-import xbot.common.controls.sensors.buttons.AdvancedPovButtonTrigger;
-import xbot.common.controls.sensors.buttons.AdvancedTrigger;
-import xbot.common.controls.sensors.buttons.AnalogHIDButtonTrigger;
-import xbot.common.controls.sensors.buttons.AdvancedJoystickButtonTrigger.AdvancedJoystickButtonTriggerFactory;
-import xbot.common.controls.sensors.buttons.AdvancedPovButtonTrigger.AdvancedPovButtonTriggerFactory;
-import xbot.common.controls.sensors.buttons.AnalogHIDButtonTrigger.AnalogHIDButtonTriggerFactory;
-import xbot.common.controls.sensors.buttons.AnalogHIDButtonTrigger.AnalogHIDDescription;
-import xbot.common.controls.sensors.mock_adapters.MockJoystick;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.DevicePolice.DeviceType;
-import xbot.common.logging.RobotAssertionManager;
-import xbot.common.math.XYPair;
-
-public abstract class XJoystick
-{
- protected int port;
-
- private boolean[] axisInversion;
-
- private static final Logger log = Logger.getLogger(XJoystick.class);
-
- private HashMap buttonMap;
- private HashMap analogButtonMap;
- private HashMap povButtonMap;
- private int maxButtons;
-
- private AdvancedJoystickButtonTriggerFactory joystickButtonFactory;
- private AdvancedPovButtonTriggerFactory povButtonFactory;
- private AnalogHIDButtonTriggerFactory analogHidButtonFactory;
-
- private RobotAssertionManager assertionManager;
- private DevicePolice police;
-
- public interface XJoystickFactory {
- XJoystick create(int port, int numButtons);
- }
-
- public XJoystick(
- int port,
- AdvancedJoystickButtonTriggerFactory joystickButtonFactory,
- AdvancedPovButtonTriggerFactory povButtonFactory,
- AnalogHIDButtonTriggerFactory analogHidButtonFactory,
- RobotAssertionManager assertionManager,
- int numButtons,
- DevicePolice police) {
- this.port = port;
- this.police = police;
- this.joystickButtonFactory = joystickButtonFactory;
- this.povButtonFactory = povButtonFactory;
- this.analogHidButtonFactory = analogHidButtonFactory;
- this.assertionManager = assertionManager;
- maxButtons = numButtons;
-
- this.buttonMap = new HashMap(numButtons);
- this.analogButtonMap = new HashMap<>();
- this.povButtonMap = new HashMap();
- this.axisInversion = new boolean[6];
-
- for (int i = 1; i <= numButtons; i++) {
- this.set(i, joystickButtonFactory.create(this, i));
- }
-
- for (int i = 0; i < 360; i+=45) {
- povButtonMap.put(i, povButtonFactory.create(this, i));
- }
-
- police.registerDevice(DeviceType.USB, port, this);
- }
-
- public int getPort() {
- return port;
- }
-
- public boolean getAxisInverted(int axisNumber) {
- if (axisNumber >= 0 && axisNumber < axisInversion.length)
- {
- return axisInversion[axisNumber];
- }
- return false;
- }
-
-
- public void setAxisInverted(int axisNumber, boolean inverted) {
- if (axisNumber >= 0 && axisNumber < axisInversion.length)
- {
- axisInversion[axisNumber] = inverted;
- }
- }
-
- protected XYPair getVectorForAxisPair(int xAxis, int yAxis) {
- double x = getRawAxis(xAxis) * (getAxisInverted(xAxis) ? -1 : 1);
- double y = getRawAxis(xAxis) * (getAxisInverted(yAxis) ? -1 : 1);
- return new XYPair(x, y);
- }
-
- public abstract boolean getButton(int button);
-
- public abstract double getRawAxis(int axisNumber);
-
- public abstract GenericHID getGenericHID();
-
- public abstract int getPOV();
-
- public void addAnalogButton(int axisNumber, double minThreshold, double maxThreshold) {
- addAnalogButton(new AnalogHIDDescription(axisNumber, minThreshold, maxThreshold));
- }
-
- public void addAnalogButton(AnalogHIDDescription desc) {
- setAnalog(analogHidButtonFactory.create(this, desc));
- }
-
- public enum ButtonSource {
- Standard,
- POV
- }
-
- public AdvancedTrigger getifAvailable(int buttonNumber) {
-
- if (buttonNumber < 1 || buttonNumber > maxButtons) {
- return handleInvalidButton("button " + buttonNumber + " is out of range!");
- }
-
- if (buttonMap.containsKey(buttonNumber)) {
- return buttonMap.remove(buttonNumber);
- } else {
- return handleInvalidButton("button " + buttonNumber + " is already used! Cannot be used twice!");
- }
- }
-
- /**
- * Uses the d-pad as a button source.
- * @param povNumber 0 == Up, 90 == Right, 180 == down, 270 == left
- * @return A trigger that represents the given POV direction.
- */
- public AdvancedTrigger getPovIfAvailable(int povNumber) {
- if (povNumber < -1 || povNumber > 315) {
- return handleInvalidButton("button " + povNumber + " is out of range!");
- }
-
- if (povButtonMap.containsKey(povNumber)) {
- return povButtonMap.remove(povNumber);
- } else {
- return handleInvalidButton("button " + povNumber + " is already used! Cannot be used twice!");
- }
- }
-
- private AdvancedTrigger handleInvalidButton(String message) {
- assertionManager.throwException(message, new Exception());
-
- MockJoystick mj = new MockJoystick(0, joystickButtonFactory, povButtonFactory, analogHidButtonFactory, assertionManager, 12, police);
- return new AdvancedJoystickButtonTrigger(mj, 1);
- }
-
- public AnalogHIDButtonTrigger getAnalogIfAvailable(AnalogHIDDescription desc) {
- if (analogButtonMap.containsKey(desc)) {
- return analogButtonMap.remove(desc);
- } else {
- // Warn people that terrible things are happening, then return a null button.
- log.error("analog button " + desc + " is already used! Cannot be used twice!");
- return null;
- }
- }
-
- // sets without checking
- // intended only for initializing buttons from factory.
- private void set(int buttonNumber, AdvancedJoystickButtonTrigger button) {
- buttonMap.put(buttonNumber, button);
- }
-
- // sets without checking
- // intended only for initializing buttons from factory.
- private void setAnalog(AnalogHIDButtonTrigger button) {
- analogButtonMap.put(button.getDescription(), button);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/sensors/XLidarLite.java b/src/main/java/xbot/common/controls/sensors/XLidarLite.java
deleted file mode 100644
index 339058a4..00000000
--- a/src/main/java/xbot/common/controls/sensors/XLidarLite.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package xbot.common.controls.sensors;
-
-import java.util.TimerTask;
-
-import org.apache.log4j.Logger;
-
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.DevicePolice.DeviceType;
-import xbot.common.properties.DoubleProperty;
-import xbot.common.properties.PropertyFactory;
-import edu.wpi.first.wpilibj.I2C.Port;
-
-public abstract class XLidarLite implements DistanceSensor {
-
- private Logger log = Logger.getLogger(XLidarLite.class);
-
- protected byte[] distance;
- private java.util.Timer updater;
- private LidarUpdater task;
-
- protected final int lidar_address = 0x62;
- protected final int lidar_config_register = 0x00;
- protected final int lidar_distance_register = 0x8f;
-
- private DoubleProperty lidarPollDuration;
-
- public interface XLidarLiteFactory {
- public abstract XLidarLite create(Port port, String prefix);
- }
-
- public XLidarLite(Port port, PropertyFactory propMan, DevicePolice police, String prefix) {
-
- log.info("Creating Lidar on port: " + port.toString());
- propMan.setPrefix(prefix);
- lidarPollDuration = propMan.createPersistentProperty("LidarPollDurationMs", 100d);
-
- distance = new byte[2];
-
- task = new LidarUpdater();
- updater = new java.util.Timer();
-
- this.start();
- police.registerDevice(DeviceType.I2C, port.value, this);
- }
-
- protected abstract void update();
-
- // Distance in cm
- public double getDistance() {
- return (int) Integer.toUnsignedLong(distance[0] << 8) + Byte.toUnsignedInt(distance[1]);
- }
-
- public double pidGet() {
- return getDistance();
- }
-
- // Start 10Hz polling
- public void start() {
- log.info("Starting Lidar polling");
- updater.schedule(task, 0);
- }
-
- public void stop() {
- updater.cancel();
- }
-/*
- // Update distance variable
- public void update() {
- i2c.write(lidar_config_register, 0x04); // Initiate measurement
- Timer.delay(0.04); // Delay for measurement to be taken
- i2c.read(lidar_distance_register, 2, distance); // Read in measurement
- Timer.delay(0.01); // Delay to prevent over polling
- }*/
-
- // Timer task to keep distance updated
- private class LidarUpdater extends TimerTask {
- public void run() {
- while (true) {
- update();
- try {
- Thread.sleep((long) lidarPollDuration.get());
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
- }
-
- @Override
- public void setAveraging(boolean shouldAverage) {
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/sensors/XPowerDistributionPanel.java b/src/main/java/xbot/common/controls/sensors/XPowerDistributionPanel.java
deleted file mode 100644
index e36d2e16..00000000
--- a/src/main/java/xbot/common/controls/sensors/XPowerDistributionPanel.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package xbot.common.controls.sensors;
-
-public abstract class XPowerDistributionPanel
-{
- public interface XPowerDistributionPanelFactory {
- XPowerDistributionPanel create();
- }
-
- public abstract double getCurrent(int channel);
-}
diff --git a/src/main/java/xbot/common/controls/sensors/XSettableTimerImpl.java b/src/main/java/xbot/common/controls/sensors/XSettableTimerImpl.java
deleted file mode 100644
index 8abd9e29..00000000
--- a/src/main/java/xbot/common/controls/sensors/XSettableTimerImpl.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package xbot.common.controls.sensors;
-
-public interface XSettableTimerImpl extends XTimerImpl {
-
- /**
- * Set the current time
- * @param time The current time in seconds
- */
- public void setTimeInSeconds(double time);
-
- /**
- * Advance the timer
- * @param time Duration in seconds to advance by
- */
- public void advanceTimeInSecondsBy(double time);
-
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/sensors/XTimer.java b/src/main/java/xbot/common/controls/sensors/XTimer.java
deleted file mode 100644
index 5340aeb3..00000000
--- a/src/main/java/xbot/common/controls/sensors/XTimer.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package xbot.common.controls.sensors;
-
-public class XTimer
-{
- private static XTimerImpl impl;
-
- public static void setImplementation(XTimerImpl implementation) {
- impl = implementation;
- }
-
- /**
- * Returns the current time in seconds since the FPGA was powered on.
- * @return Time in seconds
- */
- public static double getFPGATimestamp() {
- return impl.getFPGATimestamp();
- }
-
- public static double getMatchTime() {
- return impl.getMatchTime();
- }
- public static void delay(double seconds) {
- impl.delay(seconds);
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/sensors/XTimerImpl.java b/src/main/java/xbot/common/controls/sensors/XTimerImpl.java
deleted file mode 100644
index 16ac9601..00000000
--- a/src/main/java/xbot/common/controls/sensors/XTimerImpl.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package xbot.common.controls.sensors;
-
-public interface XTimerImpl {
- public double getFPGATimestamp();
- public double getMatchTime();
- public void delay(double seconds);
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/sensors/XXboxController.java b/src/main/java/xbot/common/controls/sensors/XXboxController.java
deleted file mode 100644
index 453e703a..00000000
--- a/src/main/java/xbot/common/controls/sensors/XXboxController.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package xbot.common.controls.sensors;
-
-import java.util.HashMap;
-
-import xbot.common.controls.sensors.buttons.AdvancedXboxAxisTrigger;
-import xbot.common.controls.sensors.buttons.AdvancedXboxButtonTrigger;
-import xbot.common.controls.sensors.buttons.AdvancedJoystickButtonTrigger.AdvancedJoystickButtonTriggerFactory;
-import xbot.common.controls.sensors.buttons.AdvancedPovButtonTrigger.AdvancedPovButtonTriggerFactory;
-import xbot.common.controls.sensors.buttons.AnalogHIDButtonTrigger.AnalogHIDButtonTriggerFactory;
-import xbot.common.injection.DevicePolice;
-import xbot.common.logging.RobotAssertionManager;
-import xbot.common.math.XYPair;
-import xbot.common.subsystems.feedback.IRumbler;
-import xbot.common.subsystems.feedback.XRumbleManager;
-import xbot.common.subsystems.feedback.XRumbleManager.XRumbleManagerFactory;
-
-public abstract class XXboxController extends XJoystick implements IRumbler, IGamepad {
-
- protected final int port;
- protected final RobotAssertionManager assertionManager;
-
- public final HashMap allocatedButtons;
-
- protected boolean leftXInversion = false;
- protected boolean leftYInversion = false;
- protected boolean rightXInversion = false;
- protected boolean rightYInversion = false;
-
- protected final XRumbleManager rumbleManager;
-
- public interface XXboxControllerFactory {
- XXboxController create(int port);
- }
-
- protected XXboxController(int port, AdvancedJoystickButtonTriggerFactory joystickButtonFactory,
- AdvancedPovButtonTriggerFactory advancedPovButtonFactory, AnalogHIDButtonTriggerFactory analogHidButtonFactory,
- XRumbleManagerFactory rumbleManagerFactory, RobotAssertionManager assertionManager,
- DevicePolice police) {
- super(port, joystickButtonFactory, advancedPovButtonFactory, analogHidButtonFactory, assertionManager, 10, police);
- this.port = port;
- this.assertionManager = assertionManager;
- allocatedButtons = new HashMap();
- rumbleManager = rumbleManagerFactory.create(this);
- }
-
- @Override
- public XRumbleManager getRumbleManager() {
- return rumbleManager;
- }
-
- public enum XboxButton {
- A(1), B(2), X(3), Y(4), LeftBumper(5), RightBumper(6), Back(7), Start(8), LeftStick(9), RightStick(10),
- LeftTrigger(-1), RightTrigger(-1), LeftJoystickYAxis(-1), RightJoystickYAxis(-1);
-
- private int value;
-
- private XboxButton(int value) {
- this.value = value;
- }
-
- public int getValue() {
- return value;
- }
- }
-
- public AdvancedXboxButtonTrigger getifAvailable(XboxButton buttonName) {
- if (!allocatedButtons.containsKey(buttonName)) {
- // If we're trying to use the triggers as buttons, then we need to do some extra
- // work.
- if (buttonName.value == -1) {
- AdvancedXboxAxisTrigger candidate = new AdvancedXboxAxisTrigger(this, buttonName, 0.75);
- allocatedButtons.put(buttonName, candidate);
- } else {
- AdvancedXboxButtonTrigger candidate = new AdvancedXboxButtonTrigger(this, buttonName);
- allocatedButtons.put(buttonName, candidate);
- }
- } else {
- // button already used!
- assertionManager.assertTrue(false, "Button " + buttonName + " has already been allocated!");
- }
-
- return allocatedButtons.get(buttonName);
- }
-
- public AdvancedXboxButtonTrigger getXboxButton(XboxButton buttonName) {
-
- if (!allocatedButtons.containsKey(buttonName)) {
- // key does not exist. Create button!
- AdvancedXboxButtonTrigger candidate;
-
- // If it's a trigger button, create it in a different way
- if (buttonName.value == -1) {
- candidate = new AdvancedXboxAxisTrigger(this, buttonName, 0.75);
- } else {
- candidate = new AdvancedXboxButtonTrigger(this, buttonName);
- }
-
- allocatedButtons.put(buttonName, candidate);
- }
-
- return allocatedButtons.get(buttonName);
- }
-
- // Joysticks---------------------------------------------------------------------------------------------
- public XYPair getLeftVector() {
- return new XYPair(getLeftStickX(), getLeftStickY());
- }
-
- public XYPair getRightVector() {
- return new XYPair(getRightStickX(), getRightStickY());
- }
-
- public void setLeftInversion(boolean xInverted, boolean yInverted) {
- leftXInversion = xInverted;
- leftYInversion = yInverted;
- }
-
- public void setRightInversion(boolean xInverted, boolean yInverted) {
- rightXInversion = xInverted;
- rightYInversion = yInverted;
- }
-
- public double getLeftStickX() {
- return this.getLeftRawX() * (leftXInversion ? -1 : 1);
- }
-
- public double getRightStickX() {
- return this.getRightRawX() * (rightXInversion ? -1 : 1);
- }
-
- public double getLeftStickY() {
- return this.getLeftRawY() * (leftYInversion ? -1 : 1);
- }
-
- public double getRightStickY() {
- return this.getRightRawY() * (rightYInversion ? -1 : 1);
- }
-
- // Triggers-----------------------------------------------------------------------------------------------
- public double getLeftTrigger() {
- return this.getLeftRawTriggerAxis();
- }
-
- public double getRightTrigger() {
- return this.getRightRawTriggerAxis();
- }
-
- protected abstract double getLeftRawTriggerAxis();
-
- protected abstract double getRightRawTriggerAxis();
-
- protected abstract double getLeftRawX();
-
- protected abstract double getLeftRawY();
-
- protected abstract double getRightRawX();
-
- protected abstract double getRightRawY();
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/sensors/buttons/AdvancedJoystickButtonTrigger.java b/src/main/java/xbot/common/controls/sensors/buttons/AdvancedJoystickButtonTrigger.java
deleted file mode 100644
index 7b857692..00000000
--- a/src/main/java/xbot/common/controls/sensors/buttons/AdvancedJoystickButtonTrigger.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package xbot.common.controls.sensors.buttons;
-
-import java.util.function.BooleanSupplier;
-
-import org.apache.log4j.Logger;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-import xbot.common.controls.sensors.XJoystick;
-
-public class AdvancedJoystickButtonTrigger extends AdvancedTrigger
-{
- private static final Logger log = Logger.getLogger(AdvancedJoystickButtonTrigger.class);
-
- XJoystick joystick;
- int buttonNumber;
-
- @AssistedFactory
- public abstract static class AdvancedJoystickButtonTriggerFactory {
- public abstract AdvancedJoystickButtonTrigger create(
- @Assisted("joystick") XJoystick joystick,
- @Assisted("buttonNumber") int buttonNumber);
- }
-
- @AssistedInject
- public AdvancedJoystickButtonTrigger(
- @Assisted("joystick") XJoystick joystick,
- @Assisted("buttonNumber")int buttonNumber) {
- super((BooleanSupplier)(() -> joystick.getButton(buttonNumber)));
- log.debug("Creating button " + buttonNumber + " on port " + joystick.getPort());
- this.joystick = joystick;
- this.buttonNumber = buttonNumber;
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/buttons/AdvancedPovButtonTrigger.java b/src/main/java/xbot/common/controls/sensors/buttons/AdvancedPovButtonTrigger.java
deleted file mode 100644
index 4b092c56..00000000
--- a/src/main/java/xbot/common/controls/sensors/buttons/AdvancedPovButtonTrigger.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package xbot.common.controls.sensors.buttons;
-
-import org.apache.log4j.Logger;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-import xbot.common.controls.sensors.XJoystick;
-
-public class AdvancedPovButtonTrigger extends AdvancedTrigger {
-
- private static final Logger log = Logger.getLogger(AdvancedPovButtonTrigger.class);
-
- XJoystick joystick;
- int povNumber;
-
- @AssistedFactory
- public abstract static class AdvancedPovButtonTriggerFactory {
- public abstract AdvancedPovButtonTrigger create(
- @Assisted("joystick") XJoystick joystick,
- @Assisted("povNumber") int povNumber);
- }
-
- @AssistedInject
- public AdvancedPovButtonTrigger(
- @Assisted("joystick") XJoystick joystick,
- @Assisted("povNumber")int povNumber) {
- super(() -> joystick.getPOV() == povNumber);
- log.debug("Creating D-Pad button " + povNumber + " on port " + joystick.getPort());
- this.joystick = joystick;
- this.povNumber = povNumber;
- }
-
-}
diff --git a/src/main/java/xbot/common/controls/sensors/buttons/AdvancedTrigger.java b/src/main/java/xbot/common/controls/sensors/buttons/AdvancedTrigger.java
deleted file mode 100644
index 4b1ac8ab..00000000
--- a/src/main/java/xbot/common/controls/sensors/buttons/AdvancedTrigger.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package xbot.common.controls.sensors.buttons;
-
-import java.util.function.BooleanSupplier;
-
-import edu.wpi.first.wpilibj2.command.button.Trigger;
-
-public abstract class AdvancedTrigger extends Trigger {
- protected InvertingBooleanSupplier supplier;
-
- public AdvancedTrigger(BooleanSupplier supplier) {
- this(new InvertingBooleanSupplier(supplier));
- }
-
- private AdvancedTrigger(InvertingBooleanSupplier supplier) {
- super(supplier);
- this.supplier = supplier;
- }
-
- public void setInverted(boolean inverted) {
- this.supplier.setInverted(inverted);
- }
-
- public boolean getInverted() {
- return this.supplier.getInverted();
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/buttons/AdvancedXboxAxisTrigger.java b/src/main/java/xbot/common/controls/sensors/buttons/AdvancedXboxAxisTrigger.java
deleted file mode 100644
index dd25b76b..00000000
--- a/src/main/java/xbot/common/controls/sensors/buttons/AdvancedXboxAxisTrigger.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package xbot.common.controls.sensors.buttons;
-
-import java.util.function.BooleanSupplier;
-
-import xbot.common.controls.sensors.XXboxController;
-import xbot.common.controls.sensors.XXboxController.XboxButton;
-
-public class AdvancedXboxAxisTrigger extends AdvancedXboxButtonTrigger {
-
- public AdvancedXboxAxisTrigger(XXboxController controller, XboxButton buttonName, double threshold) {
- super(controller, buttonName, (BooleanSupplier)(() -> getValue(controller, buttonName, threshold)));
- }
-
- private static boolean getValue(XXboxController controller, XboxButton buttonName, double threshold) {
- double value = 0;
-
- switch(buttonName) {
- case LeftTrigger:
- value = controller.getLeftTrigger();
- break;
- case RightTrigger:
- value = controller.getRightTrigger();
- break;
- case LeftJoystickYAxis:
- value = controller.getLeftStickY();
- break;
- case RightJoystickYAxis:
- value = controller.getRightStickY();
- break;
- default:
- break;
- }
-
- return Math.abs(value) > threshold;
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/buttons/AdvancedXboxButtonTrigger.java b/src/main/java/xbot/common/controls/sensors/buttons/AdvancedXboxButtonTrigger.java
deleted file mode 100644
index 9fbde306..00000000
--- a/src/main/java/xbot/common/controls/sensors/buttons/AdvancedXboxButtonTrigger.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package xbot.common.controls.sensors.buttons;
-
-import java.util.HashMap;
-import java.util.function.BooleanSupplier;
-
-import org.apache.log4j.Logger;
-
-import edu.wpi.first.wpilibj2.command.Command;
-import edu.wpi.first.wpilibj2.command.button.Trigger;
-import xbot.common.controls.sensors.XXboxController;
-import xbot.common.controls.sensors.XXboxController.XboxButton;
-
-public class AdvancedXboxButtonTrigger extends AdvancedTrigger {
-
- public enum ButtonTriggerType {
- WhenPressed(0), WhileHeld(1), WhenReleased(2);
-
- private int value;
-
- private ButtonTriggerType(final int value) {
- this.value = value;
- }
-
- public int getValue() {
- return value;
- }
- }
-
- private static final Logger log = Logger.getLogger(AdvancedTrigger.class);
-
- XXboxController controller;
- public XboxButton buttonName;
-
- public final HashMap triggeredCommands = new HashMap();
-
- public AdvancedXboxButtonTrigger(final XXboxController controller, final XboxButton buttonName) {
- this(controller, buttonName, () -> controller.getButton(buttonName.getValue()));
- }
-
- protected AdvancedXboxButtonTrigger(final XXboxController controller, final XboxButton buttonName, final BooleanSupplier supplier) {
- super(supplier);
- log.info("Creating XboxButton " + buttonName.toString());// + " on port " + controller.getInternalController().getPort());
- this.controller = controller;
- this.buttonName = buttonName;
- }
-
- @Override
- public Trigger onTrue(final Command command) {
- this.triggeredCommands.put(ButtonTriggerType.WhenPressed, command);
- return super.onTrue(command);
- }
-
- @Override
- public Trigger onFalse(final Command command) {
- this.triggeredCommands.put(ButtonTriggerType.WhenReleased, command);
- return super.onFalse(command);
- }
-
- @Override
- public Trigger whileTrue(final Command command) {
- this.triggeredCommands.put(ButtonTriggerType.WhileHeld, command);
- return super.whileTrue(command);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/sensors/buttons/AnalogHIDButtonConfiguration.java b/src/main/java/xbot/common/controls/sensors/buttons/AnalogHIDButtonConfiguration.java
deleted file mode 100644
index 12819a3c..00000000
--- a/src/main/java/xbot/common/controls/sensors/buttons/AnalogHIDButtonConfiguration.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package xbot.common.controls.sensors.buttons;
-
-import java.util.function.BooleanSupplier;
-
-import xbot.common.controls.sensors.XJoystick;
-
-public class AnalogHIDButtonConfiguration {
-
- XJoystick m_joystick;
- int m_axisNumber;
-
- double m_analogMinThreshold;
- double m_analogMaxThreshold;
-
- public AnalogHIDButtonConfiguration(XJoystick joystick, int axisNumber, double analogMinThreshold, double analogMaxThreshold) {
- m_joystick = joystick;
- m_axisNumber = axisNumber;
- m_analogMinThreshold = analogMinThreshold;
- m_analogMaxThreshold = analogMaxThreshold;
- }
-
- /**
- * Supplier indicates whether the analog value is in the button's range
- *
- * @return A supplier for the value of the joystick button
- */
- public BooleanSupplier getSupplier() {
- return () -> {
- double data = m_joystick.getRawAxis(m_axisNumber);
- return data >= m_analogMinThreshold && data <= m_analogMaxThreshold;
- };
- };
-}
diff --git a/src/main/java/xbot/common/controls/sensors/buttons/AnalogHIDButtonTrigger.java b/src/main/java/xbot/common/controls/sensors/buttons/AnalogHIDButtonTrigger.java
deleted file mode 100644
index 7135fdcd..00000000
--- a/src/main/java/xbot/common/controls/sensors/buttons/AnalogHIDButtonTrigger.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package xbot.common.controls.sensors.buttons;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import xbot.common.controls.sensors.XJoystick;
-
-public class AnalogHIDButtonTrigger extends AdvancedTrigger {
-
- @AssistedFactory
- public abstract static class AnalogHIDButtonTriggerFactory {
- public abstract AnalogHIDButtonTrigger create(
- @Assisted("joystick") XJoystick joystick,
- @Assisted("axisNumber") int axisNumber,
- @Assisted("analogMinThreshold") double analogMinThreshold,
- @Assisted("analogMaxThreshold") double analogMaxThreshold);
-
- public AnalogHIDButtonTrigger create(XJoystick joystick, AnalogHIDDescription desc) {
- return create(joystick, desc.axisNumber, desc.analogMinThreshold, desc.analogMaxThreshold);
- }
- }
-
- private AnalogHIDButtonConfiguration m_configuration;
-
- /**
- * Create a joystick button for triggering commands based off of an analog axis
- *
- * @param joystick
- * The GenericHID object that has the analog axis to use
- * @param axisNumber
- * The axis number (appears to usually be [X=0,Y=1,Z=2])
- * @param analogThreshold
- * Analog threshold to trigger binary button state
- */
- @AssistedInject
- public AnalogHIDButtonTrigger(
- @Assisted("joystick") XJoystick joystick,
- @Assisted("axisNumber") int axisNumber,
- @Assisted("analogMinThreshold") double analogMinThreshold,
- @Assisted("analogMaxThreshold") double analogMaxThreshold) {
- this(new AnalogHIDButtonConfiguration(joystick, axisNumber, analogMinThreshold, analogMaxThreshold));
- }
-
- private AnalogHIDButtonTrigger(AnalogHIDButtonConfiguration configuration) {
- super(configuration.getSupplier());
- m_configuration = configuration;
- }
-
- public AnalogHIDDescription getDescription() {
- return new AnalogHIDDescription(
- m_configuration.m_axisNumber,
- m_configuration.m_analogMinThreshold,
- m_configuration.m_analogMaxThreshold);
- }
-
- public static class AnalogHIDDescription {
- public int axisNumber;
- public double analogMinThreshold;
- public double analogMaxThreshold;
-
- public AnalogHIDDescription(int axisNumber, double analogMinThreshold,
- double analogMaxThreshold) {
- this.axisNumber = axisNumber;
- this.analogMinThreshold = analogMinThreshold;
- this.analogMaxThreshold = analogMaxThreshold;
- }
-
- @Override
- public String toString() {
- return axisNumber + "<" + analogMinThreshold + ", "
- + analogMaxThreshold + ">";
- }
-
- // Auto-generated hash and equals methods (for HashMap)
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- long temp;
- temp = Double.doubleToLongBits(analogMaxThreshold);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- temp = Double.doubleToLongBits(analogMinThreshold);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- result = prime * result + axisNumber;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
-
- AnalogHIDDescription other = (AnalogHIDDescription) obj;
- if (Double.doubleToLongBits(analogMaxThreshold) != Double.doubleToLongBits(other.analogMaxThreshold)
- || Double.doubleToLongBits(analogMinThreshold) != Double.doubleToLongBits(other.analogMinThreshold)
- || axisNumber != other.axisNumber) {
- return false;
- }
-
- return true;
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/sensors/buttons/ChordTrigger.java b/src/main/java/xbot/common/controls/sensors/buttons/ChordTrigger.java
deleted file mode 100644
index 09dab6da..00000000
--- a/src/main/java/xbot/common/controls/sensors/buttons/ChordTrigger.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package xbot.common.controls.sensors.buttons;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-import edu.wpi.first.wpilibj2.command.button.Trigger;
-
-public class ChordTrigger extends AdvancedTrigger {
-
- AdvancedTrigger a;
- AdvancedTrigger b;
-
- @AssistedFactory
- public abstract static class ChordTriggerFactory {
- public abstract ChordTrigger create(
- @Assisted("a") Trigger a,
- @Assisted("b") Trigger b);
- }
-
- @AssistedInject
- public ChordTrigger(@Assisted("a") Trigger a, @Assisted("b") Trigger b) {
- super(() -> a.getAsBoolean() && b.getAsBoolean());
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/sensors/buttons/InvertingBooleanSupplier.java b/src/main/java/xbot/common/controls/sensors/buttons/InvertingBooleanSupplier.java
deleted file mode 100644
index 1f98ea73..00000000
--- a/src/main/java/xbot/common/controls/sensors/buttons/InvertingBooleanSupplier.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package xbot.common.controls.sensors.buttons;
-
-import java.util.function.BooleanSupplier;
-
-public class InvertingBooleanSupplier implements BooleanSupplier {
-
- private boolean isInverted = false;
- private BooleanSupplier supplier;
-
- public InvertingBooleanSupplier(BooleanSupplier supplier) {
- this.supplier = supplier;
- }
-
- public void setInverted(boolean isInverted) {
- this.isInverted = isInverted;
- }
-
- public boolean getInverted() {
- return this.isInverted;
- }
-
- @Override
- public boolean getAsBoolean() {
- return this.supplier.getAsBoolean() ^ this.isInverted;
- }
-
-
-
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/sensors/buttons/SettableBooleanSuppler.java b/src/main/java/xbot/common/controls/sensors/buttons/SettableBooleanSuppler.java
deleted file mode 100644
index f3ec211c..00000000
--- a/src/main/java/xbot/common/controls/sensors/buttons/SettableBooleanSuppler.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package xbot.common.controls.sensors.buttons;
-
-import java.util.function.BooleanSupplier;
-
-public class SettableBooleanSuppler implements BooleanSupplier {
-
- private boolean value;
-
- public SettableBooleanSuppler(boolean defaultValue) {
- this.value = defaultValue;
- }
-
- @Override
- public boolean getAsBoolean() {
- return value;
- }
-
- public void set(boolean value) {
- this.value = value;
- }
-
- public void toggle() {
- this.value = !this.value;
- }
-
-}
diff --git a/src/main/java/xbot/common/controls/sensors/buttons/VirtualTrigger.java b/src/main/java/xbot/common/controls/sensors/buttons/VirtualTrigger.java
deleted file mode 100644
index 8e143773..00000000
--- a/src/main/java/xbot/common/controls/sensors/buttons/VirtualTrigger.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package xbot.common.controls.sensors.buttons;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-/**
- * A virtual button under program control that can be used for creating chords.
- * This is useful to repurpose buttons in multiple "modes".
- */
-public class VirtualTrigger extends AdvancedTrigger {
-
- private SettableBooleanSuppler supplier;
-
- @AssistedFactory
- public abstract static class VirtualTriggerFactory {
- public abstract VirtualTrigger create(@Assisted boolean defaultPressed);
-
- public VirtualTrigger create() {
- return create(false);
- }
- }
-
- @AssistedInject
- public VirtualTrigger(@Assisted boolean defaultPressed) {
- this(new SettableBooleanSuppler(defaultPressed));
- }
-
- public VirtualTrigger(SettableBooleanSuppler supplier) {
- super(supplier);
- this.supplier = supplier;
- }
-
- public void set(boolean value) {
- this.supplier.set(value);
- }
-
- public void toggle() {
- this.supplier.toggle();
- }
-
-}
diff --git a/src/main/java/xbot/common/controls/sensors/mock_adapters/MockAbsoluteEncoder.java b/src/main/java/xbot/common/controls/sensors/mock_adapters/MockAbsoluteEncoder.java
deleted file mode 100644
index a3a416cb..00000000
--- a/src/main/java/xbot/common/controls/sensors/mock_adapters/MockAbsoluteEncoder.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package xbot.common.controls.sensors.mock_adapters;
-
-import org.json.JSONObject;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import xbot.common.controls.sensors.XAbsoluteEncoder;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.DevicePolice.DeviceType;
-import xbot.common.injection.electrical_contract.DeviceInfo;
-import xbot.common.math.WrappedRotation2d;
-import xbot.common.properties.BooleanProperty;
-import xbot.common.properties.DoubleProperty;
-import xbot.common.properties.PropertyFactory;
-import xbot.common.resiliency.DeviceHealth;
-import xbot.common.simulation.ISimulatableSensor;
-
-public class MockAbsoluteEncoder extends XAbsoluteEncoder implements ISimulatableSensor {
-
- private final int deviceId;
- private final BooleanProperty inverted;
- private final DoubleProperty simulationScale;
- private final DoubleProperty positionOffset;
-
- private double velocity;
- private WrappedRotation2d absolutePosition;
-
- @AssistedFactory
- public abstract static class MockAbsoluteEncoderFactory implements XAbsoluteEncoderFactory {
- public abstract MockAbsoluteEncoder create(
- @Assisted("deviceInfo") DeviceInfo deviceInfo,
- @Assisted("owningSystemPrefix") String owningSystemPrefix);
- }
-
- @AssistedInject
- public MockAbsoluteEncoder(@Assisted("deviceInfo") DeviceInfo deviceInfo,
- @Assisted("owningSystemPrefix") String owningSystemPrefix,
- DevicePolice police, PropertyFactory pf) {
- pf.setPrefix(owningSystemPrefix);
-
- this.deviceId = deviceInfo.channel;
- this.velocity = 0;
- this.absolutePosition = new WrappedRotation2d(0);
- this.positionOffset = pf.createEphemeralProperty("PositionOffset", 0);
- this.inverted = pf.createEphemeralProperty("Inverted", deviceInfo.inverted);
- this.simulationScale = pf.createEphemeralProperty("SimulationScale", deviceInfo.simulationScalingValue);
-
- police.registerDevice(DeviceType.CAN, deviceInfo.channel, this);
- }
-
- @Override
- public int getDeviceId() {
- return this.deviceId;
- }
-
- @Override
- public double getPosition() {
- return WrappedRotation2d.fromDegrees(this.absolutePosition.getDegrees() + this.positionOffset.get()).getDegrees() * (inverted.get() ? -1 : 1);
- }
-
- @Override
- public double getAbsolutePosition() {
- return this.absolutePosition.getDegrees() * (inverted.get() ? -1 : 1);
- }
-
- @Override
- public double getVelocity() {
- return this.velocity * (inverted.get() ? -1 : 1);
- }
-
- @Override
- public void setPosition(double newPosition) {
- this.positionOffset.set(WrappedRotation2d.fromDegrees(newPosition).minus(this.absolutePosition).getDegrees());
- }
-
-
- public double getPositionOffset() {
- return this.positionOffset.get();
- }
-
- public void setAbsolutePosition(double position) {
- this.absolutePosition = WrappedRotation2d.fromDegrees(position * (inverted.get() ? -1 : 1));
- }
-
- @Override
- public void ingestSimulationData(JSONObject payload) {
- setAbsolutePosition(
- payload.getBigDecimal("EncoderTicks").doubleValue() * this.simulationScale.get()
- );
- }
-
- @Override
- public DeviceHealth getHealth() {
- return DeviceHealth.Healthy;
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/mock_adapters/MockCANCoder.java b/src/main/java/xbot/common/controls/sensors/mock_adapters/MockCANCoder.java
deleted file mode 100644
index 7a55b152..00000000
--- a/src/main/java/xbot/common/controls/sensors/mock_adapters/MockCANCoder.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package xbot.common.controls.sensors.mock_adapters;
-
-import com.ctre.phoenix.ErrorCode;
-import com.ctre.phoenix.sensors.CANCoderFaults;
-import com.ctre.phoenix.sensors.CANCoderStatusFrame;
-import com.ctre.phoenix.sensors.CANCoderStickyFaults;
-
-import org.json.JSONObject;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import xbot.common.controls.sensors.XCANCoder;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.DevicePolice.DeviceType;
-import xbot.common.injection.electrical_contract.DeviceInfo;
-import xbot.common.math.WrappedRotation2d;
-import xbot.common.properties.BooleanProperty;
-import xbot.common.properties.DoubleProperty;
-import xbot.common.properties.PropertyFactory;
-import xbot.common.resiliency.DeviceHealth;
-import xbot.common.simulation.ISimulatableSensor;
-
-public class MockCANCoder extends XCANCoder implements ISimulatableSensor {
-
- private final int deviceId;
- private final BooleanProperty inverted;
- private final DoubleProperty simulationScale;
- private final DoubleProperty positionOffset;
-
- private double velocity;
- private WrappedRotation2d absolutePosition;
-
- @AssistedFactory
- public abstract static class MockCANCoderFactory implements XCANCoderFactory {
- public abstract MockCANCoder create(
- @Assisted("deviceInfo") DeviceInfo deviceInfo,
- @Assisted("owningSystemPrefix") String owningSystemPrefix);
- }
-
- @AssistedInject
- public MockCANCoder(@Assisted("deviceInfo") DeviceInfo deviceInfo,
- @Assisted("owningSystemPrefix") String owningSystemPrefix,
- DevicePolice police, PropertyFactory pf) {
- pf.setPrefix(owningSystemPrefix);
-
- this.deviceId = deviceInfo.channel;
- this.velocity = 0;
- this.absolutePosition = new WrappedRotation2d(0);
- this.positionOffset = pf.createEphemeralProperty("PositionOffset", 0);
- this.inverted = pf.createEphemeralProperty("Inverted", deviceInfo.inverted);
- this.simulationScale = pf.createEphemeralProperty("SimulationScale", deviceInfo.simulationScalingValue);
-
- police.registerDevice(DeviceType.CAN, deviceInfo.channel, this);
- }
-
- @Override
- public int getDeviceId() {
- return this.deviceId;
- }
-
- @Override
- public double getPosition() {
- return WrappedRotation2d.fromDegrees(this.absolutePosition.getDegrees() + this.positionOffset.get()).getDegrees() * (inverted.get() ? -1 : 1);
- }
-
- @Override
- public double getAbsolutePosition() {
- return this.absolutePosition.getDegrees() * (inverted.get() ? -1 : 1);
- }
-
- @Override
- public double getVelocity() {
- return this.velocity * (inverted.get() ? -1 : 1);
- }
-
- @Override
- public void setPosition(double newPosition) {
- this.positionOffset.set(WrappedRotation2d.fromDegrees(newPosition).minus(this.absolutePosition).getDegrees());
- }
-
-
- public double getPositionOffset() {
- return this.positionOffset.get();
- }
-
- public void setAbsolutePosition(double position) {
- this.absolutePosition = WrappedRotation2d.fromDegrees(position * (inverted.get() ? -1 : 1));
- }
-
- @Override
- public void ingestSimulationData(JSONObject payload) {
- setAbsolutePosition(
- payload.getBigDecimal("EncoderTicks").doubleValue() * this.simulationScale.get()
- );
- }
-
- @Override
- public DeviceHealth getHealth() {
- return DeviceHealth.Healthy;
- }
-
- @Override
- public ErrorCode setStatusFramePeriod(CANCoderStatusFrame frame, int periodMs) {
- return ErrorCode.OK;
- }
-
- @Override
- public int getStatusFramePeriod(CANCoderStatusFrame frame) {
- return 20;
- }
-
- @Override
- public ErrorCode getFaults(CANCoderFaults toFill) {
- return ErrorCode.OK;
- }
-
- @Override
- public ErrorCode getStickyFaults(CANCoderStickyFaults toFill) {
- return ErrorCode.OK;
- }
-
- @Override
- public ErrorCode clearStickyFaults() {
- return ErrorCode.OK;
- }
-
- @Override
- public boolean hasResetOccurred() {
- return false;
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/mock_adapters/MockDutyCycleEncoder.java b/src/main/java/xbot/common/controls/sensors/mock_adapters/MockDutyCycleEncoder.java
deleted file mode 100644
index c720d054..00000000
--- a/src/main/java/xbot/common/controls/sensors/mock_adapters/MockDutyCycleEncoder.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package xbot.common.controls.sensors.mock_adapters;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-import edu.wpi.first.wpilibj.MockAnalogInput;
-import xbot.common.controls.sensors.XAnalogInput;
-import xbot.common.controls.sensors.XDutyCycleEncoder;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.electrical_contract.DeviceInfo;
-
-public class MockDutyCycleEncoder extends XDutyCycleEncoder {
-
- private double rawPosition;
-
- @AssistedFactory
- public abstract static class MockDutyCycleEncoderFactory implements XDutyCycleEncoder.XDutyCycleEncoderFactory {
- public abstract MockDutyCycleEncoder create(@Assisted("info") DeviceInfo info);
- }
-
- @AssistedInject
- public MockDutyCycleEncoder(@Assisted("info") DeviceInfo info, DevicePolice police) {
- super(info, police);
- }
-
- @Override
- protected double getAbsoluteRawPosition() {
- return rawPosition;
- }
-
- public void setRawPosition(double rawPosition) {
- this.rawPosition = rawPosition * inversionFactor();
- }
-
- @Override
- public int getChannel() {
- return channel;
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/mock_adapters/MockEncoder.java b/src/main/java/xbot/common/controls/sensors/mock_adapters/MockEncoder.java
deleted file mode 100644
index cf2b30c1..00000000
--- a/src/main/java/xbot/common/controls/sensors/mock_adapters/MockEncoder.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package xbot.common.controls.sensors.mock_adapters;
-
-import org.json.JSONObject;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import xbot.common.controls.sensors.XEncoder;
-import xbot.common.injection.DevicePolice;
-import xbot.common.properties.PropertyFactory;
-import xbot.common.simulation.ISimulatableSensor;
-
-public class MockEncoder extends XEncoder implements ISimulatableSensor {
-
- private double distance;
- private double rate;
-
- @AssistedFactory
- public abstract static class MockEncoderFactory implements XEncoderFactory {
- public abstract MockEncoder create(
- @Assisted("name") String name,
- @Assisted("aChannel") int aChannel,
- @Assisted("bChannel") int bChannel,
- @Assisted("defaultDistancePerPulse") double defaultDistancePerPulse);
- }
-
- @AssistedInject
- public MockEncoder(@Assisted("name") String name, @Assisted("aChannel") int aChannel,
- @Assisted("bChannel") int bChannel, @Assisted("defaultDistancePerPulse") double defaultDistancePerPulse,
- PropertyFactory propMan, DevicePolice police) {
- super(name, aChannel, bChannel, defaultDistancePerPulse, propMan, police);
- }
-
- public MockEncoder(String prefix, PropertyFactory propMan) {
- super(prefix, propMan);
- }
-
- public void setDistance(double distance) {
- this.distance = distance * (isInverted ? -1 : 1);
- }
-
- protected double getRate() {
- return rate;
- }
-
- public void setRate(double newRate) {
- this.rate = newRate;
- }
-
- protected double getDistance() {
- return distance;
- }
-
- public void setSamplesToAverage(int samples) {
- }
-
- @Override
- public void ingestSimulationData(JSONObject payload) {
- setDistance((double)payload.get("EncoderTicks"));
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/mock_adapters/MockFTCGamepad.java b/src/main/java/xbot/common/controls/sensors/mock_adapters/MockFTCGamepad.java
deleted file mode 100644
index d4b8072f..00000000
--- a/src/main/java/xbot/common/controls/sensors/mock_adapters/MockFTCGamepad.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package xbot.common.controls.sensors.mock_adapters;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-import edu.wpi.first.wpilibj.GenericHID;
-import xbot.common.controls.sensors.XFTCGamepad;
-import xbot.common.controls.sensors.buttons.AdvancedJoystickButtonTrigger.AdvancedJoystickButtonTriggerFactory;
-import xbot.common.controls.sensors.buttons.AdvancedPovButtonTrigger.AdvancedPovButtonTriggerFactory;
-import xbot.common.controls.sensors.buttons.AnalogHIDButtonTrigger.AnalogHIDButtonTriggerFactory;
-import xbot.common.injection.DevicePolice;
-import xbot.common.logging.RobotAssertionManager;
-import xbot.common.math.XYPair;
-
-public class MockFTCGamepad extends XFTCGamepad {
-
- Map buttons = new HashMap();
- Map rawAxis = new HashMap();
-
- @AssistedFactory
- public abstract static class MockFTCGamepadFactory implements XFTCGamepadFactory {
- public abstract MockFTCGamepad create(
- @Assisted("port") int port,
- @Assisted("numButtons") int numButtons);
- }
-
- @AssistedInject
- public MockFTCGamepad(
- @Assisted("port") int port,
- AdvancedJoystickButtonTriggerFactory joystickButtonFactory,
- AdvancedPovButtonTriggerFactory povButtonFactory,
- AnalogHIDButtonTriggerFactory analogHidButtonFactory,
- RobotAssertionManager assertionManager,
- @Assisted("numButtons") int numButtons,
- DevicePolice police) {
-
- super(port, joystickButtonFactory, povButtonFactory, analogHidButtonFactory, assertionManager, numButtons, police);
-
- for(int i = 0; i < 6; i++)
- {
- rawAxis.put(i, 0d);
- }
-
- for(int i = 0; i < 12; i++)
- {
- releaseButton(i);
- }
- }
-
- public void setX(double x) {
- setRawAxis(0, x);
- }
-
- public void setY(double y) {
- setRawAxis(1, y);
- }
-
- public void setRawAxis(int which, double value) {
- rawAxis.put(which, value);
- }
-
- public void pressButton(int button) {
- buttons.put(button, true);
- }
-
- public void releaseButton(int button) {
- buttons.put(button, false);
- }
-
- public boolean getButton(int button) {
- return buttons.getOrDefault(button, false);
- }
-
- public double getRawAxis(int which) {
- return rawAxis.get(which);
- }
-
- private void setStick(XYPair vector, int xAxis, int yAxis) {
- setRawAxis(xAxis, getAxisInverted(xAxis) ? -vector.x : vector.x);
- setY(getAxisInverted(getLeftJoystickYAxis()) ? -vector.y : vector.y);
- }
-
- public void setLeftStick(XYPair vector) {
- int xAxis = getLeftJoystickXAxis();
- int yAxis = getLeftJoystickYAxis();
- setStick(vector, xAxis, yAxis);
- }
-
- public void setRightStick(XYPair vector) {
- int xAxis = getRightJoystickXAxis();
- int yAxis = getRightJoystickYAxis();
- setStick(vector, xAxis, yAxis);
- }
-
- @Override
- public int getPOV() {
- return 0;
- }
-
- @Override
- public GenericHID getGenericHID() {
- // We don't have a real HID
- return null;
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/mock_adapters/MockGyro.java b/src/main/java/xbot/common/controls/sensors/mock_adapters/MockGyro.java
deleted file mode 100644
index f452592a..00000000
--- a/src/main/java/xbot/common/controls/sensors/mock_adapters/MockGyro.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package xbot.common.controls.sensors.mock_adapters;
-
-import java.math.BigDecimal;
-
-import org.json.JSONObject;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import edu.wpi.first.wpilibj.I2C;
-import edu.wpi.first.wpilibj.SPI;
-import edu.wpi.first.wpilibj.SerialPort;
-import xbot.common.controls.sensors.XGyro;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.DevicePolice.DeviceType;
-import xbot.common.simulation.ISimulatableSensor;
-
-public class MockGyro extends XGyro implements ISimulatableSensor {
- private boolean isBroken;
-
- private double yaw;
- private double pitch;
- private double roll;
- private double yawAngularVelocity;
- private double velocityX;
- private double velocityY;
- private double velocityZ;
- private double rawAccelX;
- private double rawAccelY;
- private double rawAccelZ;
-
- @AssistedFactory
- public abstract static class MockGyroFactory extends XGyroFactory {
- @Override
- public abstract MockGyro create(@Assisted SPI.Port spiPort, @Assisted SerialPort.Port serialPort, @Assisted I2C.Port i2cPort);
- }
-
- @AssistedInject
- public MockGyro(DevicePolice police, @Assisted SPI.Port spiPort, @Assisted SerialPort.Port serialPort, @Assisted I2C.Port i2cPort) {
- super(ImuType.mock);
- if (spiPort != null) {
- police.registerDevice(DeviceType.IMU, spiPort.value, this);
- } else if (serialPort != null) {
- police.registerDevice(DeviceType.IMU, serialPort.value, this);
- } else if (i2cPort != null) {
- police.registerDevice(DeviceType.IMU, i2cPort.value, this);
- }
- }
-
- public boolean isConnected() {
- return true;
- }
-
- public void setYaw(double yaw) {
- this.yaw = yaw;
- }
-
- public double getDeviceYaw() {
- return yaw;
- }
-
- public void setIsBroken(boolean broken) {
- this.isBroken = broken;
- }
-
- public boolean isBroken() {
- return isBroken;
- }
-
- public void setRoll(double roll) {
- this.roll = roll;
- }
-
- public double getDeviceRoll() {
- return roll;
- }
-
- public void setPitch(double pitch) {
- this.pitch = pitch;
- }
-
- public double getDevicePitch() {
- return pitch;
- }
-
- public void setYawAngularVelocity(double yawAngularVelocity) {
- this.yawAngularVelocity = yawAngularVelocity;
- }
-
- public double getDeviceYawAngularVelocity() {
- return yawAngularVelocity;
- }
-
- @Override
- public double getDeviceVelocityX() {
- return this.velocityX;
- }
-
- public void setDeviceVelocityX(double velocity) {
- this.velocityX = velocity;
- }
-
- @Override
- public double getDeviceVelocityY() {
- return this.velocityY;
- }
-
- public void setDeviceVelocityY(double velocity) {
- this.velocityY = velocity;
- }
-
- @Override
- public double getDeviceVelocityZ() {
- return this.velocityZ;
- }
-
- public void setDeviceVelocityZ(double velocity) {
- this.velocityZ = velocity;
- }
-
- @Override
- public double getDeviceRawAccelX() {
- return this.rawAccelX;
- }
-
- public void setDeviceRawAccelX(double accel) {
- this.rawAccelX = accel;
- }
-
- @Override
- public double getDeviceRawAccelY() {
- return this.rawAccelY;
- }
-
- public void setDeviceRawAccelY(double accel) {
- this.rawAccelY = accel;
- }
-
- @Override
- public double getDeviceRawAccelZ() {
- return this.rawAccelZ;
- }
-
- public void setDeviceRawAccelZ(double accel) {
- this.rawAccelZ = accel;
- }
-
- @Override
- public void ingestSimulationData(JSONObject payload) {
- BigDecimal intermediateYaw = (BigDecimal)payload.get("Roll");
- BigDecimal intermediateYawVelocity = (BigDecimal)payload.get("YawVelocity");
-
- // The simulation returns values between -pi and pi, which is just like the NavX returning -180 to 180. We just need
- // to do a quick conversion.
- double yawInDegrees = intermediateYaw.doubleValue() * 180.0 / Math.PI;
- double yawVelocityInDegrees = intermediateYawVelocity.doubleValue() * 180.0 / Math.PI;
-
- this.setYaw(yawInDegrees);
- this.setYawAngularVelocity(yawVelocityInDegrees);
-
- // Eventually we will have more of these for more IMU elements
- }
-
-}
diff --git a/src/main/java/xbot/common/controls/sensors/mock_adapters/MockJoystick.java b/src/main/java/xbot/common/controls/sensors/mock_adapters/MockJoystick.java
deleted file mode 100644
index c66bf544..00000000
--- a/src/main/java/xbot/common/controls/sensors/mock_adapters/MockJoystick.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package xbot.common.controls.sensors.mock_adapters;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import edu.wpi.first.wpilibj.GenericHID;
-import xbot.common.controls.sensors.XJoystick;
-import xbot.common.controls.sensors.buttons.AdvancedJoystickButtonTrigger.AdvancedJoystickButtonTriggerFactory;
-import xbot.common.controls.sensors.buttons.AdvancedPovButtonTrigger.AdvancedPovButtonTriggerFactory;
-import xbot.common.controls.sensors.buttons.AnalogHIDButtonTrigger.AnalogHIDButtonTriggerFactory;
-import xbot.common.injection.DevicePolice;
-import xbot.common.logging.RobotAssertionManager;
-
-public class MockJoystick extends XJoystick {
-
- Map buttons = new HashMap();
- Map rawAxis = new HashMap();
-
- @AssistedFactory
- public abstract static class MockJoystickFactory implements XJoystickFactory {
- @Override
- public abstract MockJoystick create(@Assisted("port") int port, @Assisted("numButtons") int numButtons);
- }
-
- @AssistedInject
- public MockJoystick(
- @Assisted("port") int port,
- AdvancedJoystickButtonTriggerFactory joystickButtonFactory,
- AdvancedPovButtonTriggerFactory povButtonFactory,
- AnalogHIDButtonTriggerFactory analogHidButtonFactory,
- RobotAssertionManager assertionManager,
- @Assisted("numButtons") int numButtons,
- DevicePolice police) {
-
- super(port, joystickButtonFactory, povButtonFactory, analogHidButtonFactory, assertionManager, numButtons, police);
-
- for(int i = 0; i < 6; i++)
- {
- rawAxis.put(i, 0d);
- }
-
- for(int i = 0; i < 12; i++)
- {
- releaseButton(i);
- }
- }
-
- public void setX(double x) {
- setRawAxis(0, x);
- }
-
- public void setY(double y) {
- setRawAxis(1, y);
- }
-
- public void setRawAxis(int which, double value) {
- rawAxis.put(which, value);
- }
-
- public void pressButton(int button) {
- buttons.put(button, true);
- }
-
- public void releaseButton(int button) {
- buttons.put(button, false);
- }
-
- public boolean getButton(int button) {
- return buttons.getOrDefault(button, false);
- }
-
- public double getRawAxis(int which) {
- return rawAxis.get(which);
- }
-
- @Override
- public int getPOV() {
- return 0;
- }
-
- @Override
- public GenericHID getGenericHID() {
- // We don't have a real HID
- return null;
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/wpi_adapters/AnalogInputWPIAdapater.java b/src/main/java/xbot/common/controls/sensors/wpi_adapters/AnalogInputWPIAdapater.java
deleted file mode 100644
index 504d3edf..00000000
--- a/src/main/java/xbot/common/controls/sensors/wpi_adapters/AnalogInputWPIAdapater.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package xbot.common.controls.sensors.wpi_adapters;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-import edu.wpi.first.wpilibj.AnalogInput;
-import xbot.common.controls.sensors.XAnalogInput;
-import xbot.common.injection.DevicePolice;
-
-public class AnalogInputWPIAdapater extends XAnalogInput {
- AnalogInput input;
-
- @AssistedFactory
- public abstract static class AnalogInputWPIAdapaterFactory implements XAnalogInputFactory {
- public abstract AnalogInputWPIAdapater create(@Assisted("channel") int channel);
- }
-
- @AssistedInject
- public AnalogInputWPIAdapater(@Assisted("channel") int channel, DevicePolice police) {
- super(channel, police);
- input = new AnalogInput(channel);
- }
-
- public int getValue() {
- return input.getValue();
- }
-
- public double getVoltage() {
- return input.getVoltage();
- }
-
- public double getAverageVoltage() {
- return input.getAverageVoltage();
- }
-
- public void setAverageBits(int bits) {
- input.setAverageBits(bits);
- }
-
- public AnalogInput getInternalDevice() {
- return input;
- }
-
- @Override
- public int getChannel() {
- return input.getChannel();
- }
-
- @Override
- public boolean getAsDigital(double threshold) {
- return getVoltage() >= threshold;
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/wpi_adapters/CANCoderAdapter.java b/src/main/java/xbot/common/controls/sensors/wpi_adapters/CANCoderAdapter.java
deleted file mode 100644
index eae787f3..00000000
--- a/src/main/java/xbot/common/controls/sensors/wpi_adapters/CANCoderAdapter.java
+++ /dev/null
@@ -1,146 +0,0 @@
-package xbot.common.controls.sensors.wpi_adapters;
-
-import com.ctre.phoenix.ErrorCode;
-import com.ctre.phoenix.sensors.CANCoder;
-import com.ctre.phoenix.sensors.CANCoderFaults;
-import com.ctre.phoenix.sensors.CANCoderStatusFrame;
-import com.ctre.phoenix.sensors.CANCoderStickyFaults;
-import com.ctre.phoenix.sensors.WPI_CANCoder;
-
-import org.apache.log4j.Logger;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import xbot.common.controls.sensors.XCANCoder;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.DevicePolice.DeviceType;
-import xbot.common.injection.electrical_contract.DeviceInfo;
-import xbot.common.properties.BooleanProperty;
-import xbot.common.properties.DoubleProperty;
-import xbot.common.properties.PropertyFactory;
-import xbot.common.resiliency.DeviceHealth;
-
-public class CANCoderAdapter extends XCANCoder {
-
- private static final Logger log = Logger.getLogger(CANCoderAdapter.class);
-
- private final int deviceId;
- private final CANCoder cancoder;
-
- private final DoubleProperty magnetOffset;
- private final BooleanProperty inverted;
-
- @AssistedFactory
- public abstract static class CANCoderAdapterFactory implements XCANCoderFactory {
- public abstract CANCoderAdapter create(
- @Assisted("deviceInfo") DeviceInfo deviceInfo,
- @Assisted("owningSystemPrefix") String owningSystemPrefix);
- }
-
- @AssistedInject
- public CANCoderAdapter(@Assisted("deviceInfo") DeviceInfo deviceInfo,
- @Assisted("owningSystemPrefix") String owningSystemPrefix,
- DevicePolice police, PropertyFactory pf) {
- pf.setPrefix(owningSystemPrefix);
-
- this.inverted = pf.createEphemeralProperty("Inverted", deviceInfo.inverted);
- this.magnetOffset = pf.createEphemeralProperty("Magnet offset", 0.0);
-
- this.cancoder = new WPI_CANCoder(deviceInfo.channel, "rio");
- this.cancoder.configSensorDirection(this.inverted.get());
- this.getMagnetOffset();
-
- this.deviceId = deviceInfo.channel;
-
- police.registerDevice(DeviceType.CAN, deviceInfo.channel, this);
- }
-
- @Override
- public int getDeviceId() {
- return this.deviceId;
- }
-
- @Override
- public double getPosition() {
- return this.cancoder.getPosition();
- }
-
- @Override
- public double getAbsolutePosition() {
- return this.cancoder.getAbsolutePosition();
- }
-
- @Override
- public double getVelocity() {
- return this.cancoder.getVelocity();
- }
-
- public DeviceHealth getHealth() {
- if (this.cancoder.getFirmwareVersion() == -1) {
- return DeviceHealth.Unhealthy;
- }
- return DeviceHealth.Healthy;
- }
-
- @Override
- public void setPosition(double newPosition) {
- this.cancoder.setPosition(newPosition);
- }
-
- /**
- * Gets the magnet offset configured on the encoder device.
- * @return The magnet offset in degrees
- */
- public double getMagnetOffset() {
- this.magnetOffset.set(this.cancoder.configGetMagnetOffset());
- return this.magnetOffset.get();
- }
-
- /**
- * Sets the magnet offset configured on the encoder device.
- * @param offsetInDegrees The magnet offset in degrees
- * @return True on success.
- */
- public boolean setMagnetOffset(double offsetInDegrees) {
- ErrorCode errorCode = this.cancoder.configMagnetOffset(offsetInDegrees);
- if (errorCode.value != 0) {
- log.error("Failed to set magnet offset for device " + this.getDeviceId() + ". Error code: " + errorCode.value);
- return false;
- } else {
- this.magnetOffset.set(offsetInDegrees);
- return true;
- }
- }
-
- @Override
- public ErrorCode setStatusFramePeriod(CANCoderStatusFrame frame, int periodMs) {
- return this.cancoder.setStatusFramePeriod(frame, periodMs);
- }
-
- @Override
- public int getStatusFramePeriod(CANCoderStatusFrame frame) {
- return this.cancoder.getStatusFramePeriod(frame);
- }
-
- @Override
- public ErrorCode getFaults(CANCoderFaults toFill) {
- return this.cancoder.getFaults(toFill);
- }
-
- @Override
- public ErrorCode getStickyFaults(CANCoderStickyFaults toFill) {
- return this.cancoder.getStickyFaults(toFill);
- }
-
- @Override
- public ErrorCode clearStickyFaults() {
- return this.cancoder.clearStickyFaults();
- }
-
- @Override
- public boolean hasResetOccurred() {
- return this.cancoder.hasResetOccurred();
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/wpi_adapters/DigitalInputWPIAdapter.java b/src/main/java/xbot/common/controls/sensors/wpi_adapters/DigitalInputWPIAdapter.java
deleted file mode 100644
index b42f1ca7..00000000
--- a/src/main/java/xbot/common/controls/sensors/wpi_adapters/DigitalInputWPIAdapter.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package xbot.common.controls.sensors.wpi_adapters;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import edu.wpi.first.wpilibj.DigitalInput;
-import xbot.common.controls.sensors.XDigitalInput;
-import xbot.common.injection.DevicePolice;
-
-public class DigitalInputWPIAdapter extends XDigitalInput {
-
- protected DigitalInput adapter;
-
- @AssistedFactory
- public abstract static class DigitalInputWPIAdapterFactory implements XDigitalInputFactory
- {
- public abstract DigitalInputWPIAdapter create(@Assisted("channel") int channel);
- }
-
- /**
- * Create an instance of a Digital Input class. Creates a digital input given a channel.
- *
- * @param channel
- * the DIO channel for the digital input 0-9 are on-board, 10-25 are on the MXP
- */
- @AssistedInject
- public DigitalInputWPIAdapter(@Assisted("channel") int channel, DevicePolice police) {
- super(police, channel);
- adapter = new DigitalInput(channel);
- }
-
- /**
- * Get the value from a digital input channel. Retrieve the value of a single digital input channel from the FPGA.
- *
- * @return the status of the digital input
- */
- protected boolean getRaw() {
- return adapter.get();
- }
-
- /**
- * Get the channel of the digital input
- *
- * @return The GPIO channel number that this object represents.
- */
- public int getChannel() {
- return adapter.getChannel();
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/wpi_adapters/DutyCycleEncoderWpiAdapter.java b/src/main/java/xbot/common/controls/sensors/wpi_adapters/DutyCycleEncoderWpiAdapter.java
deleted file mode 100644
index afa208ea..00000000
--- a/src/main/java/xbot/common/controls/sensors/wpi_adapters/DutyCycleEncoderWpiAdapter.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package xbot.common.controls.sensors.wpi_adapters;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-import edu.wpi.first.wpilibj.DutyCycleEncoder;
-import xbot.common.controls.sensors.XDutyCycleEncoder;
-import xbot.common.controls.sensors.mock_adapters.MockDutyCycleEncoder;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.electrical_contract.DeviceInfo;
-
-public class DutyCycleEncoderWpiAdapter extends XDutyCycleEncoder {
-
- DutyCycleEncoder internalEncoder;
-
- @AssistedFactory
- public abstract static class DutyCycleEncoderWpiAdapterFactory implements XDutyCycleEncoder.XDutyCycleEncoderFactory {
- public abstract DutyCycleEncoderWpiAdapter create(@Assisted("info") DeviceInfo info);
- }
-
- @AssistedInject
- public DutyCycleEncoderWpiAdapter(@Assisted("info") DeviceInfo info, DevicePolice police) {
- super(info, police);
- internalEncoder = new DutyCycleEncoder(info.channel);
- }
-
- @Override
- protected double getAbsoluteRawPosition() {
- return internalEncoder.get();
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/wpi_adapters/EncoderWPIAdapter.java b/src/main/java/xbot/common/controls/sensors/wpi_adapters/EncoderWPIAdapter.java
deleted file mode 100644
index a113ae46..00000000
--- a/src/main/java/xbot/common/controls/sensors/wpi_adapters/EncoderWPIAdapter.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package xbot.common.controls.sensors.wpi_adapters;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-import edu.wpi.first.wpilibj.Encoder;
-import xbot.common.controls.sensors.XEncoder;
-import xbot.common.injection.DevicePolice;
-import xbot.common.properties.PropertyFactory;
-
-public class EncoderWPIAdapter extends XEncoder {
-
- Encoder internalEncoder;
-
- @AssistedFactory
- public abstract static class EncoderWPIAdapterFactory implements XEncoderFactory {
- public abstract EncoderWPIAdapter create(
- @Assisted("name") String name,
- @Assisted("aChannel") int aChannel,
- @Assisted("bChannel") int bChannel,
- @Assisted("defaultDistancePerPulse") double defaultDistancePerPulse);
- }
-
- @AssistedInject
- public EncoderWPIAdapter(
- @Assisted("name")String name,
- @Assisted("aChannel") int aChannel,
- @Assisted("bChannel") int bChannel,
- @Assisted("defaultDistancePerPulse") double defaultDistancePerPulse,
- PropertyFactory propMan,
- DevicePolice police) {
- super(name, aChannel, bChannel, defaultDistancePerPulse, propMan, police);
- internalEncoder = new Encoder(aChannel, bChannel);
- }
-
- protected double getRate() {
- return internalEncoder.getRate();
- }
-
- protected double getDistance() {
- return internalEncoder.getDistance();
- }
-
- public void setSamplesToAverage(int samples) {
- internalEncoder.setSamplesToAverage(samples);
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/wpi_adapters/FTCGamepadWpiAdapter.java b/src/main/java/xbot/common/controls/sensors/wpi_adapters/FTCGamepadWpiAdapter.java
deleted file mode 100644
index 26c24ace..00000000
--- a/src/main/java/xbot/common/controls/sensors/wpi_adapters/FTCGamepadWpiAdapter.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package xbot.common.controls.sensors.wpi_adapters;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import edu.wpi.first.wpilibj.GenericHID;
-import edu.wpi.first.wpilibj.Joystick;
-import xbot.common.controls.sensors.XFTCGamepad;
-import xbot.common.controls.sensors.buttons.AdvancedJoystickButtonTrigger.AdvancedJoystickButtonTriggerFactory;
-import xbot.common.controls.sensors.buttons.AdvancedPovButtonTrigger.AdvancedPovButtonTriggerFactory;
-import xbot.common.controls.sensors.buttons.AnalogHIDButtonTrigger.AnalogHIDButtonTriggerFactory;
-import xbot.common.injection.DevicePolice;
-import xbot.common.logging.RobotAssertionManager;
-
-public class FTCGamepadWpiAdapter extends XFTCGamepad {
-
- private GenericHID internalHID;
-
- @AssistedFactory
- public abstract static class FTCGamepadWpiAdapterFactory implements XFTCGamepadFactory {
- public abstract FTCGamepadWpiAdapter create(
- @Assisted("port") int port,
- @Assisted("numButtons") int numButtons);
- }
-
- @AssistedInject
- public FTCGamepadWpiAdapter(
- @Assisted("port") int port,
- @Assisted("numButtons") int numButtons,
- AdvancedJoystickButtonTriggerFactory joystickButtonFactory,
- AdvancedPovButtonTriggerFactory povButtonFactory,
- AnalogHIDButtonTriggerFactory analogHidButtonFactory,
- RobotAssertionManager assertionManager,
- DevicePolice police) {
- super(port, joystickButtonFactory, povButtonFactory, analogHidButtonFactory, assertionManager, numButtons, police);
-
- internalHID = new Joystick(port);
- }
-
- protected double getX() {
- return internalHID.getRawAxis(0);
- }
-
- protected double getY() {
- return internalHID.getRawAxis(1);
- }
-
- public double getRawAxis(int axisNumber) {
- return this.internalHID.getRawAxis(axisNumber);
- }
-
- public boolean getButton(int button) {
- return this.internalHID.getRawButton(button);
- }
-
- @Override
- public int getPOV() {
- return this.internalHID.getPOV();
- }
-
- @Override
- public GenericHID getGenericHID() {
- return internalHID;
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/wpi_adapters/InertialMeasurementUnitAdapter.java b/src/main/java/xbot/common/controls/sensors/wpi_adapters/InertialMeasurementUnitAdapter.java
deleted file mode 100644
index 50b128ea..00000000
--- a/src/main/java/xbot/common/controls/sensors/wpi_adapters/InertialMeasurementUnitAdapter.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package xbot.common.controls.sensors.wpi_adapters;
-
-import com.kauailabs.navx.frc.AHRS;
-
-import org.apache.log4j.Logger;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import edu.wpi.first.wpilibj.I2C;
-import edu.wpi.first.wpilibj.SPI;
-import edu.wpi.first.wpilibj.SerialPort;
-import xbot.common.controls.sensors.XGyro;
-import xbot.common.injection.DevicePolice;
-import xbot.common.injection.DevicePolice.DeviceType;
-
-public class InertialMeasurementUnitAdapter extends XGyro {
-
- AHRS ahrs;
- boolean isBroken = false;
-
- static Logger log = Logger.getLogger(InertialMeasurementUnitAdapter.class);
-
- @AssistedFactory
- public abstract static class InertialMeasurementUnitAdapterFactory extends XGyroFactory {
- public abstract InertialMeasurementUnitAdapter create(@Assisted SPI.Port spiPort, @Assisted SerialPort.Port serialPort, @Assisted I2C.Port i2cPort);
- }
-
- @AssistedInject
- public InertialMeasurementUnitAdapter(DevicePolice police, @Assisted SPI.Port spiPort, @Assisted SerialPort.Port serialPort, @Assisted I2C.Port i2cPort) {
- super(ImuType.navX);
- /* Options: Port.kMXP, SPI.kMXP, I2C.kMXP or SerialPort.kUSB */
- try {
- if (spiPort != null) {
- this.ahrs = new AHRS(spiPort);
- police.registerDevice(DeviceType.SPI, spiPort.value, this);
- } else if (serialPort != null) {
- this.ahrs = new AHRS(serialPort);
- police.registerDevice(DeviceType.IMU, serialPort.value, this);
- } else if (i2cPort != null) {
- this.ahrs = new AHRS(i2cPort);
- police.registerDevice(DeviceType.I2C, i2cPort.value, this);
- } else {
- throw new Exception("No port provided");
- }
- log.info("AHRS successfully created");
- }
- catch (Exception e){
- isBroken = true;
- log.warn("AHRS could not be created - gyro is broken!");
- }
- }
-
- @Override
- public boolean isConnected() {
- return this.ahrs.isConnected();
- }
-
- protected double getDeviceYaw() {
- return -this.ahrs.getYaw();
- }
-
- @Override
- public double getDeviceRoll() {
- return -this.ahrs.getRoll();
- }
-
- @Override
- public double getDevicePitch() {
- return -this.ahrs.getPitch();
- }
-
- @Override
- public boolean isBroken() {
- return isBroken;
- }
-
- /**
- * Note: this is in degrees per second.
- */
- public double getDeviceYawAngularVelocity(){
- return ahrs.getRate();
- }
-
- @Override
- public double getDeviceVelocityX() {
- return ahrs.getVelocityX();
- }
-
- @Override
- public double getDeviceVelocityY() {
- return ahrs.getVelocityY();
- }
-
- @Override
- public double getDeviceVelocityZ() {
- return ahrs.getVelocityZ();
- }
-
- @Override
- public double getDeviceRawAccelX() {
- return ahrs.getRawAccelX();
- }
-
- @Override
- public double getDeviceRawAccelY() {
- return ahrs.getRawAccelY();
- }
-
- @Override
- public double getDeviceRawAccelZ() {
- return ahrs.getRawAccelZ();
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/wpi_adapters/JoystickWPIAdapter.java b/src/main/java/xbot/common/controls/sensors/wpi_adapters/JoystickWPIAdapter.java
deleted file mode 100644
index 484b1e2a..00000000
--- a/src/main/java/xbot/common/controls/sensors/wpi_adapters/JoystickWPIAdapter.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package xbot.common.controls.sensors.wpi_adapters;
-
-import xbot.common.controls.sensors.XJoystick;
-import xbot.common.controls.sensors.buttons.AdvancedJoystickButtonTrigger.AdvancedJoystickButtonTriggerFactory;
-import xbot.common.controls.sensors.buttons.AdvancedPovButtonTrigger.AdvancedPovButtonTriggerFactory;
-import xbot.common.controls.sensors.buttons.AnalogHIDButtonTrigger.AnalogHIDButtonTriggerFactory;
-import xbot.common.injection.DevicePolice;
-import xbot.common.logging.RobotAssertionManager;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import edu.wpi.first.wpilibj.GenericHID;
-import edu.wpi.first.wpilibj.Joystick;
-
-public class JoystickWPIAdapter extends XJoystick {
-
- private GenericHID internalHID;
-
- @AssistedFactory
- public abstract static class JoystickWPIAdapterFactory implements XJoystickFactory {
- @Override
- public abstract JoystickWPIAdapter create(@Assisted("port") int port, @Assisted("numButtons") int numButtons);
- }
-
- @AssistedInject
- public JoystickWPIAdapter(
- @Assisted("port") int port,
- @Assisted("numButtons") int numButtons,
- AdvancedJoystickButtonTriggerFactory joystickButtonFactory,
- AdvancedPovButtonTriggerFactory povButtonFactory,
- AnalogHIDButtonTriggerFactory analogHidButtonFactory,
- RobotAssertionManager assertionManager,
- DevicePolice police) {
- super(port, joystickButtonFactory, povButtonFactory, analogHidButtonFactory, assertionManager, numButtons, police);
-
- internalHID = new Joystick(port);
- }
-
- protected double getX() {
- return internalHID.getRawAxis(0);
- }
-
- protected double getY() {
- return internalHID.getRawAxis(1);
- }
-
- public double getRawAxis(int axisNumber) {
- return this.internalHID.getRawAxis(axisNumber);
- }
-
- public boolean getButton(int button) {
- return this.internalHID.getRawButton(button);
- }
-
- @Override
- public int getPOV() {
- return this.internalHID.getPOV();
- }
-
- @Override
- public GenericHID getGenericHID() {
- return internalHID;
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/wpi_adapters/LidarLiteWpiAdapter.java b/src/main/java/xbot/common/controls/sensors/wpi_adapters/LidarLiteWpiAdapter.java
deleted file mode 100644
index 9d6890f6..00000000
--- a/src/main/java/xbot/common/controls/sensors/wpi_adapters/LidarLiteWpiAdapter.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package xbot.common.controls.sensors.wpi_adapters;
-
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-import edu.wpi.first.wpilibj.I2C;
-import edu.wpi.first.wpilibj.I2C.Port;
-import xbot.common.controls.sensors.XLidarLite;
-import xbot.common.controls.sensors.XTimer;
-import xbot.common.injection.DevicePolice;
-import xbot.common.properties.PropertyFactory;
-
-public class LidarLiteWpiAdapter extends XLidarLite{
-
- private I2C i2c;
-
- @AssistedFactory
- public abstract static class LidarLiteWpiAdapterFactory implements XLidarLiteFactory {
- public abstract LidarLiteWpiAdapter create(@Assisted("port") Port port, @Assisted("prefix") String prefix);
- }
-
- @AssistedInject
- public LidarLiteWpiAdapter(@Assisted("port") Port port, PropertyFactory propMan, DevicePolice police, @Assisted("prefix") String prefix) {
- super(port, propMan, police, prefix);
-
- i2c = new I2C(port, lidar_address);
- }
-
- @Override
- // Update distance variable
- public void update() {
- i2c.write(lidar_config_register, 0x04); // Initiate measurement
- XTimer.delay(0.04); // Delay for measurement to be taken
- i2c.read(lidar_distance_register, 2, distance); // Read in measurement
- XTimer.delay(0.01); // Delay to prevent over polling
- }
-
-}
diff --git a/src/main/java/xbot/common/controls/sensors/wpi_adapters/PowerDistributionPanelWPIAdapter.java b/src/main/java/xbot/common/controls/sensors/wpi_adapters/PowerDistributionPanelWPIAdapter.java
deleted file mode 100644
index 84935590..00000000
--- a/src/main/java/xbot/common/controls/sensors/wpi_adapters/PowerDistributionPanelWPIAdapter.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package xbot.common.controls.sensors.wpi_adapters;
-
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import edu.wpi.first.wpilibj.PowerDistribution;
-import xbot.common.controls.sensors.XPowerDistributionPanel;
-
-public class PowerDistributionPanelWPIAdapter extends XPowerDistributionPanel {
-
- private PowerDistribution pdp;
-
- @AssistedFactory
- public abstract static class PowerDistributionPanelWPIAdapaterFactory implements XPowerDistributionPanelFactory {
- @Override
- public abstract PowerDistributionPanelWPIAdapter create();
- }
-
- @AssistedInject
- public PowerDistributionPanelWPIAdapter() {
- pdp = new PowerDistribution();
- }
-
- @Override
- public double getCurrent(int channel) {
- return pdp.getCurrent(channel);
- }
-}
diff --git a/src/main/java/xbot/common/controls/sensors/wpi_adapters/TimerWpiAdapter.java b/src/main/java/xbot/common/controls/sensors/wpi_adapters/TimerWpiAdapter.java
deleted file mode 100644
index 42ed3b5f..00000000
--- a/src/main/java/xbot/common/controls/sensors/wpi_adapters/TimerWpiAdapter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package xbot.common.controls.sensors.wpi_adapters;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import edu.wpi.first.wpilibj.Timer;
-import xbot.common.controls.sensors.XSettableTimerImpl;
-
-@Singleton
-public class TimerWpiAdapter implements XSettableTimerImpl {
-
- @Inject
- public TimerWpiAdapter() {}
-
- @Override
- public double getFPGATimestamp() {
- return Timer.getFPGATimestamp();
- }
-
- @Override
- public double getMatchTime() {
- return Timer.getMatchTime();
- }
-
- @Override
- public void delay(double seconds) {
- Timer.delay(seconds);
- }
-
- @Override
- public void setTimeInSeconds(double time) {
- // Deliberately do nothing.
- }
-
- @Override
- public void advanceTimeInSecondsBy(double time) {
- // Deliberately do nothing.
- }
-}
\ No newline at end of file
diff --git a/src/main/java/xbot/common/controls/sensors/wpi_adapters/XboxControllerWpiAdapter.java b/src/main/java/xbot/common/controls/sensors/wpi_adapters/XboxControllerWpiAdapter.java
deleted file mode 100644
index 23ebecb0..00000000
--- a/src/main/java/xbot/common/controls/sensors/wpi_adapters/XboxControllerWpiAdapter.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package xbot.common.controls.sensors.wpi_adapters;
-
-import xbot.common.controls.sensors.XXboxController;
-import xbot.common.controls.sensors.buttons.AdvancedJoystickButtonTrigger.AdvancedJoystickButtonTriggerFactory;
-import xbot.common.controls.sensors.buttons.AdvancedPovButtonTrigger.AdvancedPovButtonTriggerFactory;
-import xbot.common.controls.sensors.buttons.AnalogHIDButtonTrigger.AnalogHIDButtonTriggerFactory;
-import xbot.common.injection.DevicePolice;
-import xbot.common.logging.RobotAssertionManager;
-import xbot.common.subsystems.feedback.XRumbleManager.XRumbleManagerFactory;
-import dagger.assisted.Assisted;
-import dagger.assisted.AssistedFactory;
-import dagger.assisted.AssistedInject;
-
-import edu.wpi.first.wpilibj.GenericHID;
-import edu.wpi.first.wpilibj.XboxController;
-
-public class XboxControllerWpiAdapter extends XXboxController {
-
- protected XboxController controller;
-
- @AssistedFactory
- public abstract static class XboxControllerWpiAdapterFactory implements XXboxControllerFactory {
- public abstract XboxControllerWpiAdapter create(@Assisted("port") int port);
- }
-
- @AssistedInject
- public XboxControllerWpiAdapter(@Assisted("port") int port, AdvancedJoystickButtonTriggerFactory joystickButtonFactory,
- AdvancedPovButtonTriggerFactory povButtonFactory, AnalogHIDButtonTriggerFactory analogHidButtonFactory,
- XRumbleManagerFactory rumbleManagerFactory, RobotAssertionManager manager, DevicePolice police) {
- super(port, joystickButtonFactory, povButtonFactory, analogHidButtonFactory, rumbleManagerFactory, manager,
- police);
- controller = new XboxController(port);
- }
-
- @Override
- public double getRawAxis(int axis) {
- return controller.getRawAxis(axis);
- }
-
- @Override
- public boolean getButton(int button) {
- return controller.getRawButton(button);
- }
-
- @Override
- public GenericHID getGenericHID() {
- return controller;
- }
-
- @Override
- public int getPOV() {
- return controller.getPOV();
- }
-
- @Override
- protected double getLeftRawTriggerAxis() {
- return controller.getLeftTriggerAxis();
- }
-
- @Override
- protected double getRightRawTriggerAxis() {
- return controller.getRightTriggerAxis();
- }
-
- @Override
- protected double getLeftRawX() {
- return controller.getLeftX();
- }
-
- @Override
- protected double getLeftRawY() {
- return controller.getLeftY();
- }
-
- @Override
- protected double getRightRawX() {
- return controller.getRightX();
- }
-
- @Override
- protected double getRightRawY() {
- return controller.getRightY();
- }
-}
diff --git a/src/main/java/xbot/common/injection/BaseWPITest.java b/src/main/java/xbot/common/injection/BaseWPITest.java
deleted file mode 100644
index 3c2a5b03..00000000
--- a/src/main/java/xbot/common/injection/BaseWPITest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package xbot.common.injection;
-
-import org.apache.log4j.xml.DOMConfigurator;
-import org.junit.Before;
-import org.junit.Ignore;
-
-import edu.wpi.first.wpilibj.MockTimer;
-import xbot.common.controls.sensors.XTimer;
-import xbot.common.injection.components.BaseComponent;
-import xbot.common.math.PIDManager.PIDManagerFactory;
-import xbot.common.properties.PropertyFactory;
-
-@Ignore
-public abstract class BaseWPITest {
- private BaseComponent injectorComponent;
-
- public PropertyFactory propertyFactory;
-
- protected PIDManagerFactory pf;
-
- protected MockTimer timer;
-
- /**
- * Returns the {@link BaseComponent} instance used for dependency injection
- */
- protected abstract BaseComponent createDaggerComponent();
-
- protected BaseComponent getInjectorComponent() {
- return injectorComponent;
- }
-
- @Before
- public void setUp() {
- injectorComponent = createDaggerComponent();
- timer = (MockTimer)injectorComponent.timerImplementation();
- XTimer.setImplementation(timer);
-
- propertyFactory = injectorComponent.propertyFactory();
-
- pf = injectorComponent.pidFactory();
-
- DOMConfigurator.configure(getClass().getClassLoader().getResource("log4j4unitTesting.xml"));
- }
-}
diff --git a/src/main/java/xbot/common/injection/DevicePolice.java b/src/main/java/xbot/common/injection/DevicePolice.java
deleted file mode 100644
index 184ee02e..00000000
--- a/src/main/java/xbot/common/injection/DevicePolice.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package xbot.common.injection;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import xbot.common.logging.RobotAssertionManager;
-
-/**
- * Tracks how many devices are registered and prevents incorrectly re-using devices
- */
-@Singleton
-public class DevicePolice {
-
- RobotAssertionManager assertionManager;
- /**
- * A list of all the channels in use, and what device is using them.
- */
- public Map registeredChannels;
- /**
- * A list of all the devices in use
- */
- public List