diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..d45b35f --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,42 @@ +# Java Gradle CircleCI 2.0 configuration file +# +# Check https://circleci.com/docs/2.0/language-java/ for more details +# +version: 2 +jobs: + build: + docker: + # specify the version you desire here + - image: circleci/openjdk:8-jdk + + # Specify service dependencies here if necessary + # CircleCI maintains a library of pre-built images + # documented at https://circleci.com/docs/2.0/circleci-images/ + # - image: circleci/postgres:9.4 + + working_directory: ~/repo + + environment: + # Customize the JVM maximum heap limit + JVM_OPTS: -Xmx3200m + TERM: dumb + + steps: + - checkout + + # Download and cache dependencies + - restore_cache: + keys: + - v1-dependencies-{{ checksum "build.gradle" }} + # fallback to using the latest cache if no exact match is found + - v1-dependencies- + + - run: gradle dependencies + + - save_cache: + paths: + - ~/.gradle + key: v1-dependencies-{{ checksum "build.gradle" }} + + # run tests! + - run: gradle test \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5d03b3b..8f4523b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,73 +1,10 @@ -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff: -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/dictionaries - -# Sensitive or high-churn files: -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.xml -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml - -# Gradle: -.idea/**/gradle.xml -.idea/**/libraries - -# CMake -cmake-build-debug/ - -# Mongo Explorer plugin: -.idea/**/mongoSettings.xml - -## File-based project format: -*.iws - -## Plugin-specific files: - -# IntelliJ +.gradle/ +.idea/ +build/ out/ - -# Project -src/test/ -src/main/java/META-INF/ -.idea/artifacts/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# maven -src/main/target/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - - -.gradle -/build/ - -# Ignore Gradle GUI config -gradle-app.setting - -# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) -!gradle-wrapper.jar - -# Cache of project -.gradletasknamecache - -# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 -# gradle/wrapper/gradle-wrapper.properties +.settings +.classpath +.project +*.iws +*.iml +*.MF \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 3446932..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 2a6099a..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 2e3ae80..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/Alloy_main.iml b/.idea/modules/Alloy_main.iml deleted file mode 100644 index d180623..0000000 --- a/.idea/modules/Alloy_main.iml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index fdbb606..0000000 --- a/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: java -jdk: -- oraclejdk8 -before_install: -- chmod +x gradlew diff --git a/Alloy.iml b/Alloy.iml deleted file mode 100644 index fea8e87..0000000 --- a/Alloy.iml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/README.md b/README.md index 541dd50..d69aae6 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,69 @@ -# Alloy  [![Build Status](https://travis-ci.org/GarrettBurroughs/Alloy.svg?branch=master)](https://travis-ci.org/GarrettBurroughs/Alloy) [![CodeFactor](https://www.codefactor.io/repository/github/garrettburroughs/alloy/badge)](https://www.codefactor.io/repository/github/garrettburroughs/alloy) - -![AlloyLogo](http://gdurl.com/AFl8) - -Status: **Beta** - - -Alloy is a robot framework designed specifically for the First Tech Challenge (FTC). - -Alloy is based off the FRC robot framework [Sprocket](https://github.com/MontclairRobotics/Sprocket), but redesigned to abstract away the more complex ideas but still allow for advanced robot functionality. +# Alloy [![CircleCI](https://circleci.com/gh/MontclairRobotics/Alloy.svg?style=svg)](https://circleci.com/gh/MontclairRobotics/Alloy) [![CodeFactor](https://www.codefactor.io/repository/github/montclairrobotics/alloy/badge)](https://www.codefactor.io/repository/github/montclairrobotics/alloy) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/f3335dca15a8429ebc50528ca6330411)](https://www.codacy.com/project/garrett_2/Alloy/dashboard?utm_source=github.com&utm_medium=referral&utm_content=GarrettBurroughs/Alloy&utm_campaign=Badge_Grade_Dashboard) + +![AlloyLogo](http://gdurl.com/AFl8) + +Status: **Beta** + + +Alloy is a robot framework designed specifically for the First Tech Challenge (FTC). + +Alloy is based off the FRC robot framework [Sprocket](https://github.com/MontclairRobotics/Sprocket), but redesigned to abstract away the more complex ideas but still allow for advanced robot functionality. + +Note: Alloy is still under heavy development, and not ready or suggested for use in creating a robot + +Developed by FTC147 and FRC555 + +The goal of Alloy is to provide a robot framework that allows anyone, including new programmers, to be able to implement +high functioning and quality code for their robots. In other terms, Alloy aims to prevent robot code from being a limiting +factor on the performance of the robot. + + +Alloy is a robot framework designed specifically for the First Tech Challenge (FTC), but is also designed +with expandibility in mind. FRC implementation is possible and will be coming in the future. + +Alloy is based off the FRC robot framework [Sprocket](https://github.com/MontclairRobotics/Sprocket), but redesigned to abstract away the more complex ideas but still allow for advanced robot functionality. + +Any information regarding Alloy, including how it works, project structure, as well as in-depth explanation on how to use all of the components +can be found in the project [Wiki](https://github.com/GarrettBurroughs/Alloy/wiki) as well as a [quick start guide](https://github.com/GarrettBurroughs/Alloy/wiki/Getting-Started). + + +## Formatting +Alloy uses the [Spotless](https://github.com/diffplug/spotless/tree/master/plugin-gradle) code formatter to ensure that +all of the code follows a specific format. It is added as a build step for a gradle +build so this means that all code in alloy must be compliant to be merged. +Spotless allows for automatic code formatting, just run: +``` +cmd> gradlew spotlessApply +:spotlessApply +BUILD SUCCESSFUL + +cmd> gradlew build +BUILD SUCCESSFUL +``` + + +# FAQ + +### Q. What is the purpose of/how do I use ___? + +A. Every class is heavily documented as well as wiki articles explaining the use of more complex/important parts of alloy + +### Q. I tried to update ___ method using @Update, but it isn't working? + +A. The way alloy is designed, is that everything is split up into components, and a method can only be updated if it is within a component. +you can read more about this topic [Here](https://github.com/GarrettBurroughs/Alloy/wiki/Alloy-Update-System) + +### Q. What is a component/what is the difference between the components? +A. Different components have different purposes, for example, a control component would be used for an advanced control system, +whereas a motor component, or motor ocmponent group would be used to control a drivetrain or manipulator + +### Q. What if I don't want to use components? + +A. Things can be done in alloy without the use of components, but if you are designing code for a specific tool or component on the robot, +such as a shooter, drivetrain, or control system, it is highly recommended as components add extra functionality like toggleability, +easier debugging, and updateable methods. But again, all of this can be done without the use of components. + +### Q. ___ isn't working. + +A. If you have a problem first see our [Troubleshooting guide](https://github.com/GarrettBurroughs/Alloy/wiki/Troubleshooting-Guide). If that does not fix your problem you can file an [Issue](https://github.com/GarrettBurroughs/Alloy/issues/new) +using our issue template, please provide as much information as possible so we can fully understand the probelm and fix the issue. diff --git a/SpotlessLicense b/SpotlessLicense new file mode 100644 index 0000000..88d4450 --- /dev/null +++ b/SpotlessLicense @@ -0,0 +1,23 @@ +/* +MIT License + +Copyright (c) $YEAR Garrett Burroughs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ diff --git a/build.gradle b/build.gradle index 57830b3..36a2ce2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,25 +1,93 @@ -apply plugin: 'java' -apply plugin: 'maven' +buildscript { + repositories { + jcenter() + } + dependencies { + //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory + classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.8.1" + } +} +plugins { + id "com.diffplug.gradle.spotless" version "3.10.0" + id 'java' + id 'maven' + id 'maven-publish' +} -group = 'Alloy' -version = '0.0.1-SNAPSHOT' +allprojects { + apply plugin: "com.jfrog.artifactory" +} -description = """Alloy""" +def usr = hasProperty('artifactory_user') ? artifactory_user : System.getenv('artifactory_user') +def pwd = hasProperty('artifactory_password') ? artifactory_password : System.getenv('artifactory_password') -sourceCompatibility = 1.8 -targetCompatibility = 1.8 +def snapshot = false +group = 'org.montclairrobotics' +version = "0.0.1${snapshot ? "-SNAPSHOT" : ""}" -repositories { - - maven { url "http://repo.maven.apache.org/maven2" } +description = """Alloy""" +sourceCompatibility = 1.8 +targetCompatibility = 1.8 +repositories { + maven { url "http://repo.maven.apache.org/maven2" } + jcenter() } dependencies{ + testCompile 'junit:junit:4.12' compile fileTree(dir: "src/main/libs/", include: ['*.jar']) compile 'org.reflections:reflections:0.9.11' + } + +spotless { + java { + googleJavaFormat('1.1').aosp() + + + licenseHeaderFile 'SpotlessLicense' + paddedCell() + } +} + + +publishing { + publications { + Alloy(MavenPublication) { + from components.java + } + } +} + + +artifactory { + contextUrl = "http://67.205.146.144:8081/artifactory" //The base Artifactory URL if not overridden by the publisher/resolver + publish { + repository { + repoKey = "libs-${snapshot ? "snapshot" : "release"}-local" + username = "${usr}" + password = "${pwd}" + maven = true + + } + defaults{ + publications('Alloy') + publishPom = true + } + } + resolve { + repository { + repoKey = "libs-${snapshot ? "snapshot" : "release"}-local" + username = "${usr}" + password = "${pwd}" + maven = true + + } + } +} + diff --git a/docs/_config.yml b/docs/_config.yml new file mode 100644 index 0000000..c50ff38 --- /dev/null +++ b/docs/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-merlot \ No newline at end of file diff --git a/docs/javadoc/allclasses-frame.html b/docs/javadoc/allclasses-frame.html new file mode 100644 index 0000000..1614a93 --- /dev/null +++ b/docs/javadoc/allclasses-frame.html @@ -0,0 +1,85 @@ + + + + + +All Classes + + + + + +

All Classes

+
+ +
+ + diff --git a/docs/javadoc/allclasses-noframe.html b/docs/javadoc/allclasses-noframe.html new file mode 100644 index 0000000..3daf2ce --- /dev/null +++ b/docs/javadoc/allclasses-noframe.html @@ -0,0 +1,85 @@ + + + + + +All Classes + + + + + +

All Classes

+
+ +
+ + diff --git a/docs/javadoc/constant-values.html b/docs/javadoc/constant-values.html new file mode 100644 index 0000000..d6eeae3 --- /dev/null +++ b/docs/javadoc/constant-values.html @@ -0,0 +1,122 @@ + + + + + +Constant Field Values + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
+

Constant Field Values

+

Contents

+
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/deprecated-list.html b/docs/javadoc/deprecated-list.html new file mode 100644 index 0000000..8ccd240 --- /dev/null +++ b/docs/javadoc/deprecated-list.html @@ -0,0 +1,122 @@ + + + + + +Deprecated List + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/help-doc.html b/docs/javadoc/help-doc.html new file mode 100644 index 0000000..0532bcc --- /dev/null +++ b/docs/javadoc/help-doc.html @@ -0,0 +1,223 @@ + + + + + +API Help + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+ +This help file applies to API documentation generated using the standard doclet.
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-1.html b/docs/javadoc/index-files/index-1.html new file mode 100644 index 0000000..fd7123b --- /dev/null +++ b/docs/javadoc/index-files/index-1.html @@ -0,0 +1,205 @@ + + + + + +A-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

A

+
+
add(Vector) - Method in class org.montclairrobotics.alloy.vector.Polar
+
+
Adds two vectors together and returns the result
+
+
add(Vector) - Method in interface org.montclairrobotics.alloy.vector.Vector
+
+
Adds two vectors together and returns the result
+
+
add(Vector) - Method in class org.montclairrobotics.alloy.vector.XY
+
+
Adds two vectors together and returns the result
+
+
addDebug(Debug) - Method in class org.montclairrobotics.alloy.components.Component
+
+
Adds a debug to the component, this will be debugged out every loop if debug mode is enabled
+
+
addDebugs(Iterable<? extends Debug>) - Method in class org.montclairrobotics.alloy.components.Component
+
+
Adds multiple debugs to the components, they will be debugged out every loop if debug mode is + enabled
+
+
addState(State) - Method in class org.montclairrobotics.alloy.auto.SimpleAutonomous
+
 
+
addState(State) - Method in class org.montclairrobotics.alloy.auto.StateMachine
+
+
Adds a state to the state machine.
+
+
addStep(Step) - Method in class org.montclairrobotics.alloy.components.InputComponent
+
+
A daisy-chainable method that adds a step to the input component
+
+
addStep(Step) - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
 
+
Alloy - Class in org.montclairrobotics.alloy.core
+
+
The main class that takes care of setting up the environment, and running all of the main methods
+
+
Alloy() - Constructor for class org.montclairrobotics.alloy.core.Alloy
+
 
+
AlloyAutonomous - Class in org.montclairrobotics.alloy.auto
+
+
Created by MHS Robotics on 12/5/2017.
+
+
AlloyAutonomous() - Constructor for class org.montclairrobotics.alloy.auto.AlloyAutonomous
+
 
+
Angle - Class in org.montclairrobotics.alloy.vector
+
+
A class to keep track of angles
+
+
Angle(Angle.AngleMeasure, double) - Constructor for class org.montclairrobotics.alloy.vector.Angle
+
+
Creating a new angle with an angle measure unit and the measure of the angle itself
+
+
Angle(double) - Constructor for class org.montclairrobotics.alloy.vector.Angle
+
+
Creating an angle with degrees
+
+
angleBetween(Vector) - Method in class org.montclairrobotics.alloy.vector.Polar
+
+
gets the angle between two vectors
+
+
angleBetween(Vector) - Method in interface org.montclairrobotics.alloy.vector.Vector
+
+
gets the angle between two vectors
+
+
angleBetween(Vector) - Method in class org.montclairrobotics.alloy.vector.XY
+
+
gets the angle between two vectors
+
+
applySteps() - Method in class org.montclairrobotics.alloy.components.InputComponent
+
+
Apply all of the steps, in order, taking the output of one step and passing it as the input + to the next
+
+
atTargetPosition(double) - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
 
+
auto - Variable in class org.montclairrobotics.alloy.auto.AlloyAutonomous
+
+
The actual auto mode that should be instantiated in setup
+
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-10.html b/docs/javadoc/index-files/index-10.html new file mode 100644 index 0000000..d0917d1 --- /dev/null +++ b/docs/javadoc/index-files/index-10.html @@ -0,0 +1,129 @@ + + + + + +J-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

J

+
+
Joystick - Interface in org.montclairrobotics.alloy.core
+
+
The fundamental outline for all standard 2-axis joysticks
+
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-11.html b/docs/javadoc/index-files/index-11.html new file mode 100644 index 0000000..cd6a285 --- /dev/null +++ b/docs/javadoc/index-files/index-11.html @@ -0,0 +1,129 @@ + + + + + +K-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

K

+
+
key - Variable in class org.montclairrobotics.alloy.core.Debug
+
+
The key, label, or name of the information
+
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-12.html b/docs/javadoc/index-files/index-12.html new file mode 100644 index 0000000..cdc3325 --- /dev/null +++ b/docs/javadoc/index-files/index-12.html @@ -0,0 +1,137 @@ + + + + + +L-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

L

+
+
log(String, Object, Debugger.Level) - Method in class org.montclairrobotics.alloy.core.Debugger
+
+
Debugs a value if the level is lower than the current debug level
+
+
loop() - Method in class org.montclairrobotics.alloy.auto.AlloyAutonomous
+
+
the Loop method takes care of running the state machine
+
+
loop() - Method in class org.montclairrobotics.alloy.core.Alloy
+
 
+
lowOut - Variable in class org.montclairrobotics.alloy.utils.BangBang
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-13.html b/docs/javadoc/index-files/index-13.html new file mode 100644 index 0000000..5238011 --- /dev/null +++ b/docs/javadoc/index-files/index-13.html @@ -0,0 +1,184 @@ + + + + + +M-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

M

+
+
map(DTInput, MotorModule...) - Method in class org.montclairrobotics.alloy.drive.TankMapper
+
 
+
map(Input<Double>, MotorModule...) - Method in class org.montclairrobotics.alloy.motor.DefaultMapper
+
 
+
map(T, MotorModule...) - Method in interface org.montclairrobotics.alloy.motor.Mapper
+
+
map the input to the modules
+
+
map(Vector, MotorModule...) - Method in class org.montclairrobotics.alloy.test.IntakeMapper
+
 
+
map(double, double, double, double, double) - Static method in class org.montclairrobotics.alloy.utils.Utils
+
+
The map function takes an input value that can be between a certain range and maps it to a + specified output range
+
+
Mapper<T> - Interface in org.montclairrobotics.alloy.motor
+
+
A mapper takes an input, and maps it to the set of motor modules
+
+
Mode - Enum in org.montclairrobotics.alloy.core
+
+
All of the different running states that the robot can be in
+
+
Monitor - Class in org.montclairrobotics.alloy.utils
+
+
Created by MHS Robotics on 3/12/2018.
+
+
Monitor(Input<Double>, Input<Double>, double) - Constructor for class org.montclairrobotics.alloy.utils.Monitor
+
 
+
Motor - Interface in org.montclairrobotics.alloy.core
+
+
An outline for all of the basic motor behavior
+
+
motor - Variable in class org.montclairrobotics.alloy.ftc.FTCMotor
+
+
The physical hardware motor reference to the motor being controlled
+
+
MotorGroup<T> - Class in org.montclairrobotics.alloy.motor
+
+
A motor group is a group of motor modules that run together
+
+
MotorGroup(Input, Mapper, MotorModule...) - Constructor for class org.montclairrobotics.alloy.motor.MotorGroup
+
 
+
MotorGroup(Input<Double>, MotorModule...) - Constructor for class org.montclairrobotics.alloy.motor.MotorGroup
+
+
Creates a motor group with a default mapper that simply
+
+
MotorModule - Class in org.montclairrobotics.alloy.motor
+
+
Highly Functional set of motors that run together
+
+
MotorModule(Vector, Encoder, ErrorCorrection<Double>, Motor...) - Constructor for class org.montclairrobotics.alloy.motor.MotorModule
+
+
Create a fully functioning motor module
+
+
MotorModule(Vector, Motor...) - Constructor for class org.montclairrobotics.alloy.motor.MotorModule
+
+
Create motor module without the use of an encoder
+
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-14.html b/docs/javadoc/index-files/index-14.html new file mode 100644 index 0000000..4ba03cc --- /dev/null +++ b/docs/javadoc/index-files/index-14.html @@ -0,0 +1,141 @@ + + + + + +N-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

N

+
+
newState(State) - Method in class org.montclairrobotics.alloy.auto.AlloyAutonomous
+
+
A wrapper around the add state method to allow the user to add states to the auto mode
+
+
normalize() - Method in class org.montclairrobotics.alloy.vector.Polar
+
+
Normalizes a vector and returns the result
+
+
normalize() - Method in interface org.montclairrobotics.alloy.vector.Vector
+
+
Normalizes a vector and returns the result
+
+
normalize() - Method in class org.montclairrobotics.alloy.vector.XY
+
+
Normalizes a vector and returns the result
+
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-15.html b/docs/javadoc/index-files/index-15.html new file mode 100644 index 0000000..cbd500f --- /dev/null +++ b/docs/javadoc/index-files/index-15.html @@ -0,0 +1,185 @@ + + + + + +O-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

O

+
+
onPressed() - Method in class org.montclairrobotics.alloy.control.ButtonAction
+
+
On pressed is called once, when the button goes from being unpressed, to pressed
+
+
onPressed() - Method in class org.montclairrobotics.alloy.control.ToggleButton
+
+
On pressed is called once, when the button goes from being unpressed, to pressed
+
+
onReleased() - Method in class org.montclairrobotics.alloy.control.ButtonAction
+
+
On released is called once, when the button goes from being pressed, to unpressed
+
+
onReleased() - Method in class org.montclairrobotics.alloy.control.ToggleButton
+
+
On released is called once, when the button goes from being pressed, to unpressed
+
+
org.montclairrobotics.alloy.auto - package org.montclairrobotics.alloy.auto
+
 
+
org.montclairrobotics.alloy.auto.States - package org.montclairrobotics.alloy.auto.States
+
 
+
org.montclairrobotics.alloy.components - package org.montclairrobotics.alloy.components
+
 
+
org.montclairrobotics.alloy.control - package org.montclairrobotics.alloy.control
+
 
+
org.montclairrobotics.alloy.core - package org.montclairrobotics.alloy.core
+
 
+
org.montclairrobotics.alloy.drive - package org.montclairrobotics.alloy.drive
+
 
+
org.montclairrobotics.alloy.exceptions - package org.montclairrobotics.alloy.exceptions
+
 
+
org.montclairrobotics.alloy.ftc - package org.montclairrobotics.alloy.ftc
+
 
+
org.montclairrobotics.alloy.motor - package org.montclairrobotics.alloy.motor
+
 
+
org.montclairrobotics.alloy.steps - package org.montclairrobotics.alloy.steps
+
 
+
org.montclairrobotics.alloy.test - package org.montclairrobotics.alloy.test
+
 
+
org.montclairrobotics.alloy.update - package org.montclairrobotics.alloy.update
+
 
+
org.montclairrobotics.alloy.utils - package org.montclairrobotics.alloy.utils
+
 
+
org.montclairrobotics.alloy.vector - package org.montclairrobotics.alloy.vector
+
 
+
out(String, Object) - Method in class org.montclairrobotics.alloy.core.Debugger
+
+
The most basic debug that simply outputs information given a key and value
+
+
out(String, Object) - Method in class org.montclairrobotics.alloy.ftc.FTCDebugger
+
+
The most basic debug that simply outputs information given a key and value
+
+
output - Variable in class org.montclairrobotics.alloy.components.InputComponent
+
+
The value after steps have been applied
+
+
override(String, Object) - Method in class org.montclairrobotics.alloy.core.Debugger
+
+
A message that overrides the debug level system
+
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-16.html b/docs/javadoc/index-files/index-16.html new file mode 100644 index 0000000..439e13b --- /dev/null +++ b/docs/javadoc/index-files/index-16.html @@ -0,0 +1,163 @@ + + + + + +P-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

P

+
+
periodic() - Method in class org.montclairrobotics.alloy.core.Alloy
+
+
Although most of the periodic actions are taken care by the updater, the user may want to add + their own methods and code that need to be updated or run periodically, this can be done in + the periodic() method periodic will be run every loop.
+
+
periodic() - Method in class org.montclairrobotics.alloy.test.TestRobot
+
 
+
PI - Static variable in class org.montclairrobotics.alloy.vector.Angle
+
 
+
PID - Class in org.montclairrobotics.alloy.utils
+
+
Created by Montclair robotics on 2/27/2018
+
+
PID(double, double, double) - Constructor for class org.montclairrobotics.alloy.utils.PID
+
+
Create a new PID
+
+
PID(double, double, double, Input<Double>, double) - Constructor for class org.montclairrobotics.alloy.utils.PID
+
+
Create a new PID with the input and target defined
+
+
Polar - Class in org.montclairrobotics.alloy.vector
+
+
Created by MHS Robotics on 11/14/2017.
+
+
Polar(double, Angle) - Constructor for class org.montclairrobotics.alloy.vector.Polar
+
 
+
pow2(double, int) - Static method in class org.montclairrobotics.alloy.utils.Utils
+
+
A modified power function that conserves the sign
+
+
power - Variable in class org.montclairrobotics.alloy.ftc.FTCMotor
+
+
The power that the motor should be running at
+
+
powerCorrection() - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-17.html b/docs/javadoc/index-files/index-17.html new file mode 100644 index 0000000..a8dc5ac --- /dev/null +++ b/docs/javadoc/index-files/index-17.html @@ -0,0 +1,172 @@ + + + + + +R-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

R

+
+
registerUpdatables() - Static method in class org.montclairrobotics.alloy.update.Updater
+
 
+
reset() - Method in class org.montclairrobotics.alloy.core.Encoder
+
+
soft reset the encoder, setting the current value as 0 ticks
+
+
RobotCore - Class in org.montclairrobotics.alloy.core
+
+
Stores all of the global robot objects, including telemetry, the hardware map, and gamepads
+
+
RobotCore(Telemetry, HardwareMap, Gamepad, Gamepad) - Constructor for class org.montclairrobotics.alloy.core.RobotCore
+
 
+
robotSetup() - Method in class org.montclairrobotics.alloy.core.Alloy
+
+
The robotSetup is where all code specific to robot setup is placed If you only have one + teleop this can be done in the initialization Method.
+
+
robotSetup() - Method in class org.montclairrobotics.alloy.test.TestRobot
+
 
+
rotate(Angle) - Method in class org.montclairrobotics.alloy.vector.Polar
+
+
returns a vector rotated by a given angle
+
+
rotate(Angle) - Method in interface org.montclairrobotics.alloy.vector.Vector
+
+
returns a vector rotated by a given angle
+
+
rotate(Angle) - Method in class org.montclairrobotics.alloy.vector.XY
+
+
returns a vector rotated by a given angle
+
+
run() - Method in class org.montclairrobotics.alloy.auto.State
+
+
The run method is called every loop while the state is running
+
+
run() - Method in class org.montclairrobotics.alloy.auto.StateMachine
+
+
The run method takes care of actually running the states
+
+
run() - Method in class org.montclairrobotics.alloy.auto.States.ConditionalState
+
 
+
run() - Method in class org.montclairrobotics.alloy.auto.States.Drive
+
 
+
run() - Method in class org.montclairrobotics.alloy.auto.States.Turn
+
 
+
run() - Method in class org.montclairrobotics.alloy.update.Updateable
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-18.html b/docs/javadoc/index-files/index-18.html new file mode 100644 index 0000000..823bd43 --- /dev/null +++ b/docs/javadoc/index-files/index-18.html @@ -0,0 +1,424 @@ + + + + + +S-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

S

+
+
scale(double) - Method in class org.montclairrobotics.alloy.vector.Polar
+
+
Scales the vectors magnitude by a scalar value
+
+
scale(double) - Method in interface org.montclairrobotics.alloy.vector.Vector
+
+
Scales the vectors magnitude by a scalar value
+
+
scale(double) - Method in class org.montclairrobotics.alloy.vector.XY
+
+
Scales the vectors magnitude by a scalar value
+
+
setAngle(Angle) - Method in class org.montclairrobotics.alloy.vector.Polar
+
+
Sets the angle in standard position of the vector
+
+
setAngle(Angle) - Method in interface org.montclairrobotics.alloy.vector.Vector
+
+
Sets the angle in standard position of the vector
+
+
setAngle(Angle) - Method in class org.montclairrobotics.alloy.vector.XY
+
+
Sets the angle in standard position of the vector
+
+
setConstantValue(T) - Method in class org.montclairrobotics.alloy.utils.ConstantInput
+
+
Sets the value that the input will return
+
+
setDebugLevel(Debugger.Level) - Static method in class org.montclairrobotics.alloy.core.Debugger
+
+
Set the debug level
+
+
setDefaultInput() - Method in class org.montclairrobotics.alloy.drive.DriveTrain
+
 
+
setDegrees(double) - Method in class org.montclairrobotics.alloy.vector.Angle
+
+
set the angle in degrees
+
+
setDistancePerTick(double) - Method in class org.montclairrobotics.alloy.core.Encoder
+
+
Set the distance per tick
+
+
setDriveTrain(DriveTrain) - Method in class org.montclairrobotics.alloy.auto.States.Drive
+
 
+
setDriveTrain(DriveTrain) - Static method in class org.montclairrobotics.alloy.core.Alloy
+
 
+
setEncoder(Encoder) - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
+
Set an encoder for the module
+
+
setErrorCorrection(ErrorCorrection) - Method in class org.montclairrobotics.alloy.ftc.FTCTargetMotor
+
+
Set the motor to run using a custom Error Correction
+
+
setErrorCorrection(ErrorCorrection) - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
+
set the power control for the module
+
+
setFinalState(Integer) - Method in class org.montclairrobotics.alloy.auto.StateMachine
+
 
+
setInput(Input<T>) - Method in class org.montclairrobotics.alloy.components.InputComponent
+
+
A daisy-chainable method that sets the initial input of the input component
+
+
setInput(Input<T>) - Method in class org.montclairrobotics.alloy.motor.MotorGroup
+
 
+
setInput(Input) - Method in class org.montclairrobotics.alloy.utils.BangBang
+
 
+
setInput(Input<T>) - Method in interface org.montclairrobotics.alloy.utils.ErrorCorrection
+
+
Set the input of the error correction the input should be the source of what correction is + correcting.
+
+
setInput(Input<Double>) - Method in class org.montclairrobotics.alloy.utils.PID
+
 
+
setInput(Input) - Method in class org.montclairrobotics.alloy.utils.TuneablePID
+
+
Set the input of the error correction the input should be the source of what correction is + correcting.
+
+
setInverted(boolean) - Method in interface org.montclairrobotics.alloy.core.Motor
+
+
Sets weather the motor runs the default way , or inverted
+
+
setInverted(boolean) - Method in class org.montclairrobotics.alloy.ftc.FTCMotor
+
+
Sets whether the motor runs the default way , or inverted
+
+
setMagnitude(double) - Method in class org.montclairrobotics.alloy.vector.Polar
+
+
Sets the magnitude of the vector
+
+
setMagnitude(double) - Method in interface org.montclairrobotics.alloy.vector.Vector
+
+
Sets the magnitude of the vector
+
+
setMagnitude(double) - Method in class org.montclairrobotics.alloy.vector.XY
+
+
Sets the magnitude of the vector
+
+
setMapper(Mapper) - Method in class org.montclairrobotics.alloy.motor.MotorGroup
+
 
+
setMaxSpeed(double) - Method in class org.montclairrobotics.alloy.core.Encoder
+
+
Set the max speed (In Ticks per Second) that the motor can run
+
+
setMotorPower(double) - Method in interface org.montclairrobotics.alloy.core.Motor
+
+
Sets the motor Power
+
+
setMotorPower(double) - Method in class org.montclairrobotics.alloy.ftc.FTCMotor
+
+
Sets the motor Power
+
+
setMovementSpeed(double) - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
 
+
setName(String) - Method in class org.montclairrobotics.alloy.auto.StateMachine
+
 
+
setPosition(int) - Method in interface org.montclairrobotics.alloy.core.TargetMotor
+
+
Sets the motor position
+
+
setPosition(int) - Method in class org.montclairrobotics.alloy.ftc.FTCTargetMotor
+
+
Sets the motor position
+
+
setPositionCorrection(ErrorCorrection) - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
 
+
setPower(double) - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
+
Set the target power of the module
+
+
setPowerModifier(InputComponent<Double>) - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
 
+
setRadians(double) - Method in class org.montclairrobotics.alloy.vector.Angle
+
+
set the angle in radians
+
+
setTarget(Double) - Method in class org.montclairrobotics.alloy.utils.BangBang
+
+
Set the target for the correction When the input is equal to the target the error is 0
+
+
setTarget(T) - Method in interface org.montclairrobotics.alloy.utils.ErrorCorrection
+
+
Set the target for the correction When the input is equal to the target the error is 0
+
+
setTarget(Double) - Method in class org.montclairrobotics.alloy.utils.PID
+
 
+
setTarget(Double) - Method in class org.montclairrobotics.alloy.utils.TuneablePID
+
+
Set the target for the correction When the input is equal to the target the error is 0
+
+
setTargetPosition(double) - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
 
+
setTargetPower(double) - Method in interface org.montclairrobotics.alloy.core.TargetMotor
+
+
Sets the motor Power
+
+
setTargetPower(double) - Method in class org.montclairrobotics.alloy.ftc.FTCTargetMotor
+
+
Sets the motor Power
+
+
setTicksPerDegree(double) - Static method in class org.montclairrobotics.alloy.auto.States.Turn
+
 
+
setTolerance(int) - Static method in class org.montclairrobotics.alloy.auto.States.Drive
+
 
+
setTolerance(double) - Static method in class org.montclairrobotics.alloy.auto.States.Turn
+
 
+
setTolerance(int) - Method in class org.montclairrobotics.alloy.steps.Deadzone
+
+
set the threshold value
+
+
setTolerance(double) - Method in class org.montclairrobotics.alloy.steps.VectorDeadzone
+
+
set the threshold value
+
+
setup() - Method in class org.montclairrobotics.alloy.auto.AlloyAutonomous
+
+
This is where the user should define all their code and where "Auto", should be instantiated
+
+
setup() - Method in class org.montclairrobotics.alloy.auto.SimpleAutonomous
+
 
+
setup() - Method in class org.montclairrobotics.alloy.test.SquareAuto
+
 
+
setX(double) - Method in class org.montclairrobotics.alloy.vector.Polar
+
+
Sets the x component of the vector
+
+
setX(double) - Method in interface org.montclairrobotics.alloy.vector.Vector
+
+
Sets the x component of the vector
+
+
setX(double) - Method in class org.montclairrobotics.alloy.vector.XY
+
+
Sets the x component of the vector
+
+
setY(double) - Method in class org.montclairrobotics.alloy.vector.Polar
+
+
Sets the y component of the vector
+
+
setY(double) - Method in interface org.montclairrobotics.alloy.vector.Vector
+
+
Sets the y component of the vector
+
+
setY(double) - Method in class org.montclairrobotics.alloy.vector.XY
+
+
Sets the y component of the vector
+
+
sign(double) - Static method in class org.montclairrobotics.alloy.utils.Utils
+
+
Returns the sign of a number
+
+
SimpleAutonomous - Class in org.montclairrobotics.alloy.auto
+
+
Created by MHS Robotics on 1/26/2018.
+
+
SimpleAutonomous() - Constructor for class org.montclairrobotics.alloy.auto.SimpleAutonomous
+
 
+
sin() - Method in class org.montclairrobotics.alloy.vector.Angle
+
+
get the sine of the angle
+
+
SquareAuto - Class in org.montclairrobotics.alloy.test
+
 
+
SquareAuto() - Constructor for class org.montclairrobotics.alloy.test.SquareAuto
+
 
+
start() - Method in class org.montclairrobotics.alloy.auto.AlloyAutonomous
+
+
Runs when the play button is pressed Start will set up everything that the auto mode needs to + run
+
+
start() - Method in class org.montclairrobotics.alloy.auto.State
+
+
The start method is the first thing called when the state is run
+
+
start() - Method in class org.montclairrobotics.alloy.auto.StateMachine
+
+
Read out that the state has started and reset the timer
+
+
start() - Method in class org.montclairrobotics.alloy.auto.States.ConditionalState
+
 
+
start() - Method in class org.montclairrobotics.alloy.auto.States.Drive
+
 
+
start() - Method in class org.montclairrobotics.alloy.auto.States.Turn
+
 
+
State - Class in org.montclairrobotics.alloy.auto
+
+
Created by MHS Robotics on 12/16/2017.
+
+
State() - Constructor for class org.montclairrobotics.alloy.auto.State
+
 
+
StateMachine - Class in org.montclairrobotics.alloy.auto
+
+
Created by MHS Robotics on 12/16/2017.
+
+
StateMachine(String, int, State...) - Constructor for class org.montclairrobotics.alloy.auto.StateMachine
+
 
+
StateMachine(State...) - Constructor for class org.montclairrobotics.alloy.auto.StateMachine
+
 
+
StateMachine(String, String, int, State...) - Constructor for class org.montclairrobotics.alloy.auto.StateMachine
+
 
+
status - Variable in class org.montclairrobotics.alloy.utils.Toggleable
+
+
The status of the toggleable, to keep track of weather it is enabled, or disabled
+
+
Step<T> - Interface in org.montclairrobotics.alloy.components
+
+
A step is a manipulation or calculation performed on an input
+
+
steps - Variable in class org.montclairrobotics.alloy.components.InputComponent
+
+
An arraylist to store all of the steps
+
+
stop() - Method in class org.montclairrobotics.alloy.auto.State
+
+
The Stop method is the last thing called once the state is done
+
+
stop() - Method in class org.montclairrobotics.alloy.auto.StateMachine
+
+
When the state machine is finished, read out it has finished
+
+
stop() - Method in class org.montclairrobotics.alloy.auto.States.ConditionalState
+
 
+
stop() - Method in class org.montclairrobotics.alloy.auto.States.Drive
+
 
+
stop() - Method in class org.montclairrobotics.alloy.auto.States.Turn
+
 
+
subtract(Vector) - Method in class org.montclairrobotics.alloy.vector.Polar
+
+
Subtracts a vector and returns the result
+
+
subtract(Vector) - Method in interface org.montclairrobotics.alloy.vector.Vector
+
+
Subtracts a vector and returns the result
+
+
subtract(Vector) - Method in class org.montclairrobotics.alloy.vector.XY
+
+
Subtracts a vector and returns the result
+
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-19.html b/docs/javadoc/index-files/index-19.html new file mode 100644 index 0000000..6a1edf3 --- /dev/null +++ b/docs/javadoc/index-files/index-19.html @@ -0,0 +1,212 @@ + + + + + +T-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

T

+
+
tan() - Method in class org.montclairrobotics.alloy.vector.Angle
+
+
get the tangent of the angle
+
+
TankDrive - Class in org.montclairrobotics.alloy.drive
+
 
+
TankDrive(InputComponent<DTInput>, MotorModule...) - Constructor for class org.montclairrobotics.alloy.drive.TankDrive
+
 
+
TankDrive(MotorModule...) - Constructor for class org.montclairrobotics.alloy.drive.TankDrive
+
 
+
TankMapper - Class in org.montclairrobotics.alloy.drive
+
 
+
TankMapper() - Constructor for class org.montclairrobotics.alloy.drive.TankMapper
+
 
+
TankMapper(Vector, Angle) - Constructor for class org.montclairrobotics.alloy.drive.TankMapper
+
 
+
TankMapper(double, double) - Constructor for class org.montclairrobotics.alloy.drive.TankMapper
+
 
+
target - Variable in class org.montclairrobotics.alloy.utils.BangBang
+
 
+
target - Variable in class org.montclairrobotics.alloy.utils.Monitor
+
+
The desired target for the input
+
+
TargetMotor - Interface in org.montclairrobotics.alloy.core
+
+
Target motor is a motor interface for motors that have encoders.
+
+
telemetry - Static variable in class org.montclairrobotics.alloy.core.RobotCore
+
+
Telemetry is used for reading out information on the phones and is useful for debugging, The + telemetry is also used in Debug
+
+
test(String, Object) - Method in class org.montclairrobotics.alloy.core.Debugger
+
+
Information to be displayed when testing a process or mechanism
+
+
TestRobot - Class in org.montclairrobotics.alloy.test
+
 
+
TestRobot() - Constructor for class org.montclairrobotics.alloy.test.TestRobot
+
 
+
timer - Variable in class org.montclairrobotics.alloy.auto.AlloyAutonomous
+
+
A timer to keep track of time in the autoMode
+
+
toggle() - Method in class org.montclairrobotics.alloy.utils.Toggleable
+
+
Switches(Toggles), between the two states, If the toggleable is disabled, enable it If the + toggleable is enabled, disable it
+
+
Toggleable - Class in org.montclairrobotics.alloy.utils
+
+
Created by MHS Robotics on 2/11/2018.
+
+
Toggleable() - Constructor for class org.montclairrobotics.alloy.utils.Toggleable
+
 
+
Toggleable.Status - Enum in org.montclairrobotics.alloy.utils
+
 
+
ToggleButton - Class in org.montclairrobotics.alloy.control
+
+
A ToggleButton is tied to a button and a toggleable, when the button is pressed the toggleable + will toggle between states
+
+
ToggleButton(Button, Toggleable) - Constructor for class org.montclairrobotics.alloy.control.ToggleButton
+
 
+
tolerance - Variable in class org.montclairrobotics.alloy.utils.Monitor
+
+
How far the input can be away from the target while still being true
+
+
toPosition() - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
 
+
TuneablePID - Class in org.montclairrobotics.alloy.utils
+
+
A PID class that takes in tunable inputs to make PID tuning easier
+
+
TuneablePID() - Constructor for class org.montclairrobotics.alloy.utils.TuneablePID
+
 
+
turn(double, Angle) - Method in class org.montclairrobotics.alloy.auto.SimpleAutonomous
+
 
+
Turn - Class in org.montclairrobotics.alloy.auto.States
+
+
Created by MHS Robotics on 1/26/2018.
+
+
Turn(double, Angle) - Constructor for class org.montclairrobotics.alloy.auto.States.Turn
+
 
+
TWO_PI - Static variable in class org.montclairrobotics.alloy.vector.Angle
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-2.html b/docs/javadoc/index-files/index-2.html new file mode 100644 index 0000000..8668d3c --- /dev/null +++ b/docs/javadoc/index-files/index-2.html @@ -0,0 +1,156 @@ + + + + + +B-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

B

+
+
BangBang - Class in org.montclairrobotics.alloy.utils
+
+
Simple error correction, that returns one value if the error is high, and another if it is low
+
+
BangBang(double, double) - Constructor for class org.montclairrobotics.alloy.utils.BangBang
+
 
+
BangBang(double) - Constructor for class org.montclairrobotics.alloy.utils.BangBang
+
 
+
BooleanToggle - Class in org.montclairrobotics.alloy.utils
+
+
An input that can be toggled between true and false
+
+
BooleanToggle() - Constructor for class org.montclairrobotics.alloy.utils.BooleanToggle
+
 
+
button - Variable in class org.montclairrobotics.alloy.control.ButtonAction
+
+
The button that controls the action
+
+
Button - Interface in org.montclairrobotics.alloy.core
+
+
An outline for the fundamental behavior of a button
+
+
ButtonAction - Class in org.montclairrobotics.alloy.control
+
+
Every Button action is tied to a button, and controls what happens when the button is pressed, + held, unpressed, and released
+
+
ButtonAction(Button) - Constructor for class org.montclairrobotics.alloy.control.ButtonAction
+
+
Creates a button action tied to a button
+
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-20.html b/docs/javadoc/index-files/index-20.html new file mode 100644 index 0000000..4d6a078 --- /dev/null +++ b/docs/javadoc/index-files/index-20.html @@ -0,0 +1,176 @@ + + + + + +U-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

U

+
+
update() - Method in class org.montclairrobotics.alloy.control.ButtonAction
+
 
+
update() - Method in class org.montclairrobotics.alloy.ftc.FTCTargetMotor
+
+
If the mode is custom, then the update method will set the motor power using the custom PID
+
+
Update - Annotation Type in org.montclairrobotics.alloy.update
+
+
Indicates that the annotated method will be updated by the updater
+
+
update() - Static method in class org.montclairrobotics.alloy.update.Updater
+
+
The update method takes care of updating all of the methods in the project that are within a + component and are annotated with @Update It will also check the Update rate and decide + weather to update the method accordingly
+
+
update() - Method in class org.montclairrobotics.alloy.utils.PID
+
 
+
Updateable - Class in org.montclairrobotics.alloy.update
+
+
A class used for creating objects that can be updated by the Updater
+
+
updateControls() - Method in class org.montclairrobotics.alloy.ftc.FTCJoystick
+
 
+
UpdateException - Exception in org.montclairrobotics.alloy.exceptions
+
+
An exception that is thrown when there is problem with the update system
+
+
UpdateException(String) - Constructor for exception org.montclairrobotics.alloy.exceptions.UpdateException
+
 
+
updateMotor() - Method in class org.montclairrobotics.alloy.ftc.FTCMotor
+
 
+
Updater - Class in org.montclairrobotics.alloy.update
+
+
Created by MHS Robotics on 12/5/2017.
+
+
Updater() - Constructor for class org.montclairrobotics.alloy.update.Updater
+
 
+
userLoop() - Method in class org.montclairrobotics.alloy.auto.AlloyAutonomous
+
+
The user loop can be overridden in the auto mode and is called every loop before the state is + run.
+
+
usingPower() - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
 
+
Utils - Class in org.montclairrobotics.alloy.utils
+
+
A set of common methods that are useful in writing robot code
+
+
Utils() - Constructor for class org.montclairrobotics.alloy.utils.Utils
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-21.html b/docs/javadoc/index-files/index-21.html new file mode 100644 index 0000000..a007f31 --- /dev/null +++ b/docs/javadoc/index-files/index-21.html @@ -0,0 +1,183 @@ + + + + + +V-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

V

+
+
value - Variable in class org.montclairrobotics.alloy.core.Debug
+
+
The information, or object to be debugged
+
+
valueOf(String) - Static method in enum org.montclairrobotics.alloy.core.Debugger.Level
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum org.montclairrobotics.alloy.core.Mode
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum org.montclairrobotics.alloy.ftc.FTCJoystick.Side
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum org.montclairrobotics.alloy.utils.Toggleable.Status
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum org.montclairrobotics.alloy.core.Debugger.Level
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum org.montclairrobotics.alloy.core.Mode
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum org.montclairrobotics.alloy.ftc.FTCJoystick.Side
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum org.montclairrobotics.alloy.utils.Toggleable.Status
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
Vector - Interface in org.montclairrobotics.alloy.vector
+
+
Created by MHS Robotics on 11/14/2017.
+
+
VectorDeadzone - Class in org.montclairrobotics.alloy.steps
+
+
A step that returns 0 if the inputs magnitude is under a certain threshold
+
+
VectorDeadzone(double) - Constructor for class org.montclairrobotics.alloy.steps.VectorDeadzone
+
+
Create a VectorDeadzone specifying the tolerance
+
+
VectorDeadzone() - Constructor for class org.montclairrobotics.alloy.steps.VectorDeadzone
+
+
Create a VectorDeadzone with a default tolerance of 0.05
+
+
verboseDebug() - Method in class org.montclairrobotics.alloy.auto.State
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-22.html b/docs/javadoc/index-files/index-22.html new file mode 100644 index 0000000..2851f87 --- /dev/null +++ b/docs/javadoc/index-files/index-22.html @@ -0,0 +1,150 @@ + + + + + +W-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

W

+
+
warn(String) - Method in class org.montclairrobotics.alloy.core.Debugger
+
+
Gives a warning to the user
+
+
wasPressed - Variable in class org.montclairrobotics.alloy.control.ButtonAction
+
+
Keeps track of if the button was pressed in the previous loop, used for telling when the + button is pressed/unpressed
+
+
whilePressed() - Method in class org.montclairrobotics.alloy.control.ButtonAction
+
+
While pressed is called every loop while the button is pressed
+
+
whilePressed() - Method in class org.montclairrobotics.alloy.control.ToggleButton
+
+
While pressed is called every loop while the button is pressed
+
+
whileReleased() - Method in class org.montclairrobotics.alloy.control.ButtonAction
+
+
While released is called every loop while the button is unpressed
+
+
whileReleased() - Method in class org.montclairrobotics.alloy.control.ToggleButton
+
+
While released is called every loop while the button is unpressed
+
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-23.html b/docs/javadoc/index-files/index-23.html new file mode 100644 index 0000000..efc414b --- /dev/null +++ b/docs/javadoc/index-files/index-23.html @@ -0,0 +1,133 @@ + + + + + +X-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

X

+
+
XY - Class in org.montclairrobotics.alloy.vector
+
+
Created by MHS Robotics on 11/14/2017.
+
+
XY(double, double) - Constructor for class org.montclairrobotics.alloy.vector.XY
+
 
+
XY(XY) - Constructor for class org.montclairrobotics.alloy.vector.XY
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-24.html b/docs/javadoc/index-files/index-24.html new file mode 100644 index 0000000..09139f5 --- /dev/null +++ b/docs/javadoc/index-files/index-24.html @@ -0,0 +1,129 @@ + + + + + +Z-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

Z

+
+
ZERO - Static variable in class org.montclairrobotics.alloy.vector.Angle
+
 
+
ZERO - Static variable in interface org.montclairrobotics.alloy.vector.Vector
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-3.html b/docs/javadoc/index-files/index-3.html new file mode 100644 index 0000000..651ddf4 --- /dev/null +++ b/docs/javadoc/index-files/index-3.html @@ -0,0 +1,205 @@ + + + + + +C-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

C

+
+
calculateCorrection() - Method in class org.montclairrobotics.alloy.utils.BangBang
+
 
+
calculateCorrection() - Method in class org.montclairrobotics.alloy.utils.GyroCorrection
+
 
+
calculateDifferential() - Method in class org.montclairrobotics.alloy.utils.Differential
+
 
+
Component - Class in org.montclairrobotics.alloy.components
+
+
The main component class that all components of alloy should extend
+
+
Component() - Constructor for class org.montclairrobotics.alloy.components.Component
+
 
+
components - Static variable in class org.montclairrobotics.alloy.components.Component
+
+
a static reference of all the components that are made
+
+
ConditionalState - Class in org.montclairrobotics.alloy.auto.States
+
+
A conditional state runs a state if the condition is true
+
+
ConditionalState(Input<Boolean>, State) - Constructor for class org.montclairrobotics.alloy.auto.States.ConditionalState
+
 
+
ConstantInput<T> - Class in org.montclairrobotics.alloy.utils
+
+
Created by MHS Robotics on 3/30/2018.
+
+
ConstantInput(T) - Constructor for class org.montclairrobotics.alloy.utils.ConstantInput
+
 
+
constrain(double, double, double) - Static method in class org.montclairrobotics.alloy.utils.Utils
+
+
Makes sure that a value is between 2 different values
+
+
contition(Input<Boolean>, State) - Method in class org.montclairrobotics.alloy.auto.SimpleAutonomous
+
 
+
controlPower() - Method in class org.montclairrobotics.alloy.motor.MotorGroup
+
 
+
copy() - Method in class org.montclairrobotics.alloy.utils.BangBang
+
 
+
copy() - Method in interface org.montclairrobotics.alloy.utils.ErrorCorrection
+
 
+
copy() - Method in class org.montclairrobotics.alloy.utils.PID
+
 
+
copy() - Method in class org.montclairrobotics.alloy.utils.TuneablePID
+
 
+
copy() - Method in class org.montclairrobotics.alloy.vector.Polar
+
+
Creates a copy of the vector
+
+
copy() - Method in interface org.montclairrobotics.alloy.vector.Vector
+
+
Creates a copy of the vector
+
+
copy() - Method in class org.montclairrobotics.alloy.vector.XY
+
+
Creates a copy of the vector
+
+
cos() - Method in class org.montclairrobotics.alloy.vector.Angle
+
+
get the cosine of the angle
+
+
createDegrees(double) - Static method in class org.montclairrobotics.alloy.vector.Angle
+
+
Creates a new angle using degrees
+
+
createRadians(double) - Static method in class org.montclairrobotics.alloy.vector.Angle
+
+
Creates a new angle using radians
+
+
cross(Vector) - Method in class org.montclairrobotics.alloy.vector.Polar
+
+
Returns the product of two vectors that have been crossed
+
+
cross(Vector) - Method in interface org.montclairrobotics.alloy.vector.Vector
+
+
Returns the product of two vectors that have been crossed
+
+
cross(Vector) - Method in class org.montclairrobotics.alloy.vector.XY
+
+
Returns the product of two vectors that have been crossed
+
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-4.html b/docs/javadoc/index-files/index-4.html new file mode 100644 index 0000000..c8946f7 --- /dev/null +++ b/docs/javadoc/index-files/index-4.html @@ -0,0 +1,273 @@ + + + + + +D-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

D

+
+
Deadzone - Class in org.montclairrobotics.alloy.steps
+
+
A step that returns 0 if the input is under a certain threshold
+
+
Deadzone(double) - Constructor for class org.montclairrobotics.alloy.steps.Deadzone
+
+
Create a deadzone specifying the tolerance
+
+
Deadzone() - Constructor for class org.montclairrobotics.alloy.steps.Deadzone
+
+
Create a deadzone with a default tolerance of 0.05
+
+
debug - Variable in class org.montclairrobotics.alloy.auto.State
+
 
+
debug() - Method in class org.montclairrobotics.alloy.components.Component
+
 
+
Debug - Class in org.montclairrobotics.alloy.core
+
+
Contains the necessary information for a debug
+
+
Debug(String, Input<Object>) - Constructor for class org.montclairrobotics.alloy.core.Debug
+
+
debug a changing value
+
+
Debug(String, Object) - Constructor for class org.montclairrobotics.alloy.core.Debug
+
+
debug a constant value
+
+
debug(Debug) - Method in class org.montclairrobotics.alloy.core.Debugger
+
+
Debugs out a debug object
+
+
debug(String, Object) - Method in class org.montclairrobotics.alloy.core.Debugger
+
+
Debug out verbose information
+
+
debugger - Static variable in class org.montclairrobotics.alloy.components.Component
+
+
The object used for debugging information about all components
+
+
Debugger - Class in org.montclairrobotics.alloy.core
+
+
Controls the flow of how debug information is read out
+
+
Debugger() - Constructor for class org.montclairrobotics.alloy.core.Debugger
+
 
+
Debugger.Level - Enum in org.montclairrobotics.alloy.core
+
 
+
debugInfo(int) - Method in class org.montclairrobotics.alloy.auto.State
+
+
When a state machine is running, it will debug out information about the state it is running.
+
+
debugLevel - Static variable in class org.montclairrobotics.alloy.core.Debugger
+
+
Current Debug Level
+
+
DefaultMapper - Class in org.montclairrobotics.alloy.motor
+
+
A simple default mapper
+
+
DefaultMapper() - Constructor for class org.montclairrobotics.alloy.motor.DefaultMapper
+
 
+
description - Variable in class org.montclairrobotics.alloy.auto.State
+
 
+
Differential - Class in org.montclairrobotics.alloy.utils
+
+
A class to calculate how an input varies with time
+
+
Differential(Input) - Constructor for class org.montclairrobotics.alloy.utils.Differential
+
 
+
disable() - Method in class org.montclairrobotics.alloy.utils.Toggleable
+
+
Disables the toggleable
+
+
disableAction() - Method in class org.montclairrobotics.alloy.components.Component
+
+
The action that is taken when the component is disabled, should be overridden by the user
+
+
disableAction() - Method in class org.montclairrobotics.alloy.ftc.FTCMotor
+
 
+
disableAction() - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
+
Method to be called when the toggleable is disabled
+
+
disableAction() - Method in class org.montclairrobotics.alloy.steps.Deadzone
+
 
+
disableAction() - Method in class org.montclairrobotics.alloy.steps.VectorDeadzone
+
 
+
disableAction() - Method in class org.montclairrobotics.alloy.utils.BooleanToggle
+
 
+
disableAction() - Method in class org.montclairrobotics.alloy.utils.Toggleable
+
+
Method to be called when the toggleable is disabled
+
+
disableDebug() - Method in class org.montclairrobotics.alloy.components.Component
+
+
Disabled debug mode, stopping all debugs
+
+
disableErrorCorrection() - Method in class org.montclairrobotics.alloy.ftc.FTCTargetMotor
+
+
Stop using the custom Error Correction and return to using the default mode
+
+
dot(Vector) - Method in class org.montclairrobotics.alloy.vector.Polar
+
+
Returns the dot product of two vectors
+
+
dot(Vector) - Method in interface org.montclairrobotics.alloy.vector.Vector
+
+
Returns the dot product of two vectors
+
+
dot(Vector) - Method in class org.montclairrobotics.alloy.vector.XY
+
+
Returns the dot product of two vectors
+
+
drive(double, double) - Method in class org.montclairrobotics.alloy.auto.SimpleAutonomous
+
 
+
Drive - Class in org.montclairrobotics.alloy.auto.States
+
+
Created by MHS Robotics on 1/26/2018.
+
+
Drive(double, double) - Constructor for class org.montclairrobotics.alloy.auto.States.Drive
+
 
+
DriveModule - Class in org.montclairrobotics.alloy.drive
+
 
+
DriveModule(Vector, Encoder, ErrorCorrection<Double>, Motor...) - Constructor for class org.montclairrobotics.alloy.drive.DriveModule
+
+
Create a fully functioning motor module
+
+
driverInfo(String, Object) - Method in class org.montclairrobotics.alloy.core.Debugger
+
+
Give a message intended for the driver during practice or competition operation
+
+
DriveTrain - Class in org.montclairrobotics.alloy.drive
+
+
Created by MHS Robotics on 12/16/2017.
+
+
DriveTrain(Input<DTInput>, Mapper, MotorModule...) - Constructor for class org.montclairrobotics.alloy.drive.DriveTrain
+
 
+
DTInput - Class in org.montclairrobotics.alloy.drive
+
+
An input for a drivetrain that takes a rate of translation, and rotation
+
+
DTInput(Vector, Angle) - Constructor for class org.montclairrobotics.alloy.drive.DTInput
+
 
+
DTMapper - Interface in org.montclairrobotics.alloy.drive
+
+
A mapper that specifically takes in DTInputs
+
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-5.html b/docs/javadoc/index-files/index-5.html new file mode 100644 index 0000000..74f406e --- /dev/null +++ b/docs/javadoc/index-files/index-5.html @@ -0,0 +1,165 @@ + + + + + +E-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

E

+
+
enable() - Method in class org.montclairrobotics.alloy.utils.Toggleable
+
+
Enables the toggleable
+
+
enableAction() - Method in class org.montclairrobotics.alloy.components.Component
+
+
The action that is taken when the component is enabled should be overridden bu the user
+
+
enableAction() - Method in class org.montclairrobotics.alloy.steps.Deadzone
+
 
+
enableAction() - Method in class org.montclairrobotics.alloy.steps.VectorDeadzone
+
 
+
enableAction() - Method in class org.montclairrobotics.alloy.utils.BooleanToggle
+
 
+
enableAction() - Method in class org.montclairrobotics.alloy.utils.Toggleable
+
+
Method to be called when the toggleable is enabled
+
+
enableDebug() - Method in class org.montclairrobotics.alloy.components.Component
+
+
Enabled debug mode, causing any debugs added to the component to be debugged out
+
+
Encoder - Class in org.montclairrobotics.alloy.core
+
+
A motor encoder that keeps track of kinematic information about the motor
+
+
Encoder(double, double) - Constructor for class org.montclairrobotics.alloy.core.Encoder
+
 
+
Encoder() - Constructor for class org.montclairrobotics.alloy.core.Encoder
+
+
Create a new encoder with default values
+
+
error(String) - Method in class org.montclairrobotics.alloy.core.Debugger
+
+
Gives an error message to the user
+
+
ErrorCorrection<T> - Interface in org.montclairrobotics.alloy.utils
+
+
A interface that defines the process of correcting an error
+
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-6.html b/docs/javadoc/index-files/index-6.html new file mode 100644 index 0000000..d95b07c --- /dev/null +++ b/docs/javadoc/index-files/index-6.html @@ -0,0 +1,172 @@ + + + + + +F-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

F

+
+
FTCButton - Class in org.montclairrobotics.alloy.ftc
+
+
An FTC button provides implementation for a button used in the FTC competition
+
+
FTCButton(Input<Boolean>) - Constructor for class org.montclairrobotics.alloy.ftc.FTCButton
+
+
Creates a new button using a buttonInput
+
+
FTCButton(Input<Boolean>, boolean) - Constructor for class org.montclairrobotics.alloy.ftc.FTCButton
+
+
Creates a new button specifying a button input and an invert
+
+
FTCDebugger - Class in org.montclairrobotics.alloy.ftc
+
+
implementation of the debugger for the FTC competition
+
+
FTCDebugger() - Constructor for class org.montclairrobotics.alloy.ftc.FTCDebugger
+
+
Create a new FTCDebugger, and throw an exception if it has not been initialized
+
+
FTCJoystick - Class in org.montclairrobotics.alloy.ftc
+
+
Implementation of the Joystick class for FTC
+
+
FTCJoystick(Gamepad, FTCJoystick.Side) - Constructor for class org.montclairrobotics.alloy.ftc.FTCJoystick
+
+
Create a new Joystick using the gamepad and side
+
+
FTCJoystick.Side - Enum in org.montclairrobotics.alloy.ftc
+
+
The side in a FTCJoystick is referring to the side of the controller is on, there are 2 + joysticks, one on the right, one on the left
+
+
FTCMotor - Class in org.montclairrobotics.alloy.ftc
+
+
Implementation of a basic motor for the FTC competition
+
+
FTCMotor(String) - Constructor for class org.montclairrobotics.alloy.ftc.FTCMotor
+
 
+
FTCTargetMotor - Class in org.montclairrobotics.alloy.ftc
+
+
Implementation of a target motor for the FTC competition
+
+
FTCTargetMotor(String) - Constructor for class org.montclairrobotics.alloy.ftc.FTCTargetMotor
+
+
Creates a new FTC Target motor, using the motor id from the FTC configuration
+
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-7.html b/docs/javadoc/index-files/index-7.html new file mode 100644 index 0000000..db70a4e --- /dev/null +++ b/docs/javadoc/index-files/index-7.html @@ -0,0 +1,419 @@ + + + + + +G-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

G

+
+
gamepad1 - Static variable in class org.montclairrobotics.alloy.core.RobotCore
+
+
The first gamepad, generated by pressing start + 'a' on the controller
+
+
gamepad2 - Static variable in class org.montclairrobotics.alloy.core.RobotCore
+
+
The second gamepad, generated by pressing start + 'b' on the controller
+
+
get() - Method in class org.montclairrobotics.alloy.components.InputComponent
+
 
+
get() - Method in class org.montclairrobotics.alloy.utils.BooleanToggle
+
 
+
get() - Method in class org.montclairrobotics.alloy.utils.ConstantInput
+
 
+
get() - Method in interface org.montclairrobotics.alloy.utils.Input
+
 
+
get() - Method in class org.montclairrobotics.alloy.utils.Monitor
+
 
+
getAButton(Gamepad) - Static method in class org.montclairrobotics.alloy.ftc.FTCButton
+
 
+
getAcceleration() - Method in class org.montclairrobotics.alloy.core.Encoder
+
+
Get the acceleration in distance per second The distance is set by the distance per tick + method, it is important to keep distances consistent throughout
+
+
getAccelerationDifferential() - Method in class org.montclairrobotics.alloy.core.Encoder
+
 
+
getAngle() - Method in class org.montclairrobotics.alloy.vector.Polar
+
+
Gets the angle in standard position that the vector makes
+
+
getAngle() - Method in interface org.montclairrobotics.alloy.vector.Vector
+
+
Gets the angle in standard position that the vector makes
+
+
getAngle() - Method in class org.montclairrobotics.alloy.vector.XY
+
+
Gets the angle in standard position that the vector makes
+
+
getBButton(Gamepad) - Static method in class org.montclairrobotics.alloy.ftc.FTCButton
+
 
+
getComponents() - Static method in class org.montclairrobotics.alloy.components.Component
+
 
+
getCorrection() - Method in class org.montclairrobotics.alloy.utils.BangBang
+
+
Get the value to apply the correction
+
+
getCorrection() - Method in interface org.montclairrobotics.alloy.utils.ErrorCorrection
+
+
Get the value to apply the correction
+
+
getCorrection() - Method in class org.montclairrobotics.alloy.utils.GyroCorrection
+
 
+
getCorrection() - Method in class org.montclairrobotics.alloy.utils.PID
+
 
+
getCorrection() - Method in class org.montclairrobotics.alloy.utils.TuneablePID
+
+
Get the value to apply the correction
+
+
getDegrees() - Method in class org.montclairrobotics.alloy.vector.Angle
+
+
Get the angle measure in degrees
+
+
getDirection() - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
 
+
getDPADDown(Gamepad) - Static method in class org.montclairrobotics.alloy.ftc.FTCButton
+
 
+
getDPADLeft(Gamepad) - Static method in class org.montclairrobotics.alloy.ftc.FTCButton
+
 
+
getDPADUp(Gamepad) - Static method in class org.montclairrobotics.alloy.ftc.FTCButton
+
 
+
getDriveTrain() - Static method in class org.montclairrobotics.alloy.core.Alloy
+
 
+
getEncoder() - Method in class org.montclairrobotics.alloy.ftc.FTCMotor
+
 
+
getEncoder() - Method in class org.montclairrobotics.alloy.ftc.FTCTargetMotor
+
+
Allows for the creation of an encoder object that is aware of the amount of ticks the motor + has gone
+
+
getEncoder() - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
 
+
getEncoderValues() - Method in class org.montclairrobotics.alloy.drive.DriveTrain
+
 
+
getErrorCorrection() - Method in class org.montclairrobotics.alloy.ftc.FTCTargetMotor
+
 
+
getGamepad1() - Static method in class org.montclairrobotics.alloy.core.RobotCore
+
+
Gets the first gamepad
+
+
getGamepad2() - Static method in class org.montclairrobotics.alloy.core.RobotCore
+
+
Gets the second gamepad
+
+
getHardwareMap() - Static method in class org.montclairrobotics.alloy.core.RobotCore
+
+
Gets the hardware map of the robot
+
+
getInput() - Method in class org.montclairrobotics.alloy.motor.MotorGroup
+
 
+
getInput() - Method in class org.montclairrobotics.alloy.utils.Differential
+
 
+
getInverted() - Method in interface org.montclairrobotics.alloy.core.Motor
+
+
Gets weather the motor is inverted
+
+
getInverted() - Method in class org.montclairrobotics.alloy.ftc.FTCMotor
+
+
Gets weather the motor is inverted
+
+
getLeftBumper(Gamepad) - Static method in class org.montclairrobotics.alloy.ftc.FTCButton
+
 
+
getLeftEncoderValues() - Method in class org.montclairrobotics.alloy.drive.DriveTrain
+
 
+
getLeftTrigger(Gamepad) - Static method in class org.montclairrobotics.alloy.ftc.FTCButton
+
 
+
getManitude() - Method in class org.montclairrobotics.alloy.vector.Polar
+
+
Gets the magnitude of the vector
+
+
getManitude() - Method in interface org.montclairrobotics.alloy.vector.Vector
+
+
Gets the magnitude of the vector
+
+
getManitude() - Method in class org.montclairrobotics.alloy.vector.XY
+
+
Gets the magnitude of the vector
+
+
getMapper() - Method in class org.montclairrobotics.alloy.motor.MotorGroup
+
 
+
getModifier() - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
 
+
getModules() - Method in class org.montclairrobotics.alloy.motor.MotorGroup
+
 
+
getMotor() - Method in class org.montclairrobotics.alloy.ftc.FTCTargetMotor
+
 
+
getMotorPower() - Method in interface org.montclairrobotics.alloy.core.Motor
+
+
Gets the motor power
+
+
getMotorPower() - Method in class org.montclairrobotics.alloy.ftc.FTCMotor
+
+
Gets the motor power
+
+
getMotors() - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
 
+
getNextState(int) - Method in class org.montclairrobotics.alloy.auto.State
+
+
In order to have a non linear state machine, the state machine must know what state to go to + when it is done with the previous state.
+
+
getOffset() - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
 
+
getOutput(T) - Method in interface org.montclairrobotics.alloy.components.Step
+
+
The operation to be performed on the input, to get the output
+
+
getOutput(Double) - Method in class org.montclairrobotics.alloy.steps.Deadzone
+
 
+
getOutput(Vector) - Method in class org.montclairrobotics.alloy.steps.VectorDeadzone
+
 
+
getPosition() - Method in interface org.montclairrobotics.alloy.core.TargetMotor
+
+
Gets the motors position
+
+
getPosition() - Method in class org.montclairrobotics.alloy.ftc.FTCTargetMotor
+
+
Gets the motors position
+
+
getPowerControl() - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
 
+
getRadians() - Method in class org.montclairrobotics.alloy.vector.Angle
+
+
Get the angle measure in radians
+
+
getRank() - Method in enum org.montclairrobotics.alloy.core.Debugger.Level
+
 
+
getRawTicks() - Method in class org.montclairrobotics.alloy.core.Encoder
+
+
A method that should be overridden by the encoder
+
+
getRawVelocity() - Method in class org.montclairrobotics.alloy.core.Encoder
+
+
Get the velocity in Ticks per Second
+
+
getReferences() - Method in class org.montclairrobotics.alloy.update.Updateable
+
+
Gets references to all of the object that the update method should be called on
+
+
getRightBumper(Gamepad) - Static method in class org.montclairrobotics.alloy.ftc.FTCButton
+
 
+
getRightEncoderValues() - Method in class org.montclairrobotics.alloy.drive.DriveTrain
+
 
+
getRightTrigger(Gamepad) - Static method in class org.montclairrobotics.alloy.ftc.FTCButton
+
 
+
getRotation() - Method in class org.montclairrobotics.alloy.drive.DTInput
+
 
+
getRunmode() - Method in class org.montclairrobotics.alloy.ftc.FTCTargetMotor
+
+
NOTE: this is not the same as the DCMotor runmode
+
+
getScaledVelocity() - Method in class org.montclairrobotics.alloy.core.Encoder
+
+
Get a scaled value (0 - 1) of how fast the motor is going
+
+
getTargetPower() - Method in interface org.montclairrobotics.alloy.core.TargetMotor
+
+
Gets the motor power
+
+
getTargetPower() - Method in class org.montclairrobotics.alloy.ftc.FTCTargetMotor
+
+
Gets the motor power
+
+
getTargetPower() - Method in class org.montclairrobotics.alloy.motor.MotorModule
+
 
+
getTelemetry() - Static method in class org.montclairrobotics.alloy.core.RobotCore
+
+
Gets the telemetry object of the robot
+
+
getTelemetry() - Method in class org.montclairrobotics.alloy.ftc.FTCDebugger
+
 
+
getTicks() - Method in class org.montclairrobotics.alloy.core.Encoder
+
 
+
getTimeInLastState() - Method in class org.montclairrobotics.alloy.auto.StateMachine
+
+
Gets the time in the most recently completed state
+
+
getTolerance() - Method in class org.montclairrobotics.alloy.steps.Deadzone
+
 
+
getTolerance() - Method in class org.montclairrobotics.alloy.steps.VectorDeadzone
+
 
+
getTranslation() - Method in class org.montclairrobotics.alloy.drive.DTInput
+
 
+
getUpdateRate() - Method in class org.montclairrobotics.alloy.update.Updateable
+
 
+
getValue() - Method in interface org.montclairrobotics.alloy.core.Button
+
+
Gets the value of a button
+
+
getValue() - Method in interface org.montclairrobotics.alloy.core.Joystick
+
+
Gets the position of the joystick
+
+
getValue() - Method in class org.montclairrobotics.alloy.ftc.FTCButton
+
+
Gets the values for a button
+
+
getValue() - Method in class org.montclairrobotics.alloy.ftc.FTCJoystick
+
+
Gets the position of the joystick as a vector
+
+
getVelocity() - Method in class org.montclairrobotics.alloy.core.Encoder
+
+
Get the velocity in distance per second The distance is set by the distance per tick method, + it is important to keep distances consistent throughout the project.
+
+
getVelocityDifferential() - Method in class org.montclairrobotics.alloy.core.Encoder
+
 
+
getX() - Method in class org.montclairrobotics.alloy.vector.Polar
+
+
Gets the X component of the vector
+
+
getX() - Method in interface org.montclairrobotics.alloy.vector.Vector
+
+
Gets the X component of the vector
+
+
getX() - Method in class org.montclairrobotics.alloy.vector.XY
+
+
Gets the X component of the vector
+
+
getXButton(Gamepad) - Static method in class org.montclairrobotics.alloy.ftc.FTCButton
+
 
+
getY() - Method in class org.montclairrobotics.alloy.vector.Polar
+
+
Gets the Y component of the vector
+
+
getY() - Method in interface org.montclairrobotics.alloy.vector.Vector
+
+
Gets the Y component of the vector
+
+
getY() - Method in class org.montclairrobotics.alloy.vector.XY
+
+
Gets the Y component of the vector
+
+
getYButton(Gamepad) - Static method in class org.montclairrobotics.alloy.ftc.FTCButton
+
 
+
getYDPADRight(Gamepad) - Static method in class org.montclairrobotics.alloy.ftc.FTCButton
+
 
+
GyroCorrection - Class in org.montclairrobotics.alloy.utils
+
+
A correction based on a gyroscope, to keep a consistent heading
+
+
GyroCorrection() - Constructor for class org.montclairrobotics.alloy.utils.GyroCorrection
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-8.html b/docs/javadoc/index-files/index-8.html new file mode 100644 index 0000000..22a4883 --- /dev/null +++ b/docs/javadoc/index-files/index-8.html @@ -0,0 +1,134 @@ + + + + + +H-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

H

+
+
HALF_PI - Static variable in class org.montclairrobotics.alloy.vector.Angle
+
 
+
hardwareMap - Static variable in class org.montclairrobotics.alloy.core.RobotCore
+
+
The hardware map is essential to any robot and is how the ftc core interacts with the + hardware devices on the phones
+
+
highOut - Variable in class org.montclairrobotics.alloy.utils.BangBang
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index-files/index-9.html b/docs/javadoc/index-files/index-9.html new file mode 100644 index 0000000..46e2cf0 --- /dev/null +++ b/docs/javadoc/index-files/index-9.html @@ -0,0 +1,200 @@ + + + + + +I-Index + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + +
A B C D E F G H I J K L M N O P R S T U V W X Z  + + +

I

+
+
init() - Method in class org.montclairrobotics.alloy.auto.AlloyAutonomous
+
+
Init is called when the INIT button is pressed on the drivers station.
+
+
init() - Method in class org.montclairrobotics.alloy.core.Alloy
+
 
+
init() - Method in class org.montclairrobotics.alloy.utils.Initializeable
+
+
the method that is called at the beginning of the teleop mode
+
+
initialization() - Method in class org.montclairrobotics.alloy.core.Alloy
+
+
The initialization method is were everything specific to the OpMode Should be set up.
+
+
initialization() - Method in class org.montclairrobotics.alloy.test.TestRobot
+
 
+
Initializeable - Class in org.montclairrobotics.alloy.utils
+
+
An object that gets initialized once at the beginning of the teleop mode
+
+
Initializeable() - Constructor for class org.montclairrobotics.alloy.utils.Initializeable
+
 
+
initObjects - Static variable in class org.montclairrobotics.alloy.core.Alloy
+
 
+
input - Variable in class org.montclairrobotics.alloy.components.InputComponent
+
+
The initial input value
+
+
input - Variable in class org.montclairrobotics.alloy.utils.Differential
+
+
The dependant variable in the situation
+
+
Input<T> - Interface in org.montclairrobotics.alloy.utils
+
+
A dynamically stored input
+
+
input - Variable in class org.montclairrobotics.alloy.utils.Monitor
+
+
The input to be checked
+
+
InputComponent<T> - Class in org.montclairrobotics.alloy.components
+
+
An input component is an extension of a regular component, used for input and control systems
+
+
InputComponent() - Constructor for class org.montclairrobotics.alloy.components.InputComponent
+
 
+
IntakeMapper - Class in org.montclairrobotics.alloy.test
+
 
+
IntakeMapper() - Constructor for class org.montclairrobotics.alloy.test.IntakeMapper
+
 
+
InvalidConfigurationException - Exception in org.montclairrobotics.alloy.exceptions
+
+
An exception that is thrown when a robot is improperly setup An invalid configuration can be + thrown when:
+ - Global robot properties are accessed before they exist
+ - Motor, or controller ports are improperly specified or accessed
+
+
InvalidConfigurationException(String) - Constructor for exception org.montclairrobotics.alloy.exceptions.InvalidConfigurationException
+
 
+
isDone() - Method in class org.montclairrobotics.alloy.auto.State
+
+
IsDone should return true when the state is finished
+
+
isDone() - Method in class org.montclairrobotics.alloy.auto.StateMachine
+
+
determine if the state machine is done
+
+
isDone() - Method in class org.montclairrobotics.alloy.auto.States.ConditionalState
+
 
+
isDone() - Method in class org.montclairrobotics.alloy.auto.States.Drive
+
 
+
isDone() - Method in class org.montclairrobotics.alloy.auto.States.Turn
+
 
+
isEnabled() - Method in enum org.montclairrobotics.alloy.utils.Toggleable.Status
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W X Z 
+ +
+ + +
Skip navigation links
+ + + + +
+ + + + diff --git a/docs/javadoc/index.html b/docs/javadoc/index.html new file mode 100644 index 0000000..4bb8c64 --- /dev/null +++ b/docs/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/auto/AlloyAutonomous.html b/docs/javadoc/org/montclairrobotics/alloy/auto/AlloyAutonomous.html new file mode 100644 index 0000000..5de63e2 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/auto/AlloyAutonomous.html @@ -0,0 +1,465 @@ + + + + + +AlloyAutonomous + + + + + + + + +
+ + +
Skip navigation links
+ + + + +
+ + + +
+
org.montclairrobotics.alloy.auto
+

Class AlloyAutonomous

+
+
+ +
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      StateMachineauto +
      The actual auto mode that should be instantiated in setup
      +
      com.qualcomm.robotcore.util.ElapsedTimetimer +
      A timer to keep track of time in the autoMode
      +
      +
        +
      • + + +

        Fields inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode

        +gamepad1, gamepad2, hardwareMap, internalOpModeServices, msStuckDetectInit, msStuckDetectInitLoop, msStuckDetectLoop, msStuckDetectStart, msStuckDetectStop, telemetry, time
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      AlloyAutonomous() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidinit() +
      Init is called when the INIT button is pressed on the drivers station.
      +
      voidloop() +
      the Loop method takes care of running the state machine
      +
      voidnewState(State state) +
      A wrapper around the add state method to allow the user to add states to the auto mode
      +
      abstract voidsetup() +
      This is where the user should define all their code and where "Auto", should be instantiated
      +
      voidstart() +
      Runs when the play button is pressed Start will set up everything that the auto mode needs to + run
      +
      voiduserLoop() +
      The user loop can be overridden in the auto mode and is called every loop before the state is + run.
      +
      +
        +
      • + + +

        Methods inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode

        +getRuntime, init_loop, internalPostInitLoop, internalPostLoop, internalPreInit, internalUpdateTelemetryNow, requestOpModeStop, resetStartTime, stop, updateTelemetry
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        auto

        +
        public StateMachine auto
        +
        The actual auto mode that should be instantiated in setup
        +
      • +
      + + + +
        +
      • +

        timer

        +
        public com.qualcomm.robotcore.util.ElapsedTime timer
        +
        A timer to keep track of time in the autoMode
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        AlloyAutonomous

        +
        public AlloyAutonomous()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setup

        +
        public abstract void setup()
        +
        This is where the user should define all their code and where "Auto", should be instantiated
        +
      • +
      + + + +
        +
      • +

        start

        +
        public void start()
        +
        Runs when the play button is pressed Start will set up everything that the auto mode needs to + run
        +
        +
        Overrides:
        +
        start in class com.qualcomm.robotcore.eventloop.opmode.OpMode
        +
        +
      • +
      + + + +
        +
      • +

        init

        +
        public void init()
        +
        Init is called when the INIT button is pressed on the drivers station. The init method takes + care of setting up global robot variables and running the user setup method
        +
        +
        Specified by:
        +
        init in class com.qualcomm.robotcore.eventloop.opmode.OpMode
        +
        +
      • +
      + + + +
        +
      • +

        userLoop

        +
        public void userLoop()
        +
        The user loop can be overridden in the auto mode and is called every loop before the state is + run. This can be useful for updating information used in states.
        +
      • +
      + + + +
        +
      • +

        loop

        +
        public void loop()
        +
        the Loop method takes care of running the state machine
        +
        +
        Specified by:
        +
        loop in class com.qualcomm.robotcore.eventloop.opmode.OpMode
        +
        +
      • +
      + + + +
        +
      • +

        newState

        +
        public void newState(State state)
        +
        A wrapper around the add state method to allow the user to add states to the auto mode
        +
        +
        Parameters:
        +
        state - the state to be added
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/auto/SimpleAutonomous.html b/docs/javadoc/org/montclairrobotics/alloy/auto/SimpleAutonomous.html new file mode 100644 index 0000000..153d4d5 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/auto/SimpleAutonomous.html @@ -0,0 +1,394 @@ + + + + + +SimpleAutonomous + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.auto
+

Class SimpleAutonomous

+
+
+ +
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    SquareAuto
    +
    +
    +
    +
    public class SimpleAutonomous
    +extends AlloyAutonomous
    +
    Created by MHS Robotics on 1/26/2018. + +

    SimpleAutonomous abstracts away the concept of adding states to a state machine, so that + states can be added as if they were commands to be executed by the auto mode. This class only has + the pre-written states included, so another class extending this one would need to be created to + add any custom states

    +
    +
    Since:
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + +
        +
      • + + +

        Fields inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode

        +gamepad1, gamepad2, hardwareMap, internalOpModeServices, msStuckDetectInit, msStuckDetectInitLoop, msStuckDetectLoop, msStuckDetectStart, msStuckDetectStop, telemetry, time
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SimpleAutonomous() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidaddState(State state) 
      voidcontition(Input<java.lang.Boolean> condition, + State state) 
      voiddrive(double speed, + double distance) 
      voidsetup() +
      This is where the user should define all their code and where "Auto", should be instantiated
      +
      voidturn(double speed, + Angle angle) 
      + +
        +
      • + + +

        Methods inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode

        +getRuntime, init_loop, internalPostInitLoop, internalPostLoop, internalPreInit, internalUpdateTelemetryNow, requestOpModeStop, resetStartTime, stop, updateTelemetry
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SimpleAutonomous

        +
        public SimpleAutonomous()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setup

        +
        public void setup()
        +
        Description copied from class: AlloyAutonomous
        +
        This is where the user should define all their code and where "Auto", should be instantiated
        +
        +
        Specified by:
        +
        setup in class AlloyAutonomous
        +
        +
      • +
      + + + +
        +
      • +

        drive

        +
        public void drive(double speed,
        +                  double distance)
        +
      • +
      + + + +
        +
      • +

        turn

        +
        public void turn(double speed,
        +                 Angle angle)
        +
      • +
      + + + +
        +
      • +

        contition

        +
        public void contition(Input<java.lang.Boolean> condition,
        +                      State state)
        +
      • +
      + + + +
        +
      • +

        addState

        +
        public void addState(State state)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/auto/State.html b/docs/javadoc/org/montclairrobotics/alloy/auto/State.html new file mode 100644 index 0000000..e007e35 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/auto/State.html @@ -0,0 +1,449 @@ + + + + + +State + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.auto
+

Class State

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.auto.State
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    ConditionalState, Drive, StateMachine, Turn
    +
    +
    +
    +
    public abstract class State
    +extends java.lang.Object
    +
    Created by MHS Robotics on 12/16/2017. + +

    States are designed to be passed in and run in a state machine. States can be used for + Autonomous modes as well as autonomously doing actions in teleop.

    +
    +
    Since:
    +
    0.1
    +
    See Also:
    +
    StateMachine, +AlloyAutonomous
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      protected java.lang.Stringdebug 
      protected java.lang.Stringdescription 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      State() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and TypeMethod and Description
      java.lang.StringdebugInfo(int currentState) +
      When a state machine is running, it will debug out information about the state it is running.
      +
      intgetNextState(int currentState) +
      In order to have a non linear state machine, the state machine must know what state to go to + when it is done with the previous state.
      +
      abstract booleanisDone() +
      IsDone should return true when the state is finished
      +
      abstract voidrun() +
      The run method is called every loop while the state is running
      +
      abstract voidstart() +
      The start method is the first thing called when the state is run
      +
      abstract voidstop() +
      The Stop method is the last thing called once the state is done
      +
      java.lang.StringverboseDebug() 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        debug

        +
        protected java.lang.String debug
        +
      • +
      + + + +
        +
      • +

        description

        +
        protected java.lang.String description
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        State

        +
        public State()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        start

        +
        public abstract void start()
        +
        The start method is the first thing called when the state is run
        +
      • +
      + + + +
        +
      • +

        run

        +
        public abstract void run()
        +
        The run method is called every loop while the state is running
        +
      • +
      + + + +
        +
      • +

        stop

        +
        public abstract void stop()
        +
        The Stop method is the last thing called once the state is done
        +
      • +
      + + + +
        +
      • +

        isDone

        +
        public abstract boolean isDone()
        +
        IsDone should return true when the state is finished
        +
        +
        Returns:
        +
        true if the state is done
        +
        +
      • +
      + + + +
        +
      • +

        getNextState

        +
        public int getNextState(int currentState)
        +
        In order to have a non linear state machine, the state machine must know what state to go to + when it is done with the previous state. The state also sometimes needs to know the current + state for example if it just wanted to increment the state by one.
        +
        +
        Parameters:
        +
        currentState - the state the state machine is currently running
        +
        Returns:
        +
        the state the state machine should go to
        +
        +
      • +
      + + + +
        +
      • +

        debugInfo

        +
        public java.lang.String debugInfo(int currentState)
        +
        When a state machine is running, it will debug out information about the state it is running. + It will debug the result of debugInfo
        +
        +
        Parameters:
        +
        currentState - the current state so that it can be used in the debug
        +
        Returns:
        +
        debug information about the state
        +
        +
      • +
      + + + +
        +
      • +

        verboseDebug

        +
        public java.lang.String verboseDebug()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/auto/StateMachine.html b/docs/javadoc/org/montclairrobotics/alloy/auto/StateMachine.html new file mode 100644 index 0000000..3222739 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/auto/StateMachine.html @@ -0,0 +1,481 @@ + + + + + +StateMachine + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.auto
+

Class StateMachine

+
+
+ +
+
    +
  • +
    +
    +
    public class StateMachine
    +extends State
    +
    Created by MHS Robotics on 12/16/2017. + +

    A state machine takes in states and runs them in a controlled order.
    + By default the states will run in a linear fashion and the next state will start when the + previous state has finished.
    +
    + State machines can be used for controlling auto modes, but can also be ran in teleop modes for + pre coded instructions that make driving easier. + +

    State machines are also states themselves so a state machine can run another state machine. + This allows for the reuse of auto code

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      StateMachine(State... states) 
      StateMachine(java.lang.String name, + int finalState, + State... states) 
      StateMachine(java.lang.String name, + java.lang.String description, + int finalState, + State... states) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidaddState(State state) +
      Adds a state to the state machine.
      +
      doublegetTimeInLastState() +
      Gets the time in the most recently completed state
      +
      booleanisDone() +
      determine if the state machine is done
      +
      voidrun() +
      The run method takes care of actually running the states
      +
      voidsetFinalState(java.lang.Integer finalState) 
      voidsetName(java.lang.String name) 
      voidstart() +
      Read out that the state has started and reset the timer
      +
      voidstop() +
      When the state machine is finished, read out it has finished
      +
      + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        StateMachine

        +
        public StateMachine(java.lang.String name,
        +                    int finalState,
        +                    State... states)
        +
      • +
      + + + +
        +
      • +

        StateMachine

        +
        public StateMachine(State... states)
        +
      • +
      + + + +
        +
      • +

        StateMachine

        +
        public StateMachine(java.lang.String name,
        +                    java.lang.String description,
        +                    int finalState,
        +                    State... states)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setFinalState

        +
        public void setFinalState(java.lang.Integer finalState)
        +
      • +
      + + + +
        +
      • +

        setName

        +
        public void setName(java.lang.String name)
        +
      • +
      + + + +
        +
      • +

        start

        +
        public void start()
        +
        Read out that the state has started and reset the timer
        +
        +
        Specified by:
        +
        start in class State
        +
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        The run method takes care of actually running the states
        +
        +
        Specified by:
        +
        run in class State
        +
        +
      • +
      + + + +
        +
      • +

        stop

        +
        public void stop()
        +
        When the state machine is finished, read out it has finished
        +
        +
        Specified by:
        +
        stop in class State
        +
        +
      • +
      + + + +
        +
      • +

        isDone

        +
        public boolean isDone()
        +
        determine if the state machine is done
        +
        +
        Specified by:
        +
        isDone in class State
        +
        Returns:
        +
        true if the state machine is done
        +
        +
      • +
      + + + +
        +
      • +

        addState

        +
        public void addState(State state)
        +
        Adds a state to the state machine. States can be added to a state machine but should not be + added after the state machine
        +
        +
        Parameters:
        +
        state - state that will be added to the state machine
        +
        +
      • +
      + + + +
        +
      • +

        getTimeInLastState

        +
        public double getTimeInLastState()
        +
        Gets the time in the most recently completed state
        +
        +
        Returns:
        +
        The time in last state
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/auto/States/ConditionalState.html b/docs/javadoc/org/montclairrobotics/alloy/auto/States/ConditionalState.html new file mode 100644 index 0000000..528cacd --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/auto/States/ConditionalState.html @@ -0,0 +1,375 @@ + + + + + +ConditionalState + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.auto.States
+

Class ConditionalState

+
+
+ +
+
    +
  • +
    +
    +
    public class ConditionalState
    +extends State
    +
    A conditional state runs a state if the condition is true + +

    A conditional state takes in a boolean input, and evaluates it when the state starts. If the + input is true when the state starts, the passed in state will execute.

    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ConditionalState(Input<java.lang.Boolean> condition, + State state) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      booleanisDone() +
      IsDone should return true when the state is finished
      +
      voidrun() +
      The run method is called every loop while the state is running
      +
      voidstart() +
      The start method is the first thing called when the state is run
      +
      voidstop() +
      The Stop method is the last thing called once the state is done
      +
      + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ConditionalState

        +
        public ConditionalState(Input<java.lang.Boolean> condition,
        +                        State state)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        start

        +
        public void start()
        +
        Description copied from class: State
        +
        The start method is the first thing called when the state is run
        +
        +
        Specified by:
        +
        start in class State
        +
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Description copied from class: State
        +
        The run method is called every loop while the state is running
        +
        +
        Specified by:
        +
        run in class State
        +
        +
      • +
      + + + +
        +
      • +

        stop

        +
        public void stop()
        +
        Description copied from class: State
        +
        The Stop method is the last thing called once the state is done
        +
        +
        Specified by:
        +
        stop in class State
        +
        +
      • +
      + + + +
        +
      • +

        isDone

        +
        public boolean isDone()
        +
        Description copied from class: State
        +
        IsDone should return true when the state is finished
        +
        +
        Specified by:
        +
        isDone in class State
        +
        Returns:
        +
        true if the state is done
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/auto/States/Drive.html b/docs/javadoc/org/montclairrobotics/alloy/auto/States/Drive.html new file mode 100644 index 0000000..0be526e --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/auto/States/Drive.html @@ -0,0 +1,401 @@ + + + + + +Drive + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.auto.States
+

Class Drive

+
+
+ +
+
    +
  • +
    +
    +
    public class Drive
    +extends State
    +
    Created by MHS Robotics on 1/26/2018.
    +
    +
    Since:
    +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Drive(double speed, + double distance) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      booleanisDone() +
      IsDone should return true when the state is finished
      +
      voidrun() +
      The run method is called every loop while the state is running
      +
      DrivesetDriveTrain(DriveTrain driveTrain) 
      static voidsetTolerance(int tolerance) 
      voidstart() +
      The start method is the first thing called when the state is run
      +
      voidstop() +
      The Stop method is the last thing called once the state is done
      +
      + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Drive

        +
        public Drive(double speed,
        +             double distance)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setTolerance

        +
        public static void setTolerance(int tolerance)
        +
      • +
      + + + +
        +
      • +

        setDriveTrain

        +
        public Drive setDriveTrain(DriveTrain driveTrain)
        +
      • +
      + + + +
        +
      • +

        start

        +
        public void start()
        +
        Description copied from class: State
        +
        The start method is the first thing called when the state is run
        +
        +
        Specified by:
        +
        start in class State
        +
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Description copied from class: State
        +
        The run method is called every loop while the state is running
        +
        +
        Specified by:
        +
        run in class State
        +
        +
      • +
      + + + +
        +
      • +

        stop

        +
        public void stop()
        +
        Description copied from class: State
        +
        The Stop method is the last thing called once the state is done
        +
        +
        Specified by:
        +
        stop in class State
        +
        +
      • +
      + + + +
        +
      • +

        isDone

        +
        public boolean isDone()
        +
        Description copied from class: State
        +
        IsDone should return true when the state is finished
        +
        +
        Specified by:
        +
        isDone in class State
        +
        Returns:
        +
        true if the state is done
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/auto/States/Turn.html b/docs/javadoc/org/montclairrobotics/alloy/auto/States/Turn.html new file mode 100644 index 0000000..c7f27dd --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/auto/States/Turn.html @@ -0,0 +1,402 @@ + + + + + +Turn + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.auto.States
+

Class Turn

+
+
+ +
+
    +
  • +
    +
    +
    public class Turn
    +extends State
    +
    Created by MHS Robotics on 1/26/2018.
    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Turn(double speed, + Angle angle) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      booleanisDone() +
      IsDone should return true when the state is finished
      +
      voidrun() +
      The run method is called every loop while the state is running
      +
      static voidsetTicksPerDegree(double ticksPerDegree) 
      static voidsetTolerance(double tolerance) 
      voidstart() +
      The start method is the first thing called when the state is run
      +
      voidstop() +
      The Stop method is the last thing called once the state is done
      +
      + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Turn

        +
        public Turn(double speed,
        +            Angle angle)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setTicksPerDegree

        +
        public static void setTicksPerDegree(double ticksPerDegree)
        +
      • +
      + + + +
        +
      • +

        setTolerance

        +
        public static void setTolerance(double tolerance)
        +
      • +
      + + + +
        +
      • +

        start

        +
        public void start()
        +
        Description copied from class: State
        +
        The start method is the first thing called when the state is run
        +
        +
        Specified by:
        +
        start in class State
        +
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
        Description copied from class: State
        +
        The run method is called every loop while the state is running
        +
        +
        Specified by:
        +
        run in class State
        +
        +
      • +
      + + + +
        +
      • +

        stop

        +
        public void stop()
        +
        Description copied from class: State
        +
        The Stop method is the last thing called once the state is done
        +
        +
        Specified by:
        +
        stop in class State
        +
        +
      • +
      + + + +
        +
      • +

        isDone

        +
        public boolean isDone()
        +
        Description copied from class: State
        +
        IsDone should return true when the state is finished
        +
        +
        Specified by:
        +
        isDone in class State
        +
        Returns:
        +
        true if the state is done
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/auto/States/package-frame.html b/docs/javadoc/org/montclairrobotics/alloy/auto/States/package-frame.html new file mode 100644 index 0000000..b21376c --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/auto/States/package-frame.html @@ -0,0 +1,22 @@ + + + + + +org.montclairrobotics.alloy.auto.States + + + + + +

org.montclairrobotics.alloy.auto.States

+
+

Classes

+ +
+ + diff --git a/docs/javadoc/org/montclairrobotics/alloy/auto/States/package-summary.html b/docs/javadoc/org/montclairrobotics/alloy/auto/States/package-summary.html new file mode 100644 index 0000000..def31fb --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/auto/States/package-summary.html @@ -0,0 +1,154 @@ + + + + + +org.montclairrobotics.alloy.auto.States + + + + + + + + + + + +
+

Package org.montclairrobotics.alloy.auto.States

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    ConditionalState +
    A conditional state runs a state if the condition is true
    +
    Drive +
    Created by MHS Robotics on 1/26/2018.
    +
    Turn +
    Created by MHS Robotics on 1/26/2018.
    +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/auto/States/package-tree.html b/docs/javadoc/org/montclairrobotics/alloy/auto/States/package-tree.html new file mode 100644 index 0000000..e82a12e --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/auto/States/package-tree.html @@ -0,0 +1,141 @@ + + + + + +org.montclairrobotics.alloy.auto.States Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package org.montclairrobotics.alloy.auto.States

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • org.montclairrobotics.alloy.auto.State +
        +
      • org.montclairrobotics.alloy.auto.States.ConditionalState
      • +
      • org.montclairrobotics.alloy.auto.States.Drive
      • +
      • org.montclairrobotics.alloy.auto.States.Turn
      • +
      +
    • +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/auto/class-use/AlloyAutonomous.html b/docs/javadoc/org/montclairrobotics/alloy/auto/class-use/AlloyAutonomous.html new file mode 100644 index 0000000..2540a5b --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/auto/class-use/AlloyAutonomous.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.auto.AlloyAutonomous + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.auto.AlloyAutonomous

+
+
No usage of org.montclairrobotics.alloy.auto.AlloyAutonomous
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/auto/class-use/State.html b/docs/javadoc/org/montclairrobotics/alloy/auto/class-use/State.html new file mode 100644 index 0000000..fdd8c89 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/auto/class-use/State.html @@ -0,0 +1,190 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.auto.State + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.auto.State

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/auto/class-use/StateMachine.html b/docs/javadoc/org/montclairrobotics/alloy/auto/class-use/StateMachine.html new file mode 100644 index 0000000..8cea172 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/auto/class-use/StateMachine.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.auto.StateMachine + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.auto.StateMachine

+
+
No usage of org.montclairrobotics.alloy.auto.StateMachine
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/auto/package-frame.html b/docs/javadoc/org/montclairrobotics/alloy/auto/package-frame.html new file mode 100644 index 0000000..9e047ca --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/auto/package-frame.html @@ -0,0 +1,23 @@ + + + + + +org.montclairrobotics.alloy.auto + + + + + +

org.montclairrobotics.alloy.auto

+ + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/auto/package-summary.html b/docs/javadoc/org/montclairrobotics/alloy/auto/package-summary.html new file mode 100644 index 0000000..b50aa28 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/auto/package-summary.html @@ -0,0 +1,160 @@ + + + + + +org.montclairrobotics.alloy.auto + + + + + + + + + + + +
+

Package org.montclairrobotics.alloy.auto

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    AlloyAutonomous +
    Created by MHS Robotics on 12/5/2017.
    +
    SimpleAutonomous +
    Created by MHS Robotics on 1/26/2018.
    +
    State +
    Created by MHS Robotics on 12/16/2017.
    +
    StateMachine +
    Created by MHS Robotics on 12/16/2017.
    +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/auto/package-tree.html b/docs/javadoc/org/montclairrobotics/alloy/auto/package-tree.html new file mode 100644 index 0000000..9996006 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/auto/package-tree.html @@ -0,0 +1,148 @@ + + + + + +org.montclairrobotics.alloy.auto Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package org.montclairrobotics.alloy.auto

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • com.qualcomm.robotcore.eventloop.opmode.OpMode + +
    • +
    • org.montclairrobotics.alloy.auto.State + +
    • +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/auto/package-use.html b/docs/javadoc/org/montclairrobotics/alloy/auto/package-use.html new file mode 100644 index 0000000..e7782a9 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/auto/package-use.html @@ -0,0 +1,159 @@ + + + + + +Uses of Package org.montclairrobotics.alloy.auto + + + + + + + + + + + +
+

Uses of Package
org.montclairrobotics.alloy.auto

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/components/Action.html b/docs/javadoc/org/montclairrobotics/alloy/components/Action.html new file mode 100644 index 0000000..5b23168 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/components/Action.html @@ -0,0 +1,260 @@ + + + + + +Action + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.components
+

Interface Action

+
+
+
+
    +
  • +
    +
    +
    public interface Action
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        start

        +
        void start()
        +
      • +
      + + + +
        +
      • +

        enabled

        +
        void enabled()
        +
      • +
      + + + +
        +
      • +

        stop

        +
        void stop()
        +
      • +
      + + + +
        +
      • +

        disabled

        +
        void disabled()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/components/Component.html b/docs/javadoc/org/montclairrobotics/alloy/components/Component.html new file mode 100644 index 0000000..19dc590 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/components/Component.html @@ -0,0 +1,507 @@ + + + + + +Component + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.components
+

Class Component

+
+
+ +
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    FTCMotor, InputComponent, MotorGroup, MotorModule, TankMapper
    +
    +
    +
    +
    public abstract class Component
    +extends Toggleable
    +
    The main component class that all components of alloy should extend + +

    Alloy is built of a system of components that all work together to operate a robot Components + can be broken down into 2 simple parts
    + -Physical Component
    + -Input Component
    + +

    A physical component would include any part, feature, or function that is physically on the + robot This can include things like motors, manipulators shooters, drivetrain, etc. + +

    An input component is more control based and includes things like buttons, joysticks, + triggers, sensors, flow camera, optical control and anything else that would send an input to a + physical component + +

    All components have the ability to be toggled on and off as well as built in debug capability + for easier testing and debugging of specific components. + +

    There is also a static list of all components that are created so that the updater can + reference them. This means that you can have a method in a component be updated just by adding + the @Update annotation

    +
    +
    Since:
    +
    0.1
    +
    See Also:
    +
    InputComponent
    +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      static java.util.ArrayList<Component>components +
      a static reference of all the components that are made
      +
      static Debuggerdebugger +
      The object used for debugging information about all components
      +
      + +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Component() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidaddDebug(Debug debug) +
      Adds a debug to the component, this will be debugged out every loop if debug mode is enabled
      +
      voidaddDebugs(java.lang.Iterable<? extends Debug> debugs) +
      Adds multiple debugs to the components, they will be debugged out every loop if debug mode is + enabled
      +
      voiddebug() 
      voiddisableAction() +
      The action that is taken when the component is disabled, should be overridden by the user
      +
      voiddisableDebug() +
      Disabled debug mode, stopping all debugs
      +
      voidenableAction() +
      The action that is taken when the component is enabled should be overridden bu the user
      +
      voidenableDebug() +
      Enabled debug mode, causing any debugs added to the component to be debugged out
      +
      static java.util.ArrayList<Component>getComponents() 
      + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        debugger

        +
        public static Debugger debugger
        +
        The object used for debugging information about all components
        +
      • +
      + + + +
        +
      • +

        components

        +
        public static java.util.ArrayList<Component> components
        +
        a static reference of all the components that are made
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Component

        +
        public Component()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getComponents

        +
        public static java.util.ArrayList<Component> getComponents()
        +
      • +
      + + + +
        +
      • +

        addDebug

        +
        public void addDebug(Debug debug)
        +
        Adds a debug to the component, this will be debugged out every loop if debug mode is enabled
        +
      • +
      + + + +
        +
      • +

        addDebugs

        +
        public void addDebugs(java.lang.Iterable<? extends Debug> debugs)
        +
        Adds multiple debugs to the components, they will be debugged out every loop if debug mode is + enabled
        +
      • +
      + + + +
        +
      • +

        enableDebug

        +
        public void enableDebug()
        +
        Enabled debug mode, causing any debugs added to the component to be debugged out
        +
      • +
      + + + +
        +
      • +

        disableDebug

        +
        public void disableDebug()
        +
        Disabled debug mode, stopping all debugs
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public void debug()
        +
      • +
      + + + +
        +
      • +

        enableAction

        +
        public void enableAction()
        +
        The action that is taken when the component is enabled should be overridden bu the user
        +
        +
        Specified by:
        +
        enableAction in class Toggleable
        +
        +
      • +
      + + + +
        +
      • +

        disableAction

        +
        public void disableAction()
        +
        The action that is taken when the component is disabled, should be overridden by the user
        +
        +
        Specified by:
        +
        disableAction in class Toggleable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/components/InputComponent.html b/docs/javadoc/org/montclairrobotics/alloy/components/InputComponent.html new file mode 100644 index 0000000..c138570 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/components/InputComponent.html @@ -0,0 +1,474 @@ + + + + + +InputComponent + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.components
+

Class InputComponent<T>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    T - the type of the input
    +
    +
    +
    All Implemented Interfaces:
    +
    Input
    +
    +
    +
    Direct Known Subclasses:
    +
    BangBang, Differential, Encoder, FTCJoystick, GyroCorrection, PID, TuneablePID
    +
    +
    +
    +
    public abstract class InputComponent<T>
    +extends Component
    +implements Input
    +
    An input component is an extension of a regular component, used for input and control systems + +

    Input components take in a standard input, and have the ability to manipulate them using a + number of steps that can be added. Steps take in the input, perform some sort of manipulation or + calculation and then return the new value. Steps are applied in order of them being added, and + the output of one step gets passed in as the input of the next step. The steps are only applied + if the applySteps() method is called + +

    Input components can also be enabled, or disabled just like regular components, and will + return their calculated value as a regular input

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        input

        +
        public Input<T> input
        +
        The initial input value
        +
      • +
      + + + +
        +
      • +

        output

        +
        public T output
        +
        The value after steps have been applied
        +
      • +
      + + + +
        +
      • +

        steps

        +
        public java.util.ArrayList<Step<T>> steps
        +
        An arraylist to store all of the steps
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InputComponent

        +
        public InputComponent()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        get

        +
        public T get()
        +
        +
        Specified by:
        +
        get in interface Input
        +
        +
      • +
      + + + +
        +
      • +

        applySteps

        +
        public void applySteps()
        +
        Apply all of the steps, in order, taking the output of one step and passing it as the input + to the next
        +
      • +
      + + + +
        +
      • +

        addStep

        +
        public InputComponent addStep(Step s)
        +
        A daisy-chainable method that adds a step to the input component
        +
      • +
      + + + +
        +
      • +

        setInput

        +
        public InputComponent<T> setInput(Input<T> input)
        +
        A daisy-chainable method that sets the initial input of the input component
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/components/Step.html b/docs/javadoc/org/montclairrobotics/alloy/components/Step.html new file mode 100644 index 0000000..2c1a962 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/components/Step.html @@ -0,0 +1,240 @@ + + + + + +Step + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.components
+

Interface Step<T>

+
+
+
+
    +
  • +
    +
    Type Parameters:
    +
    T - the type that the step will be manipulating
    +
    +
    +
    All Known Implementing Classes:
    +
    Deadzone, VectorDeadzone
    +
    +
    +
    +
    public interface Step<T>
    +
    A step is a manipulation or calculation performed on an input + +

    When used in conjunction with an InputComponent, the steps will be applied in order, passing + in the output of one step, into the input of the next step.

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        getOutput

        +
        T getOutput(T input)
        +
        The operation to be performed on the input, to get the output
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/components/class-use/Action.html b/docs/javadoc/org/montclairrobotics/alloy/components/class-use/Action.html new file mode 100644 index 0000000..5a05fcf --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/components/class-use/Action.html @@ -0,0 +1,124 @@ + + + + + +Uses of Interface org.montclairrobotics.alloy.components.Action + + + + + + + + + + + +
+

Uses of Interface
org.montclairrobotics.alloy.components.Action

+
+
No usage of org.montclairrobotics.alloy.components.Action
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/components/class-use/Component.html b/docs/javadoc/org/montclairrobotics/alloy/components/class-use/Component.html new file mode 100644 index 0000000..f081ee1 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/components/class-use/Component.html @@ -0,0 +1,368 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.components.Component + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.components.Component

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/components/class-use/InputComponent.html b/docs/javadoc/org/montclairrobotics/alloy/components/class-use/InputComponent.html new file mode 100644 index 0000000..c49a907 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/components/class-use/InputComponent.html @@ -0,0 +1,380 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.components.InputComponent + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.components.InputComponent

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/components/class-use/Step.html b/docs/javadoc/org/montclairrobotics/alloy/components/class-use/Step.html new file mode 100644 index 0000000..6f4a506 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/components/class-use/Step.html @@ -0,0 +1,233 @@ + + + + + +Uses of Interface org.montclairrobotics.alloy.components.Step + + + + + + + + + + + +
+

Uses of Interface
org.montclairrobotics.alloy.components.Step

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/components/package-frame.html b/docs/javadoc/org/montclairrobotics/alloy/components/package-frame.html new file mode 100644 index 0000000..a790a05 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/components/package-frame.html @@ -0,0 +1,25 @@ + + + + + +org.montclairrobotics.alloy.components + + + + + +

org.montclairrobotics.alloy.components

+
+

Interfaces

+ +

Classes

+ +
+ + diff --git a/docs/javadoc/org/montclairrobotics/alloy/components/package-summary.html b/docs/javadoc/org/montclairrobotics/alloy/components/package-summary.html new file mode 100644 index 0000000..ce57f2a --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/components/package-summary.html @@ -0,0 +1,165 @@ + + + + + +org.montclairrobotics.alloy.components + + + + + + + + + + + +
+

Package org.montclairrobotics.alloy.components

+
+
+
    +
  • + + + + + + + + + + + + +
    Interface Summary 
    InterfaceDescription
    Step<T> +
    A step is a manipulation or calculation performed on an input
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Component +
    The main component class that all components of alloy should extend
    +
    InputComponent<T> +
    An input component is an extension of a regular component, used for input and control systems
    +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/components/package-tree.html b/docs/javadoc/org/montclairrobotics/alloy/components/package-tree.html new file mode 100644 index 0000000..85d1f5b --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/components/package-tree.html @@ -0,0 +1,147 @@ + + + + + +org.montclairrobotics.alloy.components Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package org.montclairrobotics.alloy.components

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • org.montclairrobotics.alloy.utils.Toggleable +
        +
      • org.montclairrobotics.alloy.components.Component +
          +
        • org.montclairrobotics.alloy.components.InputComponent<T> (implements org.montclairrobotics.alloy.utils.Input<T>)
        • +
        +
      • +
      +
    • +
    +
  • +
+

Interface Hierarchy

+
    +
  • org.montclairrobotics.alloy.components.Step<T>
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/components/package-use.html b/docs/javadoc/org/montclairrobotics/alloy/components/package-use.html new file mode 100644 index 0000000..da4b1a2 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/components/package-use.html @@ -0,0 +1,325 @@ + + + + + +Uses of Package org.montclairrobotics.alloy.components + + + + + + + + + + + +
+

Uses of Package
org.montclairrobotics.alloy.components

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/control/ButtonAction.html b/docs/javadoc/org/montclairrobotics/alloy/control/ButtonAction.html new file mode 100644 index 0000000..5a37d7e --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/control/ButtonAction.html @@ -0,0 +1,403 @@ + + + + + +ButtonAction + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.control
+

Class ButtonAction

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.control.ButtonAction
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    ToggleButton
    +
    +
    +
    +
    public abstract class ButtonAction
    +extends java.lang.Object
    +
    Every Button action is tied to a button, and controls what happens when the button is pressed, + held, unpressed, and released
    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      Buttonbutton +
      The button that controls the action
      +
      booleanwasPressed +
      Keeps track of if the button was pressed in the previous loop, used for telling when the + button is pressed/unpressed
      +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ButtonAction(Button button) +
      Creates a button action tied to a button
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and TypeMethod and Description
      abstract voidonPressed() +
      On pressed is called once, when the button goes from being unpressed, to pressed
      +
      abstract voidonReleased() +
      On released is called once, when the button goes from being pressed, to unpressed
      +
      voidupdate() 
      abstract voidwhilePressed() +
      While pressed is called every loop while the button is pressed
      +
      abstract voidwhileReleased() +
      While released is called every loop while the button is unpressed
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        button

        +
        public Button button
        +
        The button that controls the action
        +
      • +
      + + + +
        +
      • +

        wasPressed

        +
        public boolean wasPressed
        +
        Keeps track of if the button was pressed in the previous loop, used for telling when the + button is pressed/unpressed
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ButtonAction

        +
        public ButtonAction(Button button)
        +
        Creates a button action tied to a button
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        onPressed

        +
        public abstract void onPressed()
        +
        On pressed is called once, when the button goes from being unpressed, to pressed
        +
      • +
      + + + +
        +
      • +

        onReleased

        +
        public abstract void onReleased()
        +
        On released is called once, when the button goes from being pressed, to unpressed
        +
      • +
      + + + +
        +
      • +

        whilePressed

        +
        public abstract void whilePressed()
        +
        While pressed is called every loop while the button is pressed
        +
      • +
      + + + +
        +
      • +

        whileReleased

        +
        public abstract void whileReleased()
        +
        While released is called every loop while the button is unpressed
        +
      • +
      + + + +
        +
      • +

        update

        +
        public void update()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/control/ToggleButton.html b/docs/javadoc/org/montclairrobotics/alloy/control/ToggleButton.html new file mode 100644 index 0000000..3b4fe01 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/control/ToggleButton.html @@ -0,0 +1,374 @@ + + + + + +ToggleButton + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.control
+

Class ToggleButton

+
+
+ +
+
    +
  • +
    +
    +
    public class ToggleButton
    +extends ButtonAction
    +
    A ToggleButton is tied to a button and a toggleable, when the button is pressed the toggleable + will toggle between states
    +
    +
    Since:
    +
    0.1
    +
    See Also:
    +
    Toggleable, +ButtonAction
    +
    +
  • +
+
+
+
    +
  • + + + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidonPressed() +
      On pressed is called once, when the button goes from being unpressed, to pressed
      +
      voidonReleased() +
      On released is called once, when the button goes from being pressed, to unpressed
      +
      voidwhilePressed() +
      While pressed is called every loop while the button is pressed
      +
      voidwhileReleased() +
      While released is called every loop while the button is unpressed
      +
      + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ToggleButton

        +
        public ToggleButton(Button button,
        +                    Toggleable toggleable)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        onPressed

        +
        public void onPressed()
        +
        On pressed is called once, when the button goes from being unpressed, to pressed
        +
        +
        Specified by:
        +
        onPressed in class ButtonAction
        +
        +
      • +
      + + + +
        +
      • +

        onReleased

        +
        public void onReleased()
        +
        On released is called once, when the button goes from being pressed, to unpressed
        +
        +
        Specified by:
        +
        onReleased in class ButtonAction
        +
        +
      • +
      + + + +
        +
      • +

        whilePressed

        +
        public void whilePressed()
        +
        While pressed is called every loop while the button is pressed
        +
        +
        Specified by:
        +
        whilePressed in class ButtonAction
        +
        +
      • +
      + + + +
        +
      • +

        whileReleased

        +
        public void whileReleased()
        +
        While released is called every loop while the button is unpressed
        +
        +
        Specified by:
        +
        whileReleased in class ButtonAction
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/control/class-use/ButtonAction.html b/docs/javadoc/org/montclairrobotics/alloy/control/class-use/ButtonAction.html new file mode 100644 index 0000000..008bef3 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/control/class-use/ButtonAction.html @@ -0,0 +1,167 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.control.ButtonAction + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.control.ButtonAction

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/control/class-use/ToggleButton.html b/docs/javadoc/org/montclairrobotics/alloy/control/class-use/ToggleButton.html new file mode 100644 index 0000000..3e8b91e --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/control/class-use/ToggleButton.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.control.ToggleButton + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.control.ToggleButton

+
+
No usage of org.montclairrobotics.alloy.control.ToggleButton
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/control/package-frame.html b/docs/javadoc/org/montclairrobotics/alloy/control/package-frame.html new file mode 100644 index 0000000..c00b19a --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/control/package-frame.html @@ -0,0 +1,21 @@ + + + + + +org.montclairrobotics.alloy.control + + + + + +

org.montclairrobotics.alloy.control

+
+

Classes

+ +
+ + diff --git a/docs/javadoc/org/montclairrobotics/alloy/control/package-summary.html b/docs/javadoc/org/montclairrobotics/alloy/control/package-summary.html new file mode 100644 index 0000000..be18844 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/control/package-summary.html @@ -0,0 +1,150 @@ + + + + + +org.montclairrobotics.alloy.control + + + + + + + + + + + +
+

Package org.montclairrobotics.alloy.control

+
+
+
    +
  • + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    ButtonAction +
    Every Button action is tied to a button, and controls what happens when the button is pressed, + held, unpressed, and released
    +
    ToggleButton +
    A ToggleButton is tied to a button and a toggleable, when the button is pressed the toggleable + will toggle between states
    +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/control/package-tree.html b/docs/javadoc/org/montclairrobotics/alloy/control/package-tree.html new file mode 100644 index 0000000..99e4605 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/control/package-tree.html @@ -0,0 +1,139 @@ + + + + + +org.montclairrobotics.alloy.control Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package org.montclairrobotics.alloy.control

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/control/package-use.html b/docs/javadoc/org/montclairrobotics/alloy/control/package-use.html new file mode 100644 index 0000000..9bee91d --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/control/package-use.html @@ -0,0 +1,160 @@ + + + + + +Uses of Package org.montclairrobotics.alloy.control + + + + + + + + + + + +
+

Uses of Package
org.montclairrobotics.alloy.control

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/Alloy.html b/docs/javadoc/org/montclairrobotics/alloy/core/Alloy.html new file mode 100644 index 0000000..2a1130d --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/Alloy.html @@ -0,0 +1,443 @@ + + + + + +Alloy + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.core
+

Class Alloy

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • com.qualcomm.robotcore.eventloop.opmode.OpMode
    • +
    • +
        +
      • org.montclairrobotics.alloy.core.Alloy
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    TestRobot
    +
    +
    +
    +
    public abstract class Alloy
    +extends com.qualcomm.robotcore.eventloop.opmode.OpMode
    +
    The main class that takes care of setting up the environment, and running all of the main methods + +

    The alloy class is an extension of the FTC OpMode class, and takes care of preliminary setup + of:
    + - Setting up the global FTC variables in RobotCore
    + - Setting up the global Debugger
    + - Initializing any "initializeables" in the project
    + - Running the users defined methods

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      static java.util.ArrayList<Initializeable>initObjects 
      +
        +
      • + + +

        Fields inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode

        +gamepad1, gamepad2, hardwareMap, internalOpModeServices, msStuckDetectInit, msStuckDetectInitLoop, msStuckDetectLoop, msStuckDetectStart, msStuckDetectStop, telemetry, time
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Alloy() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static DriveTraingetDriveTrain() 
      voidinit() 
      abstract voidinitialization() +
      The initialization method is were everything specific to the OpMode Should be set up.
      +
      voidloop() 
      abstract voidperiodic() +
      Although most of the periodic actions are taken care by the updater, the user may want to add + their own methods and code that need to be updated or run periodically, this can be done in + the periodic() method periodic will be run every loop.
      +
      abstract voidrobotSetup() +
      The robotSetup is where all code specific to robot setup is placed If you only have one + teleop this can be done in the initialization Method.
      +
      static voidsetDriveTrain(DriveTrain driveTrain) 
      +
        +
      • + + +

        Methods inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode

        +getRuntime, init_loop, internalPostInitLoop, internalPostLoop, internalPreInit, internalUpdateTelemetryNow, requestOpModeStop, resetStartTime, start, stop, updateTelemetry
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        initObjects

        +
        public static java.util.ArrayList<Initializeable> initObjects
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Alloy

        +
        public Alloy()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        robotSetup

        +
        public abstract void robotSetup()
        +
        The robotSetup is where all code specific to robot setup is placed If you only have one + teleop this can be done in the initialization Method. robotSetup is called right after the + robot core is initialized
        +
      • +
      + + + +
        +
      • +

        initialization

        +
        public abstract void initialization()
        +
        The initialization method is were everything specific to the OpMode Should be set up. + Initialization will be the first thing called after The robot setup.
        +
      • +
      + + + +
        +
      • +

        periodic

        +
        public abstract void periodic()
        +
        Although most of the periodic actions are taken care by the updater, the user may want to add + their own methods and code that need to be updated or run periodically, this can be done in + the periodic() method periodic will be run every loop.
        +
      • +
      + + + +
        +
      • +

        init

        +
        public void init()
        +
        +
        Specified by:
        +
        init in class com.qualcomm.robotcore.eventloop.opmode.OpMode
        +
        +
      • +
      + + + +
        +
      • +

        loop

        +
        public void loop()
        +
        +
        Specified by:
        +
        loop in class com.qualcomm.robotcore.eventloop.opmode.OpMode
        +
        +
      • +
      + + + +
        +
      • +

        setDriveTrain

        +
        public static void setDriveTrain(DriveTrain driveTrain)
        +
      • +
      + + + +
        +
      • +

        getDriveTrain

        +
        public static DriveTrain getDriveTrain()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/Button.html b/docs/javadoc/org/montclairrobotics/alloy/core/Button.html new file mode 100644 index 0000000..3548968 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/Button.html @@ -0,0 +1,239 @@ + + + + + +Button + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.core
+

Interface Button

+
+
+
+
    +
  • +
    +
    All Known Implementing Classes:
    +
    FTCButton
    +
    +
    +
    +
    public interface Button
    +
    An outline for the fundamental behavior of a button + +

    A button can either be pressed, or unpressed, so the button interface has a method that + returns a boolean value. When implemented, getValue() should return true when the button is + pressed and false when it is unpressed

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getValue

        +
        boolean getValue()
        +
        Gets the value of a button
        +
        +
        Returns:
        +
        returns the value of the button, in most case True(pressed) or False(unpressed)
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/Debug.html b/docs/javadoc/org/montclairrobotics/alloy/core/Debug.html new file mode 100644 index 0000000..bbb14ff --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/Debug.html @@ -0,0 +1,326 @@ + + + + + +Debug + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.core
+

Class Debug

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.core.Debug
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Debug
    +extends java.lang.Object
    +
    Contains the necessary information for a debug + +

    Every debug has a key, which is a title or label of the information being debugged This can be + the type of information ex. 'ERROR', where the information is coming from and what it is ex. + "Right Left Motor encoder value", or any other descriptor of the information + +

    Every debug also has the actual value that is being debugged The part where it is actually + debugged is taken care of the Debugger

    +
    +
    Since:
    +
    0.1
    +
    See Also:
    +
    Debugger
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      java.lang.Stringkey +
      The key, label, or name of the information
      +
      Input<java.lang.Object>value +
      The information, or object to be debugged
      +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Debug(java.lang.String key, + Input<java.lang.Object> value) +
      debug a changing value
      +
      Debug(java.lang.String key, + java.lang.Object value) +
      debug a constant value
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        key

        +
        public java.lang.String key
        +
        The key, label, or name of the information
        +
      • +
      + + + +
        +
      • +

        value

        +
        public Input<java.lang.Object> value
        +
        The information, or object to be debugged
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Debug

        +
        public Debug(java.lang.String key,
        +             Input<java.lang.Object> value)
        +
        debug a changing value
        +
      • +
      + + + +
        +
      • +

        Debug

        +
        public Debug(java.lang.String key,
        +             java.lang.Object value)
        +
        debug a constant value
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/Debugger.Level.html b/docs/javadoc/org/montclairrobotics/alloy/core/Debugger.Level.html new file mode 100644 index 0000000..019bce1 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/Debugger.Level.html @@ -0,0 +1,434 @@ + + + + + +Debugger.Level + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.core
+

Enum Debugger.Level

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Debugger.Level>
    • +
    • +
        +
      • org.montclairrobotics.alloy.core.Debugger.Level
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Debugger.Level>
    +
    +
    +
    Enclosing class:
    +
    Debugger
    +
    +
    +
    +
    public static enum Debugger.Level
    +extends java.lang.Enum<Debugger.Level>
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Summary

      + + + + + + + + + + + + + + + + + + + + + + + +
      Enum Constants 
      Enum Constant and Description
      COMPETITION +
      Competition debugs should contain information that is important to the drive team during + a competition match.
      +
      DEBUG +
      Debugs should contain the most information about a mechanism or process.
      +
      ERROR +
      Error Debugs should never be Turned off.
      +
      OVERRIDE +
      The override can be used to override the level system and ouput any information Overrides + are always enabled
      +
      TEST +
      Test debugs should be used when testing functionality of a process or mechanism, Tests + should contain simple and important information to the process rather than an in depth + look on how everything is working.
      +
      WARNING +
      Warnings should display when there is a potential problem with robot operation
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      intgetRank() 
      static Debugger.LevelvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Debugger.Level[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        OVERRIDE

        +
        public static final Debugger.Level OVERRIDE
        +
        The override can be used to override the level system and ouput any information Overrides + are always enabled
        +
      • +
      + + + +
        +
      • +

        ERROR

        +
        public static final Debugger.Level ERROR
        +
        Error Debugs should never be Turned off. Error debugs will display when anything that is + critical to robot operation occurs
        +
      • +
      + + + +
        +
      • +

        COMPETITION

        +
        public static final Debugger.Level COMPETITION
        +
        Competition debugs should contain information that is important to the drive team during + a competition match.
        +
      • +
      + + + +
        +
      • +

        WARNING

        +
        public static final Debugger.Level WARNING
        +
        Warnings should display when there is a potential problem with robot operation
        +
      • +
      + + + +
        +
      • +

        TEST

        +
        public static final Debugger.Level TEST
        +
        Test debugs should be used when testing functionality of a process or mechanism, Tests + should contain simple and important information to the process rather than an in depth + look on how everything is working.
        +
      • +
      + + + +
        +
      • +

        DEBUG

        +
        public static final Debugger.Level DEBUG
        +
        Debugs should contain the most information about a mechanism or process. For example, + debug information for a motor would include its target speed, current speed, target + position, current position, direction, % error, and so on. Debugs should only be turned + on when fixing problems, as the amount of information can be quite cluttering
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Debugger.Level[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Debugger.Level c : Debugger.Level.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Debugger.Level valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        getRank

        +
        public int getRank()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/Debugger.html b/docs/javadoc/org/montclairrobotics/alloy/core/Debugger.html new file mode 100644 index 0000000..5ef7144 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/Debugger.html @@ -0,0 +1,553 @@ + + + + + +Debugger + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.core
+

Class Debugger

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.core.Debugger
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    FTCDebugger
    +
    +
    +
    +
    public abstract class Debugger
    +extends java.lang.Object
    +
    Controls the flow of how debug information is read out + +

    Debugs are used for debugging information to the user In ftc the debugs use Telemetry to read + an output to the phone The debug allows for easier usage of the telemetry methods That are most + used for debugging. + +

    The Debugger also has different debug levels, so that the user can easily switch the amount of + information they are getting. For example, the user would want a lot of information about a + particular part when they are fixing a problem or tuning the robot, but only important + information when they are driving in a competition

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      + + + + + + + + + + +
      Nested Classes 
      Modifier and TypeClass and Description
      static class Debugger.Level 
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      static Debugger.LeveldebugLevel +
      Current Debug Level
      +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Debugger() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddebug(Debug debug) +
      Debugs out a debug object
      +
      voiddebug(java.lang.String key, + java.lang.Object value) +
      Debug out verbose information
      +
      voiddriverInfo(java.lang.String key, + java.lang.Object value) +
      Give a message intended for the driver during practice or competition operation
      +
      voiderror(java.lang.String error) +
      Gives an error message to the user
      +
      voidlog(java.lang.String key, + java.lang.Object value, + Debugger.Level level) +
      Debugs a value if the level is lower than the current debug level
      +
      abstract voidout(java.lang.String key, + java.lang.Object value) +
      The most basic debug that simply outputs information given a key and value
      +
      voidoverride(java.lang.String key, + java.lang.Object value) +
      A message that overrides the debug level system
      +
      static voidsetDebugLevel(Debugger.Level level) +
      Set the debug level
      +
      voidtest(java.lang.String key, + java.lang.Object value) +
      Information to be displayed when testing a process or mechanism
      +
      voidwarn(java.lang.String warning) +
      Gives a warning to the user
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        debugLevel

        +
        public static Debugger.Level debugLevel
        +
        Current Debug Level
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Debugger

        +
        public Debugger()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setDebugLevel

        +
        public static void setDebugLevel(Debugger.Level level)
        +
        Set the debug level
        +
        +
        Parameters:
        +
        level - The level to be set
        +
        +
      • +
      + + + +
        +
      • +

        out

        +
        public abstract void out(java.lang.String key,
        +                         java.lang.Object value)
        +
        The most basic debug that simply outputs information given a key and value
        +
        +
        Parameters:
        +
        key - Key of the value being debugged
        +
        value - Value to be debugged
        +
        +
      • +
      + + + +
        +
      • +

        log

        +
        public void log(java.lang.String key,
        +                java.lang.Object value,
        +                Debugger.Level level)
        +
        Debugs a value if the level is lower than the current debug level
        +
        +
        Parameters:
        +
        key - Name of the value
        +
        value - Value to be debugged
        +
        level - the level this debug is, if the debug level is lower than the current level, this will not be degbugged
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public void debug(Debug debug)
        +
        Debugs out a debug object
        +
        +
        Parameters:
        +
        debug - the object to be debugged
        +
        +
      • +
      + + + +
        +
      • +

        debug

        +
        public void debug(java.lang.String key,
        +                  java.lang.Object value)
        +
        Debug out verbose information
        +
        +
        Parameters:
        +
        key - Name of the value
        +
        value - Value to be displayed
        +
        +
      • +
      + + + +
        +
      • +

        warn

        +
        public void warn(java.lang.String warning)
        +
        Gives a warning to the user
        +
        +
        Parameters:
        +
        warning - the warning
        +
        +
      • +
      + + + +
        +
      • +

        error

        +
        public void error(java.lang.String error)
        +
        Gives an error message to the user
        +
        +
        Parameters:
        +
        error - the error message to be displayed
        +
        +
      • +
      + + + +
        +
      • +

        driverInfo

        +
        public void driverInfo(java.lang.String key,
        +                       java.lang.Object value)
        +
        Give a message intended for the driver during practice or competition operation
        +
        +
        Parameters:
        +
        key - Name of the value
        +
        value - Value to be displayed
        +
        +
      • +
      + + + +
        +
      • +

        test

        +
        public void test(java.lang.String key,
        +                 java.lang.Object value)
        +
        Information to be displayed when testing a process or mechanism
        +
        +
        Parameters:
        +
        key - Name of the value
        +
        value - Value to be displayed
        +
        +
      • +
      + + + +
        +
      • +

        override

        +
        public void override(java.lang.String key,
        +                     java.lang.Object value)
        +
        A message that overrides the debug level system
        +
        +
        Parameters:
        +
        key - Name of the value
        +
        value - Value to be displayed
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/Encoder.html b/docs/javadoc/org/montclairrobotics/alloy/core/Encoder.html new file mode 100644 index 0000000..22a92e8 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/Encoder.html @@ -0,0 +1,585 @@ + + + + + +Encoder + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.core
+

Class Encoder

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Input
    +
    +
    +
    +
    public abstract class Encoder
    +extends InputComponent<java.lang.Integer>
    +
    A motor encoder that keeps track of kinematic information about the motor + +

    At a basic level hardware encoders are able to get how far a motor has gone as a unit of + encoder ticks. The encoder class also calculates the acceleration anc velocity of the motor in + terms of encoder ticks, and then the user can define the distance of unit to measure the motor in

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Encoder

        +
        public Encoder(double distancePerTick,
        +               double maxSpeed)
        +
      • +
      + + + +
        +
      • +

        Encoder

        +
        public Encoder()
        +
        Create a new encoder with default values
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getRawTicks

        +
        public abstract int getRawTicks()
        +
        A method that should be overridden by the encoder
        +
        +
        Returns:
        +
        the raw value of encoder ticks that the encoder reads
        +
        +
      • +
      + + + +
        +
      • +

        getTicks

        +
        public int getTicks()
        +
        +
        Returns:
        +
        the currnet ticks, this value is affected by encoder resets
        +
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        soft reset the encoder, setting the current value as 0 ticks
        +
      • +
      + + + +
        +
      • +

        setDistancePerTick

        +
        public Encoder setDistancePerTick(double distancePerTick)
        +
        Set the distance per tick + +

        The distance per tick is the amount of distance the motor will move (or what the motor is + attached to, eg wheel/lift) The distance unit should stay consistent throughout the robot + project This method can also be daisychained as it returns a reference to itself

        +
        +
        Parameters:
        +
        distancePerTick - how far the motor moves for 1 encoder tick
        +
        Returns:
        +
        the encoder
        +
        +
      • +
      + + + +
        +
      • +

        setMaxSpeed

        +
        public Encoder setMaxSpeed(double maxSpeed)
        +
        Set the max speed (In Ticks per Second) that the motor can run
        +
        +
        Parameters:
        +
        maxSpeed - max speed that the motor can run
        +
        Returns:
        +
        the encoder
        +
        +
      • +
      + + + +
        +
      • +

        getRawVelocity

        +
        public double getRawVelocity()
        +
        Get the velocity in Ticks per Second
        +
        +
        Returns:
        +
        velocity in ticks per second
        +
        +
      • +
      + + + +
        +
      • +

        getVelocity

        +
        public double getVelocity()
        +
        Get the velocity in distance per second The distance is set by the distance per tick method, + it is important to keep distances consistent throughout the project.
        +
        +
        Returns:
        +
        velocity in distance per second
        +
        +
      • +
      + + + +
        +
      • +

        getAcceleration

        +
        public double getAcceleration()
        +
        Get the acceleration in distance per second The distance is set by the distance per tick + method, it is important to keep distances consistent throughout
        +
        +
        Returns:
        +
        acceleration in distance per second
        +
        +
      • +
      + + + +
        +
      • +

        getScaledVelocity

        +
        public double getScaledVelocity()
        +
        Get a scaled value (0 - 1) of how fast the motor is going
        +
        +
        Returns:
        +
        a value 0 - 1 depending on how fast the motor is going
        +
        +
      • +
      + + + +
        +
      • +

        getVelocityDifferential

        +
        public Differential getVelocityDifferential()
        +
        +
        Returns:
        +
        the differential object that calculates the velocity
        +
        +
      • +
      + + + +
        +
      • +

        getAccelerationDifferential

        +
        public Differential getAccelerationDifferential()
        +
        +
        Returns:
        +
        the differential object that calculates the acceleration
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/Joystick.html b/docs/javadoc/org/montclairrobotics/alloy/core/Joystick.html new file mode 100644 index 0000000..2b85d03 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/Joystick.html @@ -0,0 +1,237 @@ + + + + + +Joystick + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.core
+

Interface Joystick

+
+
+
+
    +
  • +
    +
    All Known Implementing Classes:
    +
    FTCJoystick
    +
    +
    +
    +
    public interface Joystick
    +
    The fundamental outline for all standard 2-axis joysticks + +

    Joysticks should return a vector made up of the X and Y values of their position

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getValue

        +
        Vector getValue()
        +
        Gets the position of the joystick
        +
        +
        Returns:
        +
        a vector made up of the X and Y values of the Joysticks Position
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/Mode.html b/docs/javadoc/org/montclairrobotics/alloy/core/Mode.html new file mode 100644 index 0000000..e728f82 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/Mode.html @@ -0,0 +1,350 @@ + + + + + +Mode + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.core
+

Enum Mode

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Mode>
    • +
    • +
        +
      • org.montclairrobotics.alloy.core.Mode
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Mode>
    +
    +
    +
    +
    public enum Mode
    +extends java.lang.Enum<Mode>
    +
    All of the different running states that the robot can be in
    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Summary

      + + + + + + + + + + + +
      Enum Constants 
      Enum Constant and Description
      FTCAUTONOMOUS +
      ftc autonomous mode
      +
      FTCTELEOP +
      ftc Telemetry Operated Mode
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static ModevalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Mode[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        FTCTELEOP

        +
        public static final Mode FTCTELEOP
        +
        ftc Telemetry Operated Mode
        +
      • +
      + + + +
        +
      • +

        FTCAUTONOMOUS

        +
        public static final Mode FTCAUTONOMOUS
        +
        ftc autonomous mode
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Mode[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Mode c : Mode.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Mode valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/Motor.html b/docs/javadoc/org/montclairrobotics/alloy/core/Motor.html new file mode 100644 index 0000000..ba5634d --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/Motor.html @@ -0,0 +1,302 @@ + + + + + +Motor + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.core
+

Interface Motor

+
+
+
+
    +
  • +
    +
    All Known Subinterfaces:
    +
    TargetMotor
    +
    +
    +
    All Known Implementing Classes:
    +
    FTCMotor, FTCTargetMotor
    +
    +
    +
    +
    public interface Motor
    +
    An outline for all of the basic motor behavior + +

    The very basic functionality of any mechanical motor This includes setting power, and + inverting the motor

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setMotorPower

        +
        void setMotorPower(double power)
        +
        Sets the motor Power
        +
        +
        Parameters:
        +
        power - the power that the motor will be set to (0-1 inclusive )
        +
        +
      • +
      + + + +
        +
      • +

        getMotorPower

        +
        double getMotorPower()
        +
        Gets the motor power
        +
        +
        Returns:
        +
        the current motor power, a value between (0-1)
        +
        +
      • +
      + + + +
        +
      • +

        setInverted

        +
        void setInverted(boolean inverted)
        +
        Sets weather the motor runs the default way , or inverted
        +
        +
        Parameters:
        +
        inverted - true for inverted, false for normal
        +
        +
      • +
      + + + +
        +
      • +

        getInverted

        +
        boolean getInverted()
        +
        Gets weather the motor is inverted
        +
        +
        Returns:
        +
        true if the motor is inverted
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/RobotCore.html b/docs/javadoc/org/montclairrobotics/alloy/core/RobotCore.html new file mode 100644 index 0000000..1243a7f --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/RobotCore.html @@ -0,0 +1,455 @@ + + + + + +RobotCore + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.core
+

Class RobotCore

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.core.RobotCore
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class RobotCore
    +extends java.lang.Object
    +
    Stores all of the global robot objects, including telemetry, the hardware map, and gamepads + +

    Since essential parts to the robots operation are stored in OpMode + +

    With this, the user can acess all of the objects throughout the project. + +

    The robot core class creates static instances of all of the essential objects on + initialization The actual objects are passed in in the alloy class

    +
    +
    Since:
    +
    0.1
    +
    See Also:
    +
    OpMode, +Alloy
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      static com.qualcomm.robotcore.hardware.Gamepadgamepad1 +
      The first gamepad, generated by pressing start + 'a' on the controller
      +
      static com.qualcomm.robotcore.hardware.Gamepadgamepad2 +
      The second gamepad, generated by pressing start + 'b' on the controller
      +
      static com.qualcomm.robotcore.hardware.HardwareMaphardwareMap +
      The hardware map is essential to any robot and is how the ftc core interacts with the + hardware devices on the phones
      +
      static org.firstinspires.ftc.robotcore.external.Telemetrytelemetry +
      Telemetry is used for reading out information on the phones and is useful for debugging, The + telemetry is also used in Debug
      +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      RobotCore(org.firstinspires.ftc.robotcore.external.Telemetry telemetry, + com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, + com.qualcomm.robotcore.hardware.Gamepad gamepad1, + com.qualcomm.robotcore.hardware.Gamepad gamepad2) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static com.qualcomm.robotcore.hardware.GamepadgetGamepad1() +
      Gets the first gamepad
      +
      static com.qualcomm.robotcore.hardware.GamepadgetGamepad2() +
      Gets the second gamepad
      +
      static com.qualcomm.robotcore.hardware.HardwareMapgetHardwareMap() +
      Gets the hardware map of the robot
      +
      static org.firstinspires.ftc.robotcore.external.TelemetrygetTelemetry() +
      Gets the telemetry object of the robot
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        telemetry

        +
        public static org.firstinspires.ftc.robotcore.external.Telemetry telemetry
        +
        Telemetry is used for reading out information on the phones and is useful for debugging, The + telemetry is also used in Debug
        +
        +
        See Also:
        +
        Debug
        +
        +
      • +
      + + + +
        +
      • +

        hardwareMap

        +
        public static com.qualcomm.robotcore.hardware.HardwareMap hardwareMap
        +
        The hardware map is essential to any robot and is how the ftc core interacts with the + hardware devices on the phones
        +
      • +
      + + + +
        +
      • +

        gamepad1

        +
        public static com.qualcomm.robotcore.hardware.Gamepad gamepad1
        +
        The first gamepad, generated by pressing start + 'a' on the controller
        +
      • +
      + + + +
        +
      • +

        gamepad2

        +
        public static com.qualcomm.robotcore.hardware.Gamepad gamepad2
        +
        The second gamepad, generated by pressing start + 'b' on the controller
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        RobotCore

        +
        public RobotCore(org.firstinspires.ftc.robotcore.external.Telemetry telemetry,
        +                 com.qualcomm.robotcore.hardware.HardwareMap hardwareMap,
        +                 com.qualcomm.robotcore.hardware.Gamepad gamepad1,
        +                 com.qualcomm.robotcore.hardware.Gamepad gamepad2)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getHardwareMap

        +
        public static com.qualcomm.robotcore.hardware.HardwareMap getHardwareMap()
        +
        Gets the hardware map of the robot
        +
        +
        Returns:
        +
        the hardware map
        +
        +
      • +
      + + + +
        +
      • +

        getTelemetry

        +
        public static org.firstinspires.ftc.robotcore.external.Telemetry getTelemetry()
        +                                                                       throws java.lang.NullPointerException
        +
        Gets the telemetry object of the robot
        +
        +
        Returns:
        +
        telemetry
        +
        Throws:
        +
        java.lang.NullPointerException
        +
        +
      • +
      + + + +
        +
      • +

        getGamepad1

        +
        public static com.qualcomm.robotcore.hardware.Gamepad getGamepad1()
        +
        Gets the first gamepad
        +
        +
        Returns:
        +
        gamepad1
        +
        +
      • +
      + + + +
        +
      • +

        getGamepad2

        +
        public static com.qualcomm.robotcore.hardware.Gamepad getGamepad2()
        +
        Gets the second gamepad
        +
        +
        Returns:
        +
        gamepad1
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/TargetMotor.html b/docs/javadoc/org/montclairrobotics/alloy/core/TargetMotor.html new file mode 100644 index 0000000..2f7576e --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/TargetMotor.html @@ -0,0 +1,312 @@ + + + + + +TargetMotor + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.core
+

Interface TargetMotor

+
+
+
+
    +
  • +
    +
    All Superinterfaces:
    +
    Motor
    +
    +
    +
    All Known Implementing Classes:
    +
    FTCTargetMotor
    +
    +
    +
    +
    public interface TargetMotor
    +extends Motor
    +
    Target motor is a motor interface for motors that have encoders. Target motors can set encoder + positions using PID control + +

    Target motors define the action for more advanced motors, that have access to more information + and are able to be more finely tuned. Because they have encoders, more advanced control + mechanisms can be used such as PID control, to gain better, more accurate control over the motors

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setTargetPower

        +
        void setTargetPower(double power)
        +
        Sets the motor Power
        +
        +
        Parameters:
        +
        power - the power that the motor will be set to (0-1 inclusive )
        +
        +
      • +
      + + + +
        +
      • +

        getTargetPower

        +
        double getTargetPower()
        +
        Gets the motor power
        +
        +
        Returns:
        +
        the current motor power, a value between (0-1)
        +
        +
      • +
      + + + +
        +
      • +

        setPosition

        +
        void setPosition(int position)
        +
        Sets the motor position
        +
        +
        Parameters:
        +
        position - the position the motor will be set to (in encoder ticks)
        +
        +
      • +
      + + + +
        +
      • +

        getPosition

        +
        int getPosition()
        +
        Gets the motors position
        +
        +
        Returns:
        +
        the position that the motor is at (in encoder ticks)
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Alloy.html b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Alloy.html new file mode 100644 index 0000000..1ee998d --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Alloy.html @@ -0,0 +1,164 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.core.Alloy + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.core.Alloy

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Button.html b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Button.html new file mode 100644 index 0000000..0e331ff --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Button.html @@ -0,0 +1,207 @@ + + + + + +Uses of Interface org.montclairrobotics.alloy.core.Button + + + + + + + + + + + +
+

Uses of Interface
org.montclairrobotics.alloy.core.Button

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Debug.html b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Debug.html new file mode 100644 index 0000000..3025dc4 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Debug.html @@ -0,0 +1,206 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.core.Debug + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.core.Debug

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Debugger.Level.html b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Debugger.Level.html new file mode 100644 index 0000000..fdc896f --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Debugger.Level.html @@ -0,0 +1,211 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.core.Debugger.Level + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.core.Debugger.Level

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Debugger.html b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Debugger.html new file mode 100644 index 0000000..a137347 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Debugger.html @@ -0,0 +1,190 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.core.Debugger + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.core.Debugger

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Encoder.html b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Encoder.html new file mode 100644 index 0000000..74a2855 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Encoder.html @@ -0,0 +1,294 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.core.Encoder + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.core.Encoder

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Joystick.html b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Joystick.html new file mode 100644 index 0000000..f1016f7 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Joystick.html @@ -0,0 +1,166 @@ + + + + + +Uses of Interface org.montclairrobotics.alloy.core.Joystick + + + + + + + + + + + +
+

Uses of Interface
org.montclairrobotics.alloy.core.Joystick

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Mode.html b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Mode.html new file mode 100644 index 0000000..e2da51b --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Mode.html @@ -0,0 +1,173 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.core.Mode + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.core.Mode

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Motor.html b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Motor.html new file mode 100644 index 0000000..6354865 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/Motor.html @@ -0,0 +1,280 @@ + + + + + +Uses of Interface org.montclairrobotics.alloy.core.Motor + + + + + + + + + + + +
+

Uses of Interface
org.montclairrobotics.alloy.core.Motor

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/class-use/RobotCore.html b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/RobotCore.html new file mode 100644 index 0000000..a9fd49a --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/RobotCore.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.core.RobotCore + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.core.RobotCore

+
+
No usage of org.montclairrobotics.alloy.core.RobotCore
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/class-use/TargetMotor.html b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/TargetMotor.html new file mode 100644 index 0000000..542e391 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/class-use/TargetMotor.html @@ -0,0 +1,166 @@ + + + + + +Uses of Interface org.montclairrobotics.alloy.core.TargetMotor + + + + + + + + + + + +
+

Uses of Interface
org.montclairrobotics.alloy.core.TargetMotor

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/package-frame.html b/docs/javadoc/org/montclairrobotics/alloy/core/package-frame.html new file mode 100644 index 0000000..a74c60d --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/package-frame.html @@ -0,0 +1,36 @@ + + + + + +org.montclairrobotics.alloy.core + + + + + +

org.montclairrobotics.alloy.core

+
+

Interfaces

+ +

Classes

+ +

Enums

+ +
+ + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/package-summary.html b/docs/javadoc/org/montclairrobotics/alloy/core/package-summary.html new file mode 100644 index 0000000..8d8552d --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/package-summary.html @@ -0,0 +1,222 @@ + + + + + +org.montclairrobotics.alloy.core + + + + + + + + + + + +
+

Package org.montclairrobotics.alloy.core

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + +
    Interface Summary 
    InterfaceDescription
    Button +
    An outline for the fundamental behavior of a button
    +
    Joystick +
    The fundamental outline for all standard 2-axis joysticks
    +
    Motor +
    An outline for all of the basic motor behavior
    +
    TargetMotor +
    Target motor is a motor interface for motors that have encoders.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Alloy +
    The main class that takes care of setting up the environment, and running all of the main methods
    +
    Debug +
    Contains the necessary information for a debug
    +
    Debugger +
    Controls the flow of how debug information is read out
    +
    Encoder +
    A motor encoder that keeps track of kinematic information about the motor
    +
    RobotCore +
    Stores all of the global robot objects, including telemetry, the hardware map, and gamepads
    +
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Debugger.Level 
    Mode +
    All of the different running states that the robot can be in
    +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/package-tree.html b/docs/javadoc/org/montclairrobotics/alloy/core/package-tree.html new file mode 100644 index 0000000..7a48901 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/package-tree.html @@ -0,0 +1,178 @@ + + + + + +org.montclairrobotics.alloy.core Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package org.montclairrobotics.alloy.core

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • org.montclairrobotics.alloy.core.Debug
    • +
    • org.montclairrobotics.alloy.core.Debugger
    • +
    • com.qualcomm.robotcore.eventloop.opmode.OpMode +
        +
      • org.montclairrobotics.alloy.core.Alloy
      • +
      +
    • +
    • org.montclairrobotics.alloy.core.RobotCore
    • +
    • org.montclairrobotics.alloy.utils.Toggleable +
        +
      • org.montclairrobotics.alloy.components.Component +
          +
        • org.montclairrobotics.alloy.components.InputComponent<T> (implements org.montclairrobotics.alloy.utils.Input<T>) +
            +
          • org.montclairrobotics.alloy.core.Encoder
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+

Interface Hierarchy

+
    +
  • org.montclairrobotics.alloy.core.Button
  • +
  • org.montclairrobotics.alloy.core.Joystick
  • +
  • org.montclairrobotics.alloy.core.Motor + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) +
        +
      • org.montclairrobotics.alloy.core.Mode
      • +
      • org.montclairrobotics.alloy.core.Debugger.Level
      • +
      +
    • +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/core/package-use.html b/docs/javadoc/org/montclairrobotics/alloy/core/package-use.html new file mode 100644 index 0000000..db073ec --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/core/package-use.html @@ -0,0 +1,343 @@ + + + + + +Uses of Package org.montclairrobotics.alloy.core + + + + + + + + + + + +
+

Uses of Package
org.montclairrobotics.alloy.core

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/drive/DTInput.html b/docs/javadoc/org/montclairrobotics/alloy/drive/DTInput.html new file mode 100644 index 0000000..20c9815 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/drive/DTInput.html @@ -0,0 +1,301 @@ + + + + + +DTInput + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.drive
+

Class DTInput

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.drive.DTInput
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class DTInput
    +extends java.lang.Object
    +
    An input for a drivetrain that takes a rate of translation, and rotation + +

    A DTInput contains the information for controlling a drivetrain. This information is the + translation, or the rate at which the robot wil move and the rotation, the rate that the robot + will turn

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      DTInput(Vector translation, + Angle rotation) 
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        DTInput

        +
        public DTInput(Vector translation,
        +               Angle rotation)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getTranslation

        +
        public Vector getTranslation()
        +
        +
        Returns:
        +
        the rate at which the robot will move
        +
        +
      • +
      + + + +
        +
      • +

        getRotation

        +
        public Angle getRotation()
        +
        +
        Returns:
        +
        the rate at which the robot will rotate
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/drive/DTMapper.html b/docs/javadoc/org/montclairrobotics/alloy/drive/DTMapper.html new file mode 100644 index 0000000..ce01fab --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/drive/DTMapper.html @@ -0,0 +1,200 @@ + + + + + +DTMapper + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.drive
+

Interface DTMapper

+
+
+
+
    +
  • +
    +
    All Superinterfaces:
    +
    Mapper<DTInput>
    +
    +
    +
    All Known Implementing Classes:
    +
    TankMapper
    +
    +
    +
    +
    public interface DTMapper
    +extends Mapper<DTInput>
    +
    A mapper that specifically takes in DTInputs
    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Summary

      +
        +
      • + + +

        Methods inherited from interface org.montclairrobotics.alloy.motor.Mapper

        +map
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/drive/DriveModule.html b/docs/javadoc/org/montclairrobotics/alloy/drive/DriveModule.html new file mode 100644 index 0000000..e9011c9 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/drive/DriveModule.html @@ -0,0 +1,327 @@ + + + + + +DriveModule + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.drive
+

Class DriveModule

+
+
+ +
+
    +
  • +
    +
    +
    public class DriveModule
    +extends MotorModule
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        DriveModule

        +
        public DriveModule(Vector direction,
        +                   Encoder encoder,
        +                   ErrorCorrection<java.lang.Double> powerControl,
        +                   Motor... motors)
        +
        Create a fully functioning motor module + +

        Modules created like this will be able to adjust their speed based on an error correction + to maintain a more accurate speed.

        +
        +
        Parameters:
        +
        direction - the direction that the module runs (for use in motor groups)
        +
        encoder - the encoder that keeps track of the motors position
        +
        powerControl - an error correction to adjust the speed of the module
        +
        motors - the motors that the module controls
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/drive/DriveTrain.html b/docs/javadoc/org/montclairrobotics/alloy/drive/DriveTrain.html new file mode 100644 index 0000000..1e16437 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/drive/DriveTrain.html @@ -0,0 +1,394 @@ + + + + + +DriveTrain + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.drive
+

Class DriveTrain

+
+
+ +
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    TankDrive
    +
    +
    +
    +
    public class DriveTrain
    +extends MotorGroup<DTInput>
    +
    Created by MHS Robotics on 12/16/2017.
    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+ +
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setDefaultInput

        +
        public void setDefaultInput()
        +
      • +
      + + + +
        +
      • +

        getEncoderValues

        +
        public int[] getEncoderValues()
        +
      • +
      + + + +
        +
      • +

        getRightEncoderValues

        +
        public int[] getRightEncoderValues()
        +
      • +
      + + + +
        +
      • +

        getLeftEncoderValues

        +
        public int[] getLeftEncoderValues()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/drive/TankDrive.html b/docs/javadoc/org/montclairrobotics/alloy/drive/TankDrive.html new file mode 100644 index 0000000..e51afc2 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/drive/TankDrive.html @@ -0,0 +1,334 @@ + + + + + +TankDrive + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.drive
+

Class TankDrive

+
+
+ +
+
    +
  • +
    +
    +
    public class TankDrive
    +extends DriveTrain
    +
  • +
+
+
+ +
+
+ +
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/drive/TankMapper.html b/docs/javadoc/org/montclairrobotics/alloy/drive/TankMapper.html new file mode 100644 index 0000000..5e44861 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/drive/TankMapper.html @@ -0,0 +1,377 @@ + + + + + +TankMapper + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.drive
+

Class TankMapper

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        TankMapper

        +
        public TankMapper()
        +
      • +
      + + + +
        +
      • +

        TankMapper

        +
        public TankMapper(Vector maxSpeed,
        +                  Angle maxRotation)
        +
      • +
      + + + +
        +
      • +

        TankMapper

        +
        public TankMapper(double maxSpeed,
        +                  double maxRotation)
        +
      • +
      +
    • +
    + + +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/drive/class-use/DTInput.html b/docs/javadoc/org/montclairrobotics/alloy/drive/class-use/DTInput.html new file mode 100644 index 0000000..090eff4 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/drive/class-use/DTInput.html @@ -0,0 +1,195 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.drive.DTInput + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.drive.DTInput

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/drive/class-use/DTMapper.html b/docs/javadoc/org/montclairrobotics/alloy/drive/class-use/DTMapper.html new file mode 100644 index 0000000..434285f --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/drive/class-use/DTMapper.html @@ -0,0 +1,164 @@ + + + + + +Uses of Interface org.montclairrobotics.alloy.drive.DTMapper + + + + + + + + + + + +
+

Uses of Interface
org.montclairrobotics.alloy.drive.DTMapper

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/drive/class-use/DriveModule.html b/docs/javadoc/org/montclairrobotics/alloy/drive/class-use/DriveModule.html new file mode 100644 index 0000000..76847a1 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/drive/class-use/DriveModule.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.drive.DriveModule + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.drive.DriveModule

+
+
No usage of org.montclairrobotics.alloy.drive.DriveModule
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/drive/class-use/DriveTrain.html b/docs/javadoc/org/montclairrobotics/alloy/drive/class-use/DriveTrain.html new file mode 100644 index 0000000..0bc55ec --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/drive/class-use/DriveTrain.html @@ -0,0 +1,216 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.drive.DriveTrain + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.drive.DriveTrain

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/drive/class-use/TankDrive.html b/docs/javadoc/org/montclairrobotics/alloy/drive/class-use/TankDrive.html new file mode 100644 index 0000000..9251619 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/drive/class-use/TankDrive.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.drive.TankDrive + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.drive.TankDrive

+
+
No usage of org.montclairrobotics.alloy.drive.TankDrive
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/drive/class-use/TankMapper.html b/docs/javadoc/org/montclairrobotics/alloy/drive/class-use/TankMapper.html new file mode 100644 index 0000000..1a1bf1c --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/drive/class-use/TankMapper.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.drive.TankMapper + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.drive.TankMapper

+
+
No usage of org.montclairrobotics.alloy.drive.TankMapper
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/drive/package-frame.html b/docs/javadoc/org/montclairrobotics/alloy/drive/package-frame.html new file mode 100644 index 0000000..c36f193 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/drive/package-frame.html @@ -0,0 +1,28 @@ + + + + + +org.montclairrobotics.alloy.drive + + + + + +

org.montclairrobotics.alloy.drive

+
+

Interfaces

+ +

Classes

+ +
+ + diff --git a/docs/javadoc/org/montclairrobotics/alloy/drive/package-summary.html b/docs/javadoc/org/montclairrobotics/alloy/drive/package-summary.html new file mode 100644 index 0000000..4478ad9 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/drive/package-summary.html @@ -0,0 +1,177 @@ + + + + + +org.montclairrobotics.alloy.drive + + + + + + + + + + + +
+

Package org.montclairrobotics.alloy.drive

+
+
+
    +
  • + + + + + + + + + + + + +
    Interface Summary 
    InterfaceDescription
    DTMapper +
    A mapper that specifically takes in DTInputs
    +
    +
  • +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    DriveModule 
    DriveTrain +
    Created by MHS Robotics on 12/16/2017.
    +
    DTInput +
    An input for a drivetrain that takes a rate of translation, and rotation
    +
    TankDrive 
    TankMapper 
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/drive/package-tree.html b/docs/javadoc/org/montclairrobotics/alloy/drive/package-tree.html new file mode 100644 index 0000000..d68a51f --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/drive/package-tree.html @@ -0,0 +1,166 @@ + + + + + +org.montclairrobotics.alloy.drive Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package org.montclairrobotics.alloy.drive

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • org.montclairrobotics.alloy.drive.DTInput
    • +
    • org.montclairrobotics.alloy.utils.Toggleable +
        +
      • org.montclairrobotics.alloy.components.Component +
          +
        • org.montclairrobotics.alloy.motor.MotorGroup<T> +
            +
          • org.montclairrobotics.alloy.drive.DriveTrain +
              +
            • org.montclairrobotics.alloy.drive.TankDrive
            • +
            +
          • +
          +
        • +
        • org.montclairrobotics.alloy.motor.MotorModule + +
        • +
        • org.montclairrobotics.alloy.drive.TankMapper (implements org.montclairrobotics.alloy.drive.DTMapper)
        • +
        +
      • +
      +
    • +
    +
  • +
+

Interface Hierarchy

+
    +
  • org.montclairrobotics.alloy.motor.Mapper<T> +
      +
    • org.montclairrobotics.alloy.drive.DTMapper
    • +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/drive/package-use.html b/docs/javadoc/org/montclairrobotics/alloy/drive/package-use.html new file mode 100644 index 0000000..b5d6bfb --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/drive/package-use.html @@ -0,0 +1,190 @@ + + + + + +Uses of Package org.montclairrobotics.alloy.drive + + + + + + + + + + + +
+

Uses of Package
org.montclairrobotics.alloy.drive

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/exceptions/InvalidConfigurationException.html b/docs/javadoc/org/montclairrobotics/alloy/exceptions/InvalidConfigurationException.html new file mode 100644 index 0000000..169667c --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/exceptions/InvalidConfigurationException.html @@ -0,0 +1,269 @@ + + + + + +InvalidConfigurationException + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.exceptions
+

Class InvalidConfigurationException

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Throwable
    • +
    • +
        +
      • java.lang.Exception
      • +
      • +
          +
        • java.lang.RuntimeException
        • +
        • +
            +
          • org.montclairrobotics.alloy.exceptions.InvalidConfigurationException
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable
    +
    +
    +
    +
    public class InvalidConfigurationException
    +extends java.lang.RuntimeException
    +
    An exception that is thrown when a robot is improperly setup An invalid configuration can be + thrown when:
    + - Global robot properties are accessed before they exist
    + - Motor, or controller ports are improperly specified or accessed
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      +
        +
      • + + +

        Methods inherited from class java.lang.Throwable

        +addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        InvalidConfigurationException

        +
        public InvalidConfigurationException(java.lang.String message)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/exceptions/UpdateException.html b/docs/javadoc/org/montclairrobotics/alloy/exceptions/UpdateException.html new file mode 100644 index 0000000..2f693e3 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/exceptions/UpdateException.html @@ -0,0 +1,266 @@ + + + + + +UpdateException + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.exceptions
+

Class UpdateException

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Throwable
    • +
    • +
        +
      • java.lang.Exception
      • +
      • +
          +
        • java.lang.RuntimeException
        • +
        • +
            +
          • org.montclairrobotics.alloy.exceptions.UpdateException
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable
    +
    +
    +
    +
    public class UpdateException
    +extends java.lang.RuntimeException
    +
    An exception that is thrown when there is problem with the update system
    +
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      UpdateException(java.lang.String message) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      +
        +
      • + + +

        Methods inherited from class java.lang.Throwable

        +addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        UpdateException

        +
        public UpdateException(java.lang.String message)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/exceptions/class-use/InvalidConfigurationException.html b/docs/javadoc/org/montclairrobotics/alloy/exceptions/class-use/InvalidConfigurationException.html new file mode 100644 index 0000000..8eed16d --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/exceptions/class-use/InvalidConfigurationException.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.exceptions.InvalidConfigurationException + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.exceptions.InvalidConfigurationException

+
+
No usage of org.montclairrobotics.alloy.exceptions.InvalidConfigurationException
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/exceptions/class-use/UpdateException.html b/docs/javadoc/org/montclairrobotics/alloy/exceptions/class-use/UpdateException.html new file mode 100644 index 0000000..cbb4a0a --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/exceptions/class-use/UpdateException.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.exceptions.UpdateException + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.exceptions.UpdateException

+
+
No usage of org.montclairrobotics.alloy.exceptions.UpdateException
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/exceptions/package-frame.html b/docs/javadoc/org/montclairrobotics/alloy/exceptions/package-frame.html new file mode 100644 index 0000000..176c9aa --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/exceptions/package-frame.html @@ -0,0 +1,21 @@ + + + + + +org.montclairrobotics.alloy.exceptions + + + + + +

org.montclairrobotics.alloy.exceptions

+ + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/exceptions/package-summary.html b/docs/javadoc/org/montclairrobotics/alloy/exceptions/package-summary.html new file mode 100644 index 0000000..606fa6e --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/exceptions/package-summary.html @@ -0,0 +1,151 @@ + + + + + +org.montclairrobotics.alloy.exceptions + + + + + + + + + + + +
+

Package org.montclairrobotics.alloy.exceptions

+
+
+
    +
  • + + + + + + + + + + + + + + + + +
    Exception Summary 
    ExceptionDescription
    InvalidConfigurationException +
    An exception that is thrown when a robot is improperly setup An invalid configuration can be + thrown when:
    + - Global robot properties are accessed before they exist
    + - Motor, or controller ports are improperly specified or accessed
    +
    UpdateException +
    An exception that is thrown when there is problem with the update system
    +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/exceptions/package-tree.html b/docs/javadoc/org/montclairrobotics/alloy/exceptions/package-tree.html new file mode 100644 index 0000000..5bf04b2 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/exceptions/package-tree.html @@ -0,0 +1,148 @@ + + + + + +org.montclairrobotics.alloy.exceptions Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package org.montclairrobotics.alloy.exceptions

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Throwable (implements java.io.Serializable) + +
    • +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/exceptions/package-use.html b/docs/javadoc/org/montclairrobotics/alloy/exceptions/package-use.html new file mode 100644 index 0000000..19cf78f --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/exceptions/package-use.html @@ -0,0 +1,124 @@ + + + + + +Uses of Package org.montclairrobotics.alloy.exceptions + + + + + + + + + + + +
+

Uses of Package
org.montclairrobotics.alloy.exceptions

+
+
No usage of org.montclairrobotics.alloy.exceptions
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCButton.html b/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCButton.html new file mode 100644 index 0000000..6c74fdb --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCButton.html @@ -0,0 +1,475 @@ + + + + + +FTCButton + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.ftc
+

Class FTCButton

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.ftc.FTCButton
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Button
    +
    +
    +
    +
    public class FTCButton
    +extends java.lang.Object
    +implements Button
    +
    An FTC button provides implementation for a button used in the FTC competition
    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      FTCButton(Input<java.lang.Boolean> buttonInput) +
      Creates a new button using a buttonInput
      +
      FTCButton(Input<java.lang.Boolean> buttonInput, + boolean invert) +
      Creates a new button specifying a button input and an invert
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        FTCButton

        +
        public FTCButton(Input<java.lang.Boolean> buttonInput)
        +
        Creates a new button using a buttonInput
        +
        +
        Parameters:
        +
        buttonInput - an input that returns true if the button is being pressed, and false if + unpressed
        +
        +
      • +
      + + + +
        +
      • +

        FTCButton

        +
        public FTCButton(Input<java.lang.Boolean> buttonInput,
        +                 boolean invert)
        +
        Creates a new button specifying a button input and an invert
        +
        +
        Parameters:
        +
        buttonInput - an input that returns true if the button is being pressed, and false if + unpressed
        +
        invert - if true inverts the value of buttonInput
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getValue

        +
        public boolean getValue()
        +
        Gets the values for a button
        +
        +
        Specified by:
        +
        getValue in interface Button
        +
        Returns:
        +
        the value of the button if inverted is false, or returns the opposite if it is true
        +
        +
      • +
      + + + +
        +
      • +

        getAButton

        +
        public static FTCButton getAButton(com.qualcomm.robotcore.hardware.Gamepad gamepad)
        +
      • +
      + + + +
        +
      • +

        getBButton

        +
        public static FTCButton getBButton(com.qualcomm.robotcore.hardware.Gamepad gamepad)
        +
      • +
      + + + +
        +
      • +

        getXButton

        +
        public static FTCButton getXButton(com.qualcomm.robotcore.hardware.Gamepad gamepad)
        +
      • +
      + + + +
        +
      • +

        getYButton

        +
        public static FTCButton getYButton(com.qualcomm.robotcore.hardware.Gamepad gamepad)
        +
      • +
      + + + +
        +
      • +

        getDPADUp

        +
        public static FTCButton getDPADUp(com.qualcomm.robotcore.hardware.Gamepad gamepad)
        +
      • +
      + + + +
        +
      • +

        getDPADDown

        +
        public static FTCButton getDPADDown(com.qualcomm.robotcore.hardware.Gamepad gamepad)
        +
      • +
      + + + +
        +
      • +

        getYDPADRight

        +
        public static FTCButton getYDPADRight(com.qualcomm.robotcore.hardware.Gamepad gamepad)
        +
      • +
      + + + +
        +
      • +

        getDPADLeft

        +
        public static FTCButton getDPADLeft(com.qualcomm.robotcore.hardware.Gamepad gamepad)
        +
      • +
      + + + +
        +
      • +

        getRightBumper

        +
        public static FTCButton getRightBumper(com.qualcomm.robotcore.hardware.Gamepad gamepad)
        +
      • +
      + + + +
        +
      • +

        getLeftBumper

        +
        public static FTCButton getLeftBumper(com.qualcomm.robotcore.hardware.Gamepad gamepad)
        +
      • +
      + + + +
        +
      • +

        getRightTrigger

        +
        public static FTCButton getRightTrigger(com.qualcomm.robotcore.hardware.Gamepad gamepad)
        +
      • +
      + + + +
        +
      • +

        getLeftTrigger

        +
        public static FTCButton getLeftTrigger(com.qualcomm.robotcore.hardware.Gamepad gamepad)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCDebug.html b/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCDebug.html new file mode 100644 index 0000000..60f869d --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCDebug.html @@ -0,0 +1,322 @@ + + + + + +FTCDebug + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.ftc
+

Class FTCDebug

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.ftc.FTCDebug
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Debug
    +
    +
    +
    +
    public class FTCDebug
    +extends java.lang.Object
    +implements Debug
    +
    Created by MHS Robotics on 11/14/2017. + +

    The FTCDebug class is a basic wrapper around the ftc telemetry framework and allows telemetry + to be used in any class as well as making debugging information easier

    +
    +
    Since:
    +
    0.1
    +
    Author:
    +
    Garrett Burroughs
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      FTCDebug() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidlog(java.lang.String key, + java.lang.Object value) +
      Debugs a value with a Key(Identifier)
      +
      voidmsg(java.lang.Object value) +
      Debugs any value or message(note) to the user with a default key
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        FTCDebug

        +
        public FTCDebug()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        log

        +
        public void log(java.lang.String key,
        +                java.lang.Object value)
        +
        Description copied from interface: Debug
        +
        Debugs a value with a Key(Identifier)
        +
        +
        Specified by:
        +
        log in interface Debug
        +
        Parameters:
        +
        key - Name of the value
        +
        value - Value to be debugged
        +
        +
      • +
      + + + +
        +
      • +

        msg

        +
        public void msg(java.lang.Object value)
        +
        Description copied from interface: Debug
        +
        Debugs any value or message(note) to the user with a default key
        +
        +
        Specified by:
        +
        msg in interface Debug
        +
        Parameters:
        +
        value - Value to be debugged
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCDebugger.html b/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCDebugger.html new file mode 100644 index 0000000..0e73f9e --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCDebugger.html @@ -0,0 +1,344 @@ + + + + + +FTCDebugger + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.ftc
+

Class FTCDebugger

+
+
+ +
+
    +
  • +
    +
    +
    public class FTCDebugger
    +extends Debugger
    +
    implementation of the debugger for the FTC competition
    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + + + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      FTCDebugger() +
      Create a new FTCDebugger, and throw an exception if it has not been initialized
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      org.firstinspires.ftc.robotcore.external.TelemetrygetTelemetry() 
      voidout(java.lang.String key, + java.lang.Object value) +
      The most basic debug that simply outputs information given a key and value
      +
      + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        FTCDebugger

        +
        public FTCDebugger()
        +
        Create a new FTCDebugger, and throw an exception if it has not been initialized
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getTelemetry

        +
        public org.firstinspires.ftc.robotcore.external.Telemetry getTelemetry()
        +
      • +
      + + + +
        +
      • +

        out

        +
        public void out(java.lang.String key,
        +                java.lang.Object value)
        +
        The most basic debug that simply outputs information given a key and value
        +
        +
        Specified by:
        +
        out in class Debugger
        +
        Parameters:
        +
        key - Key of the value being debugged
        +
        value - Value to be debugged
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCJoystick.Side.html b/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCJoystick.Side.html new file mode 100644 index 0000000..7af4e09 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCJoystick.Side.html @@ -0,0 +1,345 @@ + + + + + +FTCJoystick.Side + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.ftc
+

Enum FTCJoystick.Side

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<FTCJoystick.Side>
    • +
    • +
        +
      • org.montclairrobotics.alloy.ftc.FTCJoystick.Side
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<FTCJoystick.Side>
    +
    +
    +
    Enclosing class:
    +
    FTCJoystick
    +
    +
    +
    +
    public static enum FTCJoystick.Side
    +extends java.lang.Enum<FTCJoystick.Side>
    +
    The side in a FTCJoystick is referring to the side of the controller is on, there are 2 + joysticks, one on the right, one on the left
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Summary

      + + + + + + + + + + + +
      Enum Constants 
      Enum Constant and Description
      LEFT 
      RIGHT 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static FTCJoystick.SidevalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static FTCJoystick.Side[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static FTCJoystick.Side[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (FTCJoystick.Side c : FTCJoystick.Side.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static FTCJoystick.Side valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCJoystick.html b/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCJoystick.html new file mode 100644 index 0000000..3fe5fba --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCJoystick.html @@ -0,0 +1,411 @@ + + + + + +FTCJoystick + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.ftc
+

Class FTCJoystick

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Joystick, Input
    +
    +
    +
    +
    public class FTCJoystick
    +extends InputComponent<Vector>
    +implements Joystick
    +
    Implementation of the Joystick class for FTC + +

    There are a total of 4 accessible joysticks when controlling an FTC robot, There are 2 + controllers and each one has 2 joysticks, (One right, one left). A joystick can be defined using + a controller and a side + +

    Joysticks can also be used as inputs that return a vector

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        FTCJoystick

        +
        public FTCJoystick(com.qualcomm.robotcore.hardware.Gamepad gamepad,
        +                   FTCJoystick.Side side)
        +
        Create a new Joystick using the gamepad and side
        +
        +
        Parameters:
        +
        gamepad - The gamepad the joystick is on
        +
        side - The side the joystick is on (Right/Left)
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getValue

        +
        public Vector getValue()
        +
        Gets the position of the joystick as a vector
        +
        +
        Specified by:
        +
        getValue in interface Joystick
        +
        Returns:
        +
        the position of the joystick as a vector
        +
        +
      • +
      + + + +
        +
      • +

        updateControls

        +
        public void updateControls()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCMotor.html b/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCMotor.html new file mode 100644 index 0000000..ba90743 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCMotor.html @@ -0,0 +1,518 @@ + + + + + +FTCMotor + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.ftc
+

Class FTCMotor

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Motor
    +
    +
    +
    Direct Known Subclasses:
    +
    FTCTargetMotor
    +
    +
    +
    +
    public class FTCMotor
    +extends Component
    +implements Motor
    +
    Implementation of a basic motor for the FTC competition + +

    The basic motor for use in FTC. Basic motors are not aware of encoders and are not recommended + for use in FTC as all motors come with encoders

    +
    +
    Since:
    +
    0.1
    +
    See Also:
    +
    FTCTargetMotor
    +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      com.qualcomm.robotcore.hardware.DcMotormotor +
      The physical hardware motor reference to the motor being controlled
      +
      doublepower +
      The power that the motor should be running at
      +
      + + +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      FTCMotor(java.lang.String motorConfiguration) 
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        motor

        +
        public com.qualcomm.robotcore.hardware.DcMotor motor
        +
        The physical hardware motor reference to the motor being controlled
        +
      • +
      + + + +
        +
      • +

        power

        +
        public double power
        +
        The power that the motor should be running at
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        FTCMotor

        +
        public FTCMotor(java.lang.String motorConfiguration)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setMotorPower

        +
        public void setMotorPower(double power)
        +
        Sets the motor Power
        +
        +
        Specified by:
        +
        setMotorPower in interface Motor
        +
        Parameters:
        +
        power - the power that the motor will be set to (0-1 inclusive )
        +
        +
      • +
      + + + +
        +
      • +

        getMotorPower

        +
        public double getMotorPower()
        +
        Gets the motor power
        +
        +
        Specified by:
        +
        getMotorPower in interface Motor
        +
        Returns:
        +
        the current motor power, a value between (0-1)
        +
        +
      • +
      + + + +
        +
      • +

        setInverted

        +
        public void setInverted(boolean inverted)
        +
        Sets whether the motor runs the default way , or inverted
        +
        +
        Specified by:
        +
        setInverted in interface Motor
        +
        Parameters:
        +
        inverted - true for inverted, false for normal
        +
        +
      • +
      + + + +
        +
      • +

        getInverted

        +
        public boolean getInverted()
        +
        Gets weather the motor is inverted
        +
        +
        Specified by:
        +
        getInverted in interface Motor
        +
        Returns:
        +
        true if the motor is inverted
        +
        +
      • +
      + + + +
        +
      • +

        getEncoder

        +
        public Encoder getEncoder()
        +
      • +
      + + + +
        +
      • +

        updateMotor

        +
        public void updateMotor()
        +
      • +
      + + + +
        +
      • +

        disableAction

        +
        public void disableAction()
        +
        Description copied from class: Component
        +
        The action that is taken when the component is disabled, should be overridden by the user
        +
        +
        Overrides:
        +
        disableAction in class Component
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCTargetMotor.html b/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCTargetMotor.html new file mode 100644 index 0000000..06c8d62 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/ftc/FTCTargetMotor.html @@ -0,0 +1,592 @@ + + + + + +FTCTargetMotor + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.ftc
+

Class FTCTargetMotor

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Motor, TargetMotor
    +
    +
    +
    +
    public class FTCTargetMotor
    +extends FTCMotor
    +implements TargetMotor
    +
    Implementation of a target motor for the FTC competition + +

    A target motor is a motor that can use encoders to be set to a certain position Since FTC + motors have their own PIDs that they are controlled with by default, the user has the ability to + override this and use custom PIDs if need be. By default, the user does not have to worry about + any of this. Do not attempt to change the PID if you do not know what you are doing You can read + more about PIDs here https://en.wikipedia.org/wiki/PID_controller

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        FTCTargetMotor

        +
        public FTCTargetMotor(java.lang.String motorConfiguration)
        +
        Creates a new FTC Target motor, using the motor id from the FTC configuration + +

        The configuration must be set on the phone before accessing it in code + +

        A target motor created like this will have the default FTC motor regulation, to set a + custom error correction, you can do this by calling 'setErrorCorrection(ErrorCorrection)' You + should only do this if you know what you are doing

        +
        +
        Parameters:
        +
        motorConfiguration - the name of the motor
        +
        See Also:
        +
        ErrorCorrection
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setPosition

        +
        public void setPosition(int position)
        +
        Sets the motor position
        +
        +
        Specified by:
        +
        setPosition in interface TargetMotor
        +
        Parameters:
        +
        position - the position the motor will be set to (in encoder ticks)
        +
        +
      • +
      + + + +
        +
      • +

        getPosition

        +
        public int getPosition()
        +
        Gets the motors position
        +
        +
        Specified by:
        +
        getPosition in interface TargetMotor
        +
        Returns:
        +
        the position that the motor is at (in encoder ticks)
        +
        +
      • +
      + + + +
        +
      • +

        setTargetPower

        +
        public void setTargetPower(double power)
        +
        Sets the motor Power
        +
        +
        Specified by:
        +
        setTargetPower in interface TargetMotor
        +
        Parameters:
        +
        power - the power that the motor will be set to (0-1 inclusive )
        +
        +
      • +
      + + + +
        +
      • +

        getTargetPower

        +
        public double getTargetPower()
        +
        Gets the motor power
        +
        +
        Specified by:
        +
        getTargetPower in interface TargetMotor
        +
        Returns:
        +
        the current motor power, a value between (0-1)
        +
        +
      • +
      + + + +
        +
      • +

        setErrorCorrection

        +
        public void setErrorCorrection(ErrorCorrection correction)
        +
        Set the motor to run using a custom Error Correction
        +
        +
        Parameters:
        +
        correction - the correction that the motor will be controlled with
        +
        +
      • +
      + + + +
        +
      • +

        disableErrorCorrection

        +
        public void disableErrorCorrection()
        +
        Stop using the custom Error Correction and return to using the default mode
        +
      • +
      + + + +
        +
      • +

        update

        +
        public void update()
        +
        If the mode is custom, then the update method will set the motor power using the custom PID
        +
      • +
      + + + +
        +
      • +

        getErrorCorrection

        +
        public ErrorCorrection<java.lang.Double> getErrorCorrection()
        +
        +
        Returns:
        +
        the Error Correction being used to control the motor
        +
        +
      • +
      + + + +
        +
      • +

        getMotor

        +
        public com.qualcomm.robotcore.hardware.DcMotor getMotor()
        +
        +
        Returns:
        +
        the motor being controlled
        +
        +
      • +
      + + + +
        +
      • +

        getRunmode

        +
        public org.montclairrobotics.alloy.ftc.FTCTargetMotor.Mode getRunmode()
        +
        NOTE: this is not the same as the DCMotor runmode
        +
        +
        Returns:
        +
        the current target motor runmode
        +
        +
      • +
      + + + +
        +
      • +

        getEncoder

        +
        public Encoder getEncoder()
        +
        Allows for the creation of an encoder object that is aware of the amount of ticks the motor + has gone
        +
        +
        Overrides:
        +
        getEncoder in class FTCMotor
        +
        Returns:
        +
        a new encoder object that will return the amount of encoder ticks the motor is at
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCButton.html b/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCButton.html new file mode 100644 index 0000000..2343794 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCButton.html @@ -0,0 +1,208 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.ftc.FTCButton + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.ftc.FTCButton

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCDebug.html b/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCDebug.html new file mode 100644 index 0000000..94b5bd2 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCDebug.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.ftc.FTCDebug + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.ftc.FTCDebug

+
+
No usage of org.montclairrobotics.alloy.ftc.FTCDebug
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCDebugger.html b/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCDebugger.html new file mode 100644 index 0000000..240aba8 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCDebugger.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.ftc.FTCDebugger + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.ftc.FTCDebugger

+
+
No usage of org.montclairrobotics.alloy.ftc.FTCDebugger
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCJoystick.Side.html b/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCJoystick.Side.html new file mode 100644 index 0000000..07efe56 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCJoystick.Side.html @@ -0,0 +1,187 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.ftc.FTCJoystick.Side + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.ftc.FTCJoystick.Side

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCJoystick.html b/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCJoystick.html new file mode 100644 index 0000000..ca4b6ae --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCJoystick.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.ftc.FTCJoystick + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.ftc.FTCJoystick

+
+
No usage of org.montclairrobotics.alloy.ftc.FTCJoystick
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCMotor.html b/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCMotor.html new file mode 100644 index 0000000..f992232 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCMotor.html @@ -0,0 +1,166 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.ftc.FTCMotor + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.ftc.FTCMotor

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCTargetMotor.html b/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCTargetMotor.html new file mode 100644 index 0000000..ad36807 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/ftc/class-use/FTCTargetMotor.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.ftc.FTCTargetMotor + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.ftc.FTCTargetMotor

+
+
No usage of org.montclairrobotics.alloy.ftc.FTCTargetMotor
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/ftc/package-frame.html b/docs/javadoc/org/montclairrobotics/alloy/ftc/package-frame.html new file mode 100644 index 0000000..8e7dcd0 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/ftc/package-frame.html @@ -0,0 +1,28 @@ + + + + + +org.montclairrobotics.alloy.ftc + + + + + +

org.montclairrobotics.alloy.ftc

+ + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/ftc/package-summary.html b/docs/javadoc/org/montclairrobotics/alloy/ftc/package-summary.html new file mode 100644 index 0000000..535144e --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/ftc/package-summary.html @@ -0,0 +1,184 @@ + + + + + +org.montclairrobotics.alloy.ftc + + + + + + + + + + + +
+

Package org.montclairrobotics.alloy.ftc

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    FTCButton +
    An FTC button provides implementation for a button used in the FTC competition
    +
    FTCDebugger +
    implementation of the debugger for the FTC competition
    +
    FTCJoystick +
    Implementation of the Joystick class for FTC
    +
    FTCMotor +
    Implementation of a basic motor for the FTC competition
    +
    FTCTargetMotor +
    Implementation of a target motor for the FTC competition
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    FTCJoystick.Side +
    The side in a FTCJoystick is referring to the side of the controller is on, there are 2 + joysticks, one on the right, one on the left
    +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/ftc/package-tree.html b/docs/javadoc/org/montclairrobotics/alloy/ftc/package-tree.html new file mode 100644 index 0000000..fcec1ee --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/ftc/package-tree.html @@ -0,0 +1,170 @@ + + + + + +org.montclairrobotics.alloy.ftc Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package org.montclairrobotics.alloy.ftc

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • org.montclairrobotics.alloy.core.Debugger + +
    • +
    • org.montclairrobotics.alloy.ftc.FTCButton (implements org.montclairrobotics.alloy.core.Button)
    • +
    • org.montclairrobotics.alloy.utils.Toggleable +
        +
      • org.montclairrobotics.alloy.components.Component +
          +
        • org.montclairrobotics.alloy.ftc.FTCMotor (implements org.montclairrobotics.alloy.core.Motor) + +
        • +
        • org.montclairrobotics.alloy.components.InputComponent<T> (implements org.montclairrobotics.alloy.utils.Input<T>) +
            +
          • org.montclairrobotics.alloy.ftc.FTCJoystick (implements org.montclairrobotics.alloy.core.Joystick)
          • +
          +
        • +
        +
      • +
      +
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/ftc/package-use.html b/docs/javadoc/org/montclairrobotics/alloy/ftc/package-use.html new file mode 100644 index 0000000..6643781 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/ftc/package-use.html @@ -0,0 +1,170 @@ + + + + + +Uses of Package org.montclairrobotics.alloy.ftc + + + + + + + + + + + +
+

Uses of Package
org.montclairrobotics.alloy.ftc

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/DefaultMapper.html b/docs/javadoc/org/montclairrobotics/alloy/motor/DefaultMapper.html new file mode 100644 index 0000000..092305b --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/DefaultMapper.html @@ -0,0 +1,287 @@ + + + + + +DefaultMapper + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.motor
+

Class DefaultMapper

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.motor.DefaultMapper
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Mapper<Input<java.lang.Double>>
    +
    +
    +
    +
    public class DefaultMapper
    +extends java.lang.Object
    +implements Mapper<Input<java.lang.Double>>
    +
    A simple default mapper + +

    This mapper will run all of the motors in the group in the same direction

    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      DefaultMapper() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidmap(Input<java.lang.Double> input, + MotorModule... modules) +
      map the input to the modules
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        DefaultMapper

        +
        public DefaultMapper()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        map

        +
        public void map(Input<java.lang.Double> input,
        +                MotorModule... modules)
        +
        Description copied from interface: Mapper
        +
        map the input to the modules
        +
        +
        Specified by:
        +
        map in interface Mapper<Input<java.lang.Double>>
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/Mapper.html b/docs/javadoc/org/montclairrobotics/alloy/motor/Mapper.html new file mode 100644 index 0000000..752a2c9 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/Mapper.html @@ -0,0 +1,246 @@ + + + + + +Mapper + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.motor
+

Interface Mapper<T>

+
+
+
+
    +
  • +
    +
    Type Parameters:
    +
    T - the type of input the mapper takes in
    +
    +
    +
    All Known Subinterfaces:
    +
    DTMapper
    +
    +
    +
    All Known Implementing Classes:
    +
    DefaultMapper, IntakeMapper, TankMapper
    +
    +
    +
    +
    public interface Mapper<T>
    +
    A mapper takes an input, and maps it to the set of motor modules + +

    For example, a tank drive mapper might map a 2D vector to the drive modules by calculating the + rotation, and the power based on the x&y components of the vector

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        map

        +
        void map(T input,
        +         MotorModule... modules)
        +
        map the input to the modules
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/MotorGroup.html b/docs/javadoc/org/montclairrobotics/alloy/motor/MotorGroup.html new file mode 100644 index 0000000..c4e6858 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/MotorGroup.html @@ -0,0 +1,434 @@ + + + + + +MotorGroup + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.motor
+

Class MotorGroup<T>

+
+
+ +
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    DriveTrain
    +
    +
    +
    +
    public class MotorGroup<T>
    +extends Component
    +
    A motor group is a group of motor modules that run together + +

    A motor group should control any collection of motors that take an input, and then maps the + output to a set of motors that run together. For example in a lift mechanism there may be 2 motor + that both run in the same direction but one should be inverted to lift the lift up. The modules + would define what direction the motors are running in the mapper would define that they need to + run in opposite directions and the MotorGroup would run the motors together fully operating the + lift. This could work with other things like an intake, shooter or other manipulator that + requires multiple motors running together from one input

    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + + + + + +
        +
      • +

        MotorGroup

        +
        public MotorGroup(Input<java.lang.Double> input,
        +                  MotorModule... modules)
        +
        Creates a motor group with a default mapper that simply
        +
        +
        Parameters:
        +
        input -
        +
        modules -
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        controlPower

        +
        public void controlPower()
        +
      • +
      + + + +
        +
      • +

        getMapper

        +
        public Mapper getMapper()
        +
      • +
      + + + +
        +
      • +

        setMapper

        +
        public void setMapper(Mapper mapper)
        +
      • +
      + + + +
        +
      • +

        getInput

        +
        public Input<T> getInput()
        +
      • +
      + + + +
        +
      • +

        setInput

        +
        public void setInput(Input<T> input)
        +
      • +
      + + + +
        +
      • +

        getModules

        +
        public java.util.ArrayList<MotorModule> getModules()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/MotorModule.html b/docs/javadoc/org/montclairrobotics/alloy/motor/MotorModule.html new file mode 100644 index 0000000..aa38493 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/MotorModule.html @@ -0,0 +1,695 @@ + + + + + +MotorModule + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.motor
+

Class MotorModule

+
+
+ +
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    DriveModule
    +
    +
    +
    +
    public class MotorModule
    +extends Component
    +
    Highly Functional set of motors that run together + +

    A motor module consists of multiple motors that run together in the same direction. Modules + are aware of what direction the run in so they can be used in MoroGroups to be run together with + other modules. Modules can also be controlled with an encoder and a ErrorCorrection to ensure + that the are going the right speed. + +

    You can also add steps to the Module that can alter the amount of power that the module will + receive. This can be useful for modules that are being controlled by a separate entity such as a + motor group.

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MotorModule

        +
        public MotorModule(Vector direction,
        +                   Encoder encoder,
        +                   ErrorCorrection<java.lang.Double> powerControl,
        +                   Motor... motors)
        +
        Create a fully functioning motor module + +

        Modules created like this will be able to adjust their speed based on an error correction + to maintain a more accurate speed.

        +
        +
        Parameters:
        +
        direction - the direction that the module runs (for use in motor groups)
        +
        encoder - the encoder that keeps track of the motors position
        +
        powerControl - an error correction to adjust the speed of the module
        +
        motors - the motors that the module controls
        +
        +
      • +
      + + + +
        +
      • +

        MotorModule

        +
        public MotorModule(Vector direction,
        +                   Motor... motors)
        +
        Create motor module without the use of an encoder + +

        Modules created like this will not be abe to monitor or adjust their speed to maintain a + constant and more exact speed.

        +
        +
        Parameters:
        +
        direction - what direction the module runs
        +
        motors - the motors the module controls
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setEncoder

        +
        public MotorModule setEncoder(Encoder encoder)
        +
        Set an encoder for the module
        +
        +
        Parameters:
        +
        encoder - the encoder that keeps track of the position of the module
        +
        +
      • +
      + + + +
        +
      • +

        setErrorCorrection

        +
        public MotorModule setErrorCorrection(ErrorCorrection powerControl)
        +
        set the power control for the module
        +
        +
        Parameters:
        +
        powerControl - an error correction to adjust the speed of the module
        +
        +
      • +
      + + + + + + + +
        +
      • +

        powerCorrection

        +
        public void powerCorrection()
        +
      • +
      + + + +
        +
      • +

        setPower

        +
        public void setPower(double power)
        +
        Set the target power of the module
        +
        +
        Parameters:
        +
        power - how fast the module will go (-1 to 1)
        +
        +
      • +
      + + + +
        +
      • +

        setMovementSpeed

        +
        public void setMovementSpeed(double speed)
        +
      • +
      + + + +
        +
      • +

        setTargetPosition

        +
        public void setTargetPosition(double targetPosition)
        +
      • +
      + + + + + + + + + + + +
        +
      • +

        disableAction

        +
        public void disableAction()
        +
        Method to be called when the toggleable is disabled
        +
        +
        Overrides:
        +
        disableAction in class Component
        +
        +
      • +
      + + + +
        +
      • +

        getMotors

        +
        public java.util.ArrayList<Motor> getMotors()
        +
        +
        Returns:
        +
        the motor arraylist in the module
        +
        +
      • +
      + + + +
        +
      • +

        getDirection

        +
        public Vector getDirection()
        +
        +
        Returns:
        +
        the direction the module runs in
        +
        +
      • +
      + + + +
        +
      • +

        getPowerControl

        +
        public ErrorCorrection<java.lang.Double> getPowerControl()
        +
        +
        Returns:
        +
        the error correction used for the module
        +
        +
      • +
      + + + +
        +
      • +

        getEncoder

        +
        public Encoder getEncoder()
        +
        +
        Returns:
        +
        the encoder that monitors the position of the monitor
        +
        +
      • +
      + + + +
        +
      • +

        getTargetPower

        +
        public double getTargetPower()
        +
        +
        Returns:
        +
        the current target power of the module
        +
        +
      • +
      + + + +
        +
      • +

        getModifier

        +
        public InputComponent<java.lang.Double> getModifier()
        +
        +
        Returns:
        +
        the power modifier of the motor
        +
        +
      • +
      + + + +
        +
      • +

        getOffset

        +
        public Vector getOffset()
        +
        +
        Returns:
        +
        the relative position to the center of the motor group
        +
        +
      • +
      + + + +
        +
      • +

        atTargetPosition

        +
        public boolean atTargetPosition(double tolerance)
        +
      • +
      + + + +
        +
      • +

        toPosition

        +
        public void toPosition()
        +
      • +
      + + + +
        +
      • +

        usingPower

        +
        public void usingPower()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/class-use/DefaultMapper.html b/docs/javadoc/org/montclairrobotics/alloy/motor/class-use/DefaultMapper.html new file mode 100644 index 0000000..37f0ec1 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/class-use/DefaultMapper.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.motor.DefaultMapper + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.motor.DefaultMapper

+
+
No usage of org.montclairrobotics.alloy.motor.DefaultMapper
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/class-use/Mapper.html b/docs/javadoc/org/montclairrobotics/alloy/motor/class-use/Mapper.html new file mode 100644 index 0000000..db61425 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/class-use/Mapper.html @@ -0,0 +1,279 @@ + + + + + +Uses of Interface org.montclairrobotics.alloy.motor.Mapper + + + + + + + + + + + +
+

Uses of Interface
org.montclairrobotics.alloy.motor.Mapper

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/class-use/MotorGroup.html b/docs/javadoc/org/montclairrobotics/alloy/motor/class-use/MotorGroup.html new file mode 100644 index 0000000..459c0dc --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/class-use/MotorGroup.html @@ -0,0 +1,170 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.motor.MotorGroup + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.motor.MotorGroup

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/class-use/MotorModule.html b/docs/javadoc/org/montclairrobotics/alloy/motor/class-use/MotorModule.html new file mode 100644 index 0000000..fbf9e15 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/class-use/MotorModule.html @@ -0,0 +1,311 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.motor.MotorModule + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.motor.MotorModule

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/package-frame.html b/docs/javadoc/org/montclairrobotics/alloy/motor/package-frame.html new file mode 100644 index 0000000..b88920a --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/package-frame.html @@ -0,0 +1,26 @@ + + + + + +org.montclairrobotics.alloy.motor + + + + + +

org.montclairrobotics.alloy.motor

+
+

Interfaces

+ +

Classes

+ +
+ + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/package-summary.html b/docs/javadoc/org/montclairrobotics/alloy/motor/package-summary.html new file mode 100644 index 0000000..fd068f1 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/package-summary.html @@ -0,0 +1,171 @@ + + + + + +org.montclairrobotics.alloy.motor + + + + + + + + + + + +
+

Package org.montclairrobotics.alloy.motor

+
+
+
    +
  • + + + + + + + + + + + + +
    Interface Summary 
    InterfaceDescription
    Mapper<T> +
    A mapper takes an input, and maps it to the set of motor modules
    +
    +
  • +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    DefaultMapper +
    A simple default mapper
    +
    MotorGroup<T> +
    A motor group is a group of motor modules that run together
    +
    MotorModule +
    Highly Functional set of motors that run together
    +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/package-tree.html b/docs/javadoc/org/montclairrobotics/alloy/motor/package-tree.html new file mode 100644 index 0000000..f9773ef --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/package-tree.html @@ -0,0 +1,149 @@ + + + + + +org.montclairrobotics.alloy.motor Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package org.montclairrobotics.alloy.motor

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • org.montclairrobotics.alloy.motor.DefaultMapper (implements org.montclairrobotics.alloy.motor.Mapper<T>)
    • +
    • org.montclairrobotics.alloy.utils.Toggleable +
        +
      • org.montclairrobotics.alloy.components.Component + +
      • +
      +
    • +
    +
  • +
+

Interface Hierarchy

+
    +
  • org.montclairrobotics.alloy.motor.Mapper<T>
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/package-use.html b/docs/javadoc/org/montclairrobotics/alloy/motor/package-use.html new file mode 100644 index 0000000..e07fa4b --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/package-use.html @@ -0,0 +1,221 @@ + + + + + +Uses of Package org.montclairrobotics.alloy.motor + + + + + + + + + + + +
+

Uses of Package
org.montclairrobotics.alloy.motor

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/steps/Deadzone.html b/docs/javadoc/org/montclairrobotics/alloy/motor/steps/Deadzone.html new file mode 100644 index 0000000..f9deceb --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/steps/Deadzone.html @@ -0,0 +1,292 @@ + + + + + +Deadzone + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.motor.steps
+

Class Deadzone

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.motor.steps.Deadzone
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Step<java.lang.Double>
    +
    +
    +
    +
    public class Deadzone
    +extends java.lang.Object
    +implements Step<java.lang.Double>
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Deadzone() 
      Deadzone(double tolerance) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      java.lang.DoublegetOutput(java.lang.Double input) 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Deadzone

        +
        public Deadzone(double tolerance)
        +
      • +
      + + + +
        +
      • +

        Deadzone

        +
        public Deadzone()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getOutput

        +
        public java.lang.Double getOutput(java.lang.Double input)
        +
        +
        Specified by:
        +
        getOutput in interface Step<java.lang.Double>
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/steps/VectorDeadzone.html b/docs/javadoc/org/montclairrobotics/alloy/motor/steps/VectorDeadzone.html new file mode 100644 index 0000000..acdcb50 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/steps/VectorDeadzone.html @@ -0,0 +1,280 @@ + + + + + +VectorDeadzone + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.motor.steps
+

Class VectorDeadzone

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.motor.steps.VectorDeadzone
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Step<Vector>
    +
    +
    +
    +
    public class VectorDeadzone
    +extends java.lang.Object
    +implements Step<Vector>
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      VectorDeadzone(double tolerance) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      VectorgetOutput(Vector input) 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        VectorDeadzone

        +
        public VectorDeadzone(double tolerance)
        +
      • +
      +
    • +
    + + +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/steps/class-use/Deadzone.html b/docs/javadoc/org/montclairrobotics/alloy/motor/steps/class-use/Deadzone.html new file mode 100644 index 0000000..261c9a5 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/steps/class-use/Deadzone.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.motor.steps.Deadzone + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.motor.steps.Deadzone

+
+
No usage of org.montclairrobotics.alloy.motor.steps.Deadzone
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/steps/class-use/VectorDeadzone.html b/docs/javadoc/org/montclairrobotics/alloy/motor/steps/class-use/VectorDeadzone.html new file mode 100644 index 0000000..ca51d63 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/steps/class-use/VectorDeadzone.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.motor.steps.VectorDeadzone + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.motor.steps.VectorDeadzone

+
+
No usage of org.montclairrobotics.alloy.motor.steps.VectorDeadzone
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/steps/package-frame.html b/docs/javadoc/org/montclairrobotics/alloy/motor/steps/package-frame.html new file mode 100644 index 0000000..b611263 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/steps/package-frame.html @@ -0,0 +1,21 @@ + + + + + +org.montclairrobotics.alloy.motor.steps + + + + + +

org.montclairrobotics.alloy.motor.steps

+
+

Classes

+ +
+ + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/steps/package-summary.html b/docs/javadoc/org/montclairrobotics/alloy/motor/steps/package-summary.html new file mode 100644 index 0000000..d646dea --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/steps/package-summary.html @@ -0,0 +1,146 @@ + + + + + +org.montclairrobotics.alloy.motor.steps + + + + + + + + + + + +
+

Package org.montclairrobotics.alloy.motor.steps

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/steps/package-tree.html b/docs/javadoc/org/montclairrobotics/alloy/motor/steps/package-tree.html new file mode 100644 index 0000000..fde0519 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/steps/package-tree.html @@ -0,0 +1,138 @@ + + + + + +org.montclairrobotics.alloy.motor.steps Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package org.montclairrobotics.alloy.motor.steps

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • org.montclairrobotics.alloy.motor.steps.Deadzone (implements org.montclairrobotics.alloy.components.Step<T>)
    • +
    • org.montclairrobotics.alloy.motor.steps.VectorDeadzone (implements org.montclairrobotics.alloy.components.Step<T>)
    • +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/motor/steps/package-use.html b/docs/javadoc/org/montclairrobotics/alloy/motor/steps/package-use.html new file mode 100644 index 0000000..90cdc2b --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/motor/steps/package-use.html @@ -0,0 +1,124 @@ + + + + + +Uses of Package org.montclairrobotics.alloy.motor.steps + + + + + + + + + + + +
+

Uses of Package
org.montclairrobotics.alloy.motor.steps

+
+
No usage of org.montclairrobotics.alloy.motor.steps
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/steps/Deadzone.html b/docs/javadoc/org/montclairrobotics/alloy/steps/Deadzone.html new file mode 100644 index 0000000..197a5a7 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/steps/Deadzone.html @@ -0,0 +1,422 @@ + + + + + +Deadzone + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.steps
+

Class Deadzone

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Step<java.lang.Double>
    +
    +
    +
    +
    public class Deadzone
    +extends Toggleable
    +implements Step<java.lang.Double>
    +
    A step that returns 0 if the input is under a certain threshold
    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + + + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Deadzone() +
      Create a deadzone with a default tolerance of 0.05
      +
      Deadzone(double tolerance) +
      Create a deadzone specifying the tolerance
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddisableAction() +
      Method to be called when the toggleable is disabled
      +
      voidenableAction() +
      Method to be called when the toggleable is enabled
      +
      java.lang.DoublegetOutput(java.lang.Double input) +
      The operation to be performed on the input, to get the output
      +
      doublegetTolerance() 
      voidsetTolerance(int tolerance) +
      set the threshold value
      +
      + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Deadzone

        +
        public Deadzone(double tolerance)
        +
        Create a deadzone specifying the tolerance
        +
      • +
      + + + +
        +
      • +

        Deadzone

        +
        public Deadzone()
        +
        Create a deadzone with a default tolerance of 0.05
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getOutput

        +
        public java.lang.Double getOutput(java.lang.Double input)
        +
        Description copied from interface: Step
        +
        The operation to be performed on the input, to get the output
        +
        +
        Specified by:
        +
        getOutput in interface Step<java.lang.Double>
        +
        +
      • +
      + + + +
        +
      • +

        enableAction

        +
        public void enableAction()
        +
        Description copied from class: Toggleable
        +
        Method to be called when the toggleable is enabled
        +
        +
        Specified by:
        +
        enableAction in class Toggleable
        +
        +
      • +
      + + + +
        +
      • +

        disableAction

        +
        public void disableAction()
        +
        Description copied from class: Toggleable
        +
        Method to be called when the toggleable is disabled
        +
        +
        Specified by:
        +
        disableAction in class Toggleable
        +
        +
      • +
      + + + +
        +
      • +

        getTolerance

        +
        public double getTolerance()
        +
        +
        Returns:
        +
        the threshold value
        +
        +
      • +
      + + + +
        +
      • +

        setTolerance

        +
        public void setTolerance(int tolerance)
        +
        set the threshold value
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/steps/VectorDeadzone.html b/docs/javadoc/org/montclairrobotics/alloy/steps/VectorDeadzone.html new file mode 100644 index 0000000..89139c1 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/steps/VectorDeadzone.html @@ -0,0 +1,422 @@ + + + + + +VectorDeadzone + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.steps
+

Class VectorDeadzone

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Step<Vector>
    +
    +
    +
    +
    public class VectorDeadzone
    +extends Toggleable
    +implements Step<Vector>
    +
    A step that returns 0 if the inputs magnitude is under a certain threshold
    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + + + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      VectorDeadzone() +
      Create a VectorDeadzone with a default tolerance of 0.05
      +
      VectorDeadzone(double tolerance) +
      Create a VectorDeadzone specifying the tolerance
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddisableAction() +
      Method to be called when the toggleable is disabled
      +
      voidenableAction() +
      Method to be called when the toggleable is enabled
      +
      VectorgetOutput(Vector input) +
      The operation to be performed on the input, to get the output
      +
      doublegetTolerance() 
      voidsetTolerance(double tolerance) +
      set the threshold value
      +
      + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        VectorDeadzone

        +
        public VectorDeadzone(double tolerance)
        +
        Create a VectorDeadzone specifying the tolerance
        +
      • +
      + + + +
        +
      • +

        VectorDeadzone

        +
        public VectorDeadzone()
        +
        Create a VectorDeadzone with a default tolerance of 0.05
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getOutput

        +
        public Vector getOutput(Vector input)
        +
        Description copied from interface: Step
        +
        The operation to be performed on the input, to get the output
        +
        +
        Specified by:
        +
        getOutput in interface Step<Vector>
        +
        +
      • +
      + + + +
        +
      • +

        enableAction

        +
        public void enableAction()
        +
        Description copied from class: Toggleable
        +
        Method to be called when the toggleable is enabled
        +
        +
        Specified by:
        +
        enableAction in class Toggleable
        +
        +
      • +
      + + + +
        +
      • +

        disableAction

        +
        public void disableAction()
        +
        Description copied from class: Toggleable
        +
        Method to be called when the toggleable is disabled
        +
        +
        Specified by:
        +
        disableAction in class Toggleable
        +
        +
      • +
      + + + +
        +
      • +

        getTolerance

        +
        public double getTolerance()
        +
        +
        Returns:
        +
        the threshold value
        +
        +
      • +
      + + + +
        +
      • +

        setTolerance

        +
        public void setTolerance(double tolerance)
        +
        set the threshold value
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/steps/class-use/Deadzone.html b/docs/javadoc/org/montclairrobotics/alloy/steps/class-use/Deadzone.html new file mode 100644 index 0000000..780a8bb --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/steps/class-use/Deadzone.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.steps.Deadzone + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.steps.Deadzone

+
+
No usage of org.montclairrobotics.alloy.steps.Deadzone
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/steps/class-use/VectorDeadzone.html b/docs/javadoc/org/montclairrobotics/alloy/steps/class-use/VectorDeadzone.html new file mode 100644 index 0000000..333f5bf --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/steps/class-use/VectorDeadzone.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.steps.VectorDeadzone + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.steps.VectorDeadzone

+
+
No usage of org.montclairrobotics.alloy.steps.VectorDeadzone
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/steps/package-frame.html b/docs/javadoc/org/montclairrobotics/alloy/steps/package-frame.html new file mode 100644 index 0000000..83afc14 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/steps/package-frame.html @@ -0,0 +1,21 @@ + + + + + +org.montclairrobotics.alloy.steps + + + + + +

org.montclairrobotics.alloy.steps

+
+

Classes

+ +
+ + diff --git a/docs/javadoc/org/montclairrobotics/alloy/steps/package-summary.html b/docs/javadoc/org/montclairrobotics/alloy/steps/package-summary.html new file mode 100644 index 0000000..80cba11 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/steps/package-summary.html @@ -0,0 +1,148 @@ + + + + + +org.montclairrobotics.alloy.steps + + + + + + + + + + + +
+

Package org.montclairrobotics.alloy.steps

+
+
+
    +
  • + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Deadzone +
    A step that returns 0 if the input is under a certain threshold
    +
    VectorDeadzone +
    A step that returns 0 if the inputs magnitude is under a certain threshold
    +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/steps/package-tree.html b/docs/javadoc/org/montclairrobotics/alloy/steps/package-tree.html new file mode 100644 index 0000000..baafe2d --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/steps/package-tree.html @@ -0,0 +1,140 @@ + + + + + +org.montclairrobotics.alloy.steps Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package org.montclairrobotics.alloy.steps

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • org.montclairrobotics.alloy.utils.Toggleable +
        +
      • org.montclairrobotics.alloy.steps.Deadzone (implements org.montclairrobotics.alloy.components.Step<T>)
      • +
      • org.montclairrobotics.alloy.steps.VectorDeadzone (implements org.montclairrobotics.alloy.components.Step<T>)
      • +
      +
    • +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/steps/package-use.html b/docs/javadoc/org/montclairrobotics/alloy/steps/package-use.html new file mode 100644 index 0000000..bca6a68 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/steps/package-use.html @@ -0,0 +1,124 @@ + + + + + +Uses of Package org.montclairrobotics.alloy.steps + + + + + + + + + + + +
+

Uses of Package
org.montclairrobotics.alloy.steps

+
+
No usage of org.montclairrobotics.alloy.steps
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/test/Control.html b/docs/javadoc/org/montclairrobotics/alloy/test/Control.html new file mode 100644 index 0000000..1e21a38 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/test/Control.html @@ -0,0 +1,237 @@ + + + + + +Control + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.test
+

Class Control

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.test.Control
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Control
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Control() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Control

        +
        public Control()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/test/Hardware.html b/docs/javadoc/org/montclairrobotics/alloy/test/Hardware.html new file mode 100644 index 0000000..27ee8de --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/test/Hardware.html @@ -0,0 +1,284 @@ + + + + + +Hardware + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.test
+

Class Hardware

+
+
+ +
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Hardware() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidinit() +
      the method that is called at the beginning of the teleop mode
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Hardware

        +
        public Hardware()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        init

        +
        public void init()
        +
        Description copied from class: Initializeable
        +
        the method that is called at the beginning of the teleop mode
        +
        +
        Specified by:
        +
        init in class Initializeable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/test/IntakeMapper.html b/docs/javadoc/org/montclairrobotics/alloy/test/IntakeMapper.html new file mode 100644 index 0000000..047d3b5 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/test/IntakeMapper.html @@ -0,0 +1,284 @@ + + + + + +IntakeMapper + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.test
+

Class IntakeMapper

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.test.IntakeMapper
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Mapper<Vector>
    +
    +
    +
    +
    public class IntakeMapper
    +extends java.lang.Object
    +implements Mapper<Vector>
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      IntakeMapper() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidmap(Vector input, + MotorModule... modules) +
      map the input to the modules
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IntakeMapper

        +
        public IntakeMapper()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        map

        +
        public void map(Vector input,
        +                MotorModule... modules)
        +
        Description copied from interface: Mapper
        +
        map the input to the modules
        +
        +
        Specified by:
        +
        map in interface Mapper<Vector>
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/test/Shooter.html b/docs/javadoc/org/montclairrobotics/alloy/test/Shooter.html new file mode 100644 index 0000000..80025ab --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/test/Shooter.html @@ -0,0 +1,312 @@ + + + + + +Shooter + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.test
+

Class Shooter

+
+
+ +
+
    +
  • +
    +
    +
    public class Shooter
    +extends Toggleable
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Shooter() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddisableAction() +
      Method to be called when the toggleable is disabled
      +
      voidenableAction() +
      Method to be called when the toggleable is enabled
      +
      + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Shooter

        +
        public Shooter()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        enableAction

        +
        public void enableAction()
        +
        Description copied from class: Toggleable
        +
        Method to be called when the toggleable is enabled
        +
        +
        Specified by:
        +
        enableAction in class Toggleable
        +
        +
      • +
      + + + +
        +
      • +

        disableAction

        +
        public void disableAction()
        +
        Description copied from class: Toggleable
        +
        Method to be called when the toggleable is disabled
        +
        +
        Specified by:
        +
        disableAction in class Toggleable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/test/ShooterMapper.html b/docs/javadoc/org/montclairrobotics/alloy/test/ShooterMapper.html new file mode 100644 index 0000000..6d1913d --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/test/ShooterMapper.html @@ -0,0 +1,286 @@ + + + + + +ShooterMapper + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.test
+

Class ShooterMapper

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.test.IntakeMapper
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Mapper<Vector>
    +
    +
    +
    +
    public class ShooterMapper
    +extends java.lang.Object
    +implements Mapper<Vector>
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ShooterMapper() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidmap(Vector input, + MotorModule... modules) +
      map the input to the modules
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ShooterMapper

        +
        public ShooterMapper()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        map

        +
        public void map(Vector input,
        +                MotorModule... modules)
        +
        Description copied from interface: Mapper
        +
        map the input to the modules
        +
        +
        Specified by:
        +
        map in interface Mapper<Vector>
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/test/SquareAuto.html b/docs/javadoc/org/montclairrobotics/alloy/test/SquareAuto.html new file mode 100644 index 0000000..c4c7f69 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/test/SquareAuto.html @@ -0,0 +1,335 @@ + + + + + +SquareAuto + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.test
+

Class SquareAuto

+
+
+ +
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + +
        +
      • + + +

        Fields inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode

        +gamepad1, gamepad2, hardwareMap, internalOpModeServices, msStuckDetectInit, msStuckDetectInitLoop, msStuckDetectLoop, msStuckDetectStart, msStuckDetectStop, telemetry, time
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SquareAuto() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidsetup() +
      This is where the user should define all their code and where "Auto", should be instantiated
      +
      + + +
        +
      • + + +

        Methods inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode

        +getRuntime, init_loop, internalPostInitLoop, internalPostLoop, internalPreInit, internalUpdateTelemetryNow, requestOpModeStop, resetStartTime, stop, updateTelemetry
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SquareAuto

        +
        public SquareAuto()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setup

        +
        public void setup()
        +
        Description copied from class: AlloyAutonomous
        +
        This is where the user should define all their code and where "Auto", should be instantiated
        +
        +
        Overrides:
        +
        setup in class SimpleAutonomous
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/test/TestRobot.html b/docs/javadoc/org/montclairrobotics/alloy/test/TestRobot.html new file mode 100644 index 0000000..8beed5f --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/test/TestRobot.html @@ -0,0 +1,374 @@ + + + + + +TestRobot + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.test
+

Class TestRobot

+
+
+ +
+
    +
  • +
    +
    +
    @TeleOp
    +public class TestRobot
    +extends Alloy
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + +
        +
      • + + +

        Fields inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode

        +gamepad1, gamepad2, hardwareMap, internalOpModeServices, msStuckDetectInit, msStuckDetectInitLoop, msStuckDetectLoop, msStuckDetectStart, msStuckDetectStop, telemetry, time
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      TestRobot() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidinitialization() +
      The initialization method is were everything specific to the OpMode Should be set up.
      +
      voidperiodic() +
      Although most of the periodic actions are taken care by the updater, the user may want to add + their own methods and code that need to be updated or run periodically, this can be done in + the periodic() method periodic will be run every loop.
      +
      voidrobotSetup() +
      The robotSetup is where all code specific to robot setup is placed If you only have one + teleop this can be done in the initialization Method.
      +
      + +
        +
      • + + +

        Methods inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode

        +getRuntime, init_loop, internalPostInitLoop, internalPostLoop, internalPreInit, internalUpdateTelemetryNow, requestOpModeStop, resetStartTime, start, stop, updateTelemetry
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        TestRobot

        +
        public TestRobot()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        robotSetup

        +
        public void robotSetup()
        +
        Description copied from class: Alloy
        +
        The robotSetup is where all code specific to robot setup is placed If you only have one + teleop this can be done in the initialization Method. robotSetup is called right after the + robot core is initialized
        +
        +
        Specified by:
        +
        robotSetup in class Alloy
        +
        +
      • +
      + + + +
        +
      • +

        initialization

        +
        public void initialization()
        +
        Description copied from class: Alloy
        +
        The initialization method is were everything specific to the OpMode Should be set up. + Initialization will be the first thing called after The robot setup.
        +
        +
        Specified by:
        +
        initialization in class Alloy
        +
        +
      • +
      + + + +
        +
      • +

        periodic

        +
        public void periodic()
        +
        Description copied from class: Alloy
        +
        Although most of the periodic actions are taken care by the updater, the user may want to add + their own methods and code that need to be updated or run periodically, this can be done in + the periodic() method periodic will be run every loop.
        +
        +
        Specified by:
        +
        periodic in class Alloy
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/test/class-use/Control.html b/docs/javadoc/org/montclairrobotics/alloy/test/class-use/Control.html new file mode 100644 index 0000000..ca868f6 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/test/class-use/Control.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.test.Control + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.test.Control

+
+
No usage of org.montclairrobotics.alloy.test.Control
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/test/class-use/Hardware.html b/docs/javadoc/org/montclairrobotics/alloy/test/class-use/Hardware.html new file mode 100644 index 0000000..ba3e11a --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/test/class-use/Hardware.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.test.Hardware + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.test.Hardware

+
+
No usage of org.montclairrobotics.alloy.test.Hardware
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/test/class-use/IntakeMapper.html b/docs/javadoc/org/montclairrobotics/alloy/test/class-use/IntakeMapper.html new file mode 100644 index 0000000..9f8710d --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/test/class-use/IntakeMapper.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.test.IntakeMapper + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.test.IntakeMapper

+
+
No usage of org.montclairrobotics.alloy.test.IntakeMapper
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/test/class-use/Shooter.html b/docs/javadoc/org/montclairrobotics/alloy/test/class-use/Shooter.html new file mode 100644 index 0000000..3d6d004 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/test/class-use/Shooter.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.test.Shooter + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.test.Shooter

+
+
No usage of org.montclairrobotics.alloy.test.Shooter
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/test/class-use/ShooterMapper.html b/docs/javadoc/org/montclairrobotics/alloy/test/class-use/ShooterMapper.html new file mode 100644 index 0000000..dd742f8 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/test/class-use/ShooterMapper.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.test.IntakeMapper + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.test.IntakeMapper

+
+
No usage of org.montclairrobotics.alloy.test.IntakeMapper
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/test/class-use/TestRobot.html b/docs/javadoc/org/montclairrobotics/alloy/test/class-use/TestRobot.html new file mode 100644 index 0000000..06675c2 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/test/class-use/TestRobot.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.test.TestRobot + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.test.TestRobot

+
+
No usage of org.montclairrobotics.alloy.test.TestRobot
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/test/package-frame.html b/docs/javadoc/org/montclairrobotics/alloy/test/package-frame.html new file mode 100644 index 0000000..a27b8b0 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/test/package-frame.html @@ -0,0 +1,22 @@ + + + + + +org.montclairrobotics.alloy.test + + + + + +

org.montclairrobotics.alloy.test

+
+

Classes

+ +
+ + diff --git a/docs/javadoc/org/montclairrobotics/alloy/test/package-summary.html b/docs/javadoc/org/montclairrobotics/alloy/test/package-summary.html new file mode 100644 index 0000000..d12ff11 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/test/package-summary.html @@ -0,0 +1,148 @@ + + + + + +org.montclairrobotics.alloy.test + + + + + + + + + + + +
+

Package org.montclairrobotics.alloy.test

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/test/package-tree.html b/docs/javadoc/org/montclairrobotics/alloy/test/package-tree.html new file mode 100644 index 0000000..12d08f1 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/test/package-tree.html @@ -0,0 +1,153 @@ + + + + + +org.montclairrobotics.alloy.test Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package org.montclairrobotics.alloy.test

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • org.montclairrobotics.alloy.test.IntakeMapper (implements org.montclairrobotics.alloy.motor.Mapper<T>)
    • +
    • com.qualcomm.robotcore.eventloop.opmode.OpMode + +
    • +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/test/package-use.html b/docs/javadoc/org/montclairrobotics/alloy/test/package-use.html new file mode 100644 index 0000000..bb8ed72 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/test/package-use.html @@ -0,0 +1,124 @@ + + + + + +Uses of Package org.montclairrobotics.alloy.test + + + + + + + + + + + +
+

Uses of Package
org.montclairrobotics.alloy.test

+
+
No usage of org.montclairrobotics.alloy.test
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/update/Updatable.html b/docs/javadoc/org/montclairrobotics/alloy/update/Updatable.html new file mode 100644 index 0000000..3a7449b --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/update/Updatable.html @@ -0,0 +1,257 @@ + + + + + +Updatable + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.update
+

Class Updatable

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.update.Updatable
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Updatable
    +extends java.lang.Object
    +
    Created by MHS Robotics on 2/11/2018.
    +
    +
    Since:
    +
    0.1
    +
    Author:
    +
    Garrett Burroughs
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      intgetUpdateRate() 
      voidrun() 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        run

        +
        public void run()
        +
      • +
      + + + +
        +
      • +

        getUpdateRate

        +
        public int getUpdateRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/update/Update.html b/docs/javadoc/org/montclairrobotics/alloy/update/Update.html new file mode 100644 index 0000000..24e224b --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/update/Update.html @@ -0,0 +1,243 @@ + + + + + +Update + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.update
+

Annotation Type Update

+
+
+
+
    +
  • +
    +
    +
    @Retention(value=RUNTIME)
    + @Target(value=METHOD)
    +public @interface Update
    +
    Indicates that the annotated method will be updated by the updater + +

    All methods annotated with @Update, will be added to the updater, but can only be successfully + updated if the method exists within a Component

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Optional Element Summary

      + + + + + + + + + + + + + + +
      Optional Elements 
      Modifier and TypeOptional Element and Description
      intpriority 
      intupdateRate 
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Element Detail

      + + + +
        +
      • +

        updateRate

        +
        public abstract int updateRate
        +
        +
        Default:
        +
        1
        +
        +
      • +
      +
    • +
    +
      +
    • + + +
        +
      • +

        priority

        +
        public abstract int priority
        +
        +
        Default:
        +
        0
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/update/Updateable.html b/docs/javadoc/org/montclairrobotics/alloy/update/Updateable.html new file mode 100644 index 0000000..b6fdf80 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/update/Updateable.html @@ -0,0 +1,275 @@ + + + + + +Updateable + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.update
+

Class Updateable

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.update.Updateable
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Updateable
    +extends java.lang.Object
    +
    A class used for creating objects that can be updated by the Updater + +

    An updateable contains a method to be updates along with any extra information needed for it + to be properly called and updated like the update rate, parameters and objects that it should be + invoked on

    +
    +
    Since:
    +
    0.1
    +
    See Also:
    +
    Updater
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidgetReferences() +
      Gets references to all of the object that the update method should be called on
      +
      intgetUpdateRate() 
      voidrun() 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getReferences

        +
        public void getReferences()
        +
        Gets references to all of the object that the update method should be called on
        +
      • +
      + + + +
        +
      • +

        run

        +
        public void run()
        +
      • +
      + + + +
        +
      • +

        getUpdateRate

        +
        public int getUpdateRate()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/update/Updater.html b/docs/javadoc/org/montclairrobotics/alloy/update/Updater.html new file mode 100644 index 0000000..2e125e0 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/update/Updater.html @@ -0,0 +1,294 @@ + + + + + +Updater + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.update
+

Class Updater

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.update.Updater
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Updater
    +extends java.lang.Object
    +
    Created by MHS Robotics on 12/5/2017.
    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Updater() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidregisterUpdatables() 
      static voidupdate() +
      The update method takes care of updating all of the methods in the project that are within a + component and are annotated with @Update It will also check the Update rate and decide + weather to update the method accordingly
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Updater

        +
        public Updater()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        registerUpdatables

        +
        public static void registerUpdatables()
        +
      • +
      + + + +
        +
      • +

        update

        +
        public static void update()
        +
        The update method takes care of updating all of the methods in the project that are within a + component and are annotated with @Update It will also check the Update rate and decide + weather to update the method accordingly
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/update/class-use/Updatable.html b/docs/javadoc/org/montclairrobotics/alloy/update/class-use/Updatable.html new file mode 100644 index 0000000..4a8955d --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/update/class-use/Updatable.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.update.Updatable + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.update.Updatable

+
+
No usage of org.montclairrobotics.alloy.update.Updatable
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/update/class-use/Update.html b/docs/javadoc/org/montclairrobotics/alloy/update/class-use/Update.html new file mode 100644 index 0000000..e86a554 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/update/class-use/Update.html @@ -0,0 +1,278 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.update.Update + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.update.Update

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/update/class-use/Updateable.html b/docs/javadoc/org/montclairrobotics/alloy/update/class-use/Updateable.html new file mode 100644 index 0000000..28076aa --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/update/class-use/Updateable.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.update.Updateable + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.update.Updateable

+
+
No usage of org.montclairrobotics.alloy.update.Updateable
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/update/class-use/Updater.html b/docs/javadoc/org/montclairrobotics/alloy/update/class-use/Updater.html new file mode 100644 index 0000000..5fbda3a --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/update/class-use/Updater.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.update.Updater + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.update.Updater

+
+
No usage of org.montclairrobotics.alloy.update.Updater
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/update/package-frame.html b/docs/javadoc/org/montclairrobotics/alloy/update/package-frame.html new file mode 100644 index 0000000..636bd16 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/update/package-frame.html @@ -0,0 +1,25 @@ + + + + + +org.montclairrobotics.alloy.update + + + + + +

org.montclairrobotics.alloy.update

+
+

Classes

+ +

Annotation Types

+ +
+ + diff --git a/docs/javadoc/org/montclairrobotics/alloy/update/package-summary.html b/docs/javadoc/org/montclairrobotics/alloy/update/package-summary.html new file mode 100644 index 0000000..1f31a43 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/update/package-summary.html @@ -0,0 +1,165 @@ + + + + + +org.montclairrobotics.alloy.update + + + + + + + + + + + +
+

Package org.montclairrobotics.alloy.update

+
+
+
    +
  • + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Updateable +
    A class used for creating objects that can be updated by the Updater
    +
    Updater +
    Created by MHS Robotics on 12/5/2017.
    +
    +
  • +
  • + + + + + + + + + + + + +
    Annotation Types Summary 
    Annotation TypeDescription
    Update +
    Indicates that the annotated method will be updated by the updater
    +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/update/package-tree.html b/docs/javadoc/org/montclairrobotics/alloy/update/package-tree.html new file mode 100644 index 0000000..6619e43 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/update/package-tree.html @@ -0,0 +1,140 @@ + + + + + +org.montclairrobotics.alloy.update Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package org.montclairrobotics.alloy.update

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • org.montclairrobotics.alloy.update.Updateable
    • +
    • org.montclairrobotics.alloy.update.Updater
    • +
    +
  • +
+

Annotation Type Hierarchy

+
    +
  • org.montclairrobotics.alloy.update.Update (implements java.lang.annotation.Annotation)
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/update/package-use.html b/docs/javadoc/org/montclairrobotics/alloy/update/package-use.html new file mode 100644 index 0000000..6532823 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/update/package-use.html @@ -0,0 +1,243 @@ + + + + + +Uses of Package org.montclairrobotics.alloy.update + + + + + + + + + + + +
+

Uses of Package
org.montclairrobotics.alloy.update

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/BangBang.html b/docs/javadoc/org/montclairrobotics/alloy/utils/BangBang.html new file mode 100644 index 0000000..abfadf5 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/BangBang.html @@ -0,0 +1,519 @@ + + + + + +BangBang + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.utils
+

Class BangBang

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    ErrorCorrection<java.lang.Double>, Input
    +
    +
    +
    +
    public class BangBang
    +extends InputComponent<java.lang.Double>
    +implements ErrorCorrection<java.lang.Double>
    +
    Simple error correction, that returns one value if the error is high, and another if it is low + +

    Bang bang error correction, checks if the error is higher or lower than a target, and returns + an output based on that result. This is not a very good, accurate or reliable way of error + correcting but can be useful in some cases where more exact error correction is not needed

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        target

        +
        public double target
        +
      • +
      + + + +
        +
      • +

        lowOut

        +
        public double lowOut
        +
      • +
      + + + +
        +
      • +

        highOut

        +
        public double highOut
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        BangBang

        +
        public BangBang(double lowOut,
        +                double highOut)
        +
      • +
      + + + +
        +
      • +

        BangBang

        +
        public BangBang(double correction)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setTarget

        +
        public BangBang setTarget(java.lang.Double target)
        +
        Set the target for the correction When the input is equal to the target the error is 0
        +
        +
        Specified by:
        +
        setTarget in interface ErrorCorrection<java.lang.Double>
        +
        Parameters:
        +
        target - the goal of the error correction
        +
        +
      • +
      + + + +
        +
      • +

        setInput

        +
        public BangBang setInput(Input input)
        +
        Description copied from class: InputComponent
        +
        A daisy-chainable method that sets the initial input of the input component
        +
        +
        Specified by:
        +
        setInput in interface ErrorCorrection<java.lang.Double>
        +
        Overrides:
        +
        setInput in class InputComponent<java.lang.Double>
        +
        Parameters:
        +
        input - the input to the error correction
        +
        +
      • +
      + + + +
        +
      • +

        getCorrection

        +
        public java.lang.Double getCorrection()
        +
        Get the value to apply the correction
        +
        +
        Specified by:
        +
        getCorrection in interface ErrorCorrection<java.lang.Double>
        +
        Returns:
        +
        the correction
        +
        +
      • +
      + + + +
        +
      • +

        copy

        +
        public BangBang copy()
        +
        +
        Specified by:
        +
        copy in interface ErrorCorrection<java.lang.Double>
        +
        Returns:
        +
        A copy of the error correction
        +
        +
      • +
      + + + +
        +
      • +

        calculateCorrection

        +
        public void calculateCorrection()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/BooleanToggle.html b/docs/javadoc/org/montclairrobotics/alloy/utils/BooleanToggle.html new file mode 100644 index 0000000..9247c08 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/BooleanToggle.html @@ -0,0 +1,367 @@ + + + + + +BooleanToggle + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.utils
+

Class BooleanToggle

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Input<java.lang.Boolean>
    +
    +
    +
    +
    public class BooleanToggle
    +extends Toggleable
    +implements Input<java.lang.Boolean>
    +
    An input that can be toggled between true and false
    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + + + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      BooleanToggle() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddisableAction() +
      Method to be called when the toggleable is disabled
      +
      voidenableAction() +
      Method to be called when the toggleable is enabled
      +
      java.lang.Booleanget() 
      + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        BooleanToggle

        +
        public BooleanToggle()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        get

        +
        public java.lang.Boolean get()
        +
        +
        Specified by:
        +
        get in interface Input<java.lang.Boolean>
        +
        +
      • +
      + + + +
        +
      • +

        enableAction

        +
        public void enableAction()
        +
        Description copied from class: Toggleable
        +
        Method to be called when the toggleable is enabled
        +
        +
        Specified by:
        +
        enableAction in class Toggleable
        +
        +
      • +
      + + + +
        +
      • +

        disableAction

        +
        public void disableAction()
        +
        Description copied from class: Toggleable
        +
        Method to be called when the toggleable is disabled
        +
        +
        Specified by:
        +
        disableAction in class Toggleable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/ConstantInput.html b/docs/javadoc/org/montclairrobotics/alloy/utils/ConstantInput.html new file mode 100644 index 0000000..cba5cfb --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/ConstantInput.html @@ -0,0 +1,307 @@ + + + + + +ConstantInput + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.utils
+

Class ConstantInput<T>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.utils.ConstantInput<T>
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Input<T>
    +
    +
    +
    +
    public class ConstantInput<T>
    +extends java.lang.Object
    +implements Input<T>
    +
    Created by MHS Robotics on 3/30/2018. + +

    The constant input can be used when a object or method requires an Input, but the input will + not change. This can be useful in testing and debugging, As well as certain component + implementations

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ConstantInput(T constant) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      Tget() 
      voidsetConstantValue(T constant) +
      Sets the value that the input will return
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + + + +
        +
      • +

        ConstantInput

        +
        public ConstantInput(T constant)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        get

        +
        public T get()
        +
        +
        Specified by:
        +
        get in interface Input<T>
        +
        +
      • +
      + + + + + +
        +
      • +

        setConstantValue

        +
        public void setConstantValue(T constant)
        +
        Sets the value that the input will return
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/Differential.html b/docs/javadoc/org/montclairrobotics/alloy/utils/Differential.html new file mode 100644 index 0000000..9cf9f22 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/Differential.html @@ -0,0 +1,412 @@ + + + + + +Differential + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.utils
+

Class Differential

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Input
    +
    +
    +
    +
    public class Differential
    +extends InputComponent<java.lang.Double>
    +
    A class to calculate how an input varies with time + +

    A differential is the rate of change of a certain variable with respect to another one. In + simpler terms is is the slope. The Differential class takes an input and calculates the average + rate of change over a very small interval of the input with respect to time + +

    This concept is a calculus concept when and can be most easily understood when looking at a + graph where time is the independent variable and the input is dependant on the time + +

    For example, a time differential of position would be velocity because velocity is how much + the position changes over time (eg. meters per second)

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        input

        +
        public Input<java.lang.Double> input
        +
        The dependant variable in the situation
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Differential

        +
        public Differential(Input in)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateDifferential

        +
        public void calculateDifferential()
        +
      • +
      + + + +
        +
      • +

        getInput

        +
        public java.lang.Double getInput()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/ErrorCorrection.html b/docs/javadoc/org/montclairrobotics/alloy/utils/ErrorCorrection.html new file mode 100644 index 0000000..8f614b1 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/ErrorCorrection.html @@ -0,0 +1,310 @@ + + + + + +ErrorCorrection + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.utils
+

Interface ErrorCorrection<T>

+
+
+
+
    +
  • +
    +
    Type Parameters:
    +
    T - the type of error that will be corrected
    +
    +
    +
    All Known Implementing Classes:
    +
    BangBang, PID, TuneablePID
    +
    +
    +
    +
    public interface ErrorCorrection<T>
    +
    A interface that defines the process of correcting an error + +

    Error correction can be implemented in different ways but is very important in creating a + functional robot. The most common + +

    Most error corrections calculate the error based on the difference of the input and the target + and then return an output correction based on that. + +

    Some common examples of error corrections are - PID Loop - Bang Bang control

    +
    +
    Since:
    +
    0.1
    +
    See Also:
    +
    PID
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setInput

        +
        ErrorCorrection<T> setInput(Input<T> input)
        +
        Set the input of the error correction the input should be the source of what correction is + correcting. For example in a motor the input would be the encoder
        +
        +
        Parameters:
        +
        input - the input to the error correction
        +
        +
      • +
      + + + + + +
        +
      • +

        setTarget

        +
        ErrorCorrection setTarget(T target)
        +
        Set the target for the correction When the input is equal to the target the error is 0
        +
        +
        Parameters:
        +
        target - the goal of the error correction
        +
        +
      • +
      + + + +
        +
      • +

        getCorrection

        +
        T getCorrection()
        +
        Get the value to apply the correction
        +
        +
        Returns:
        +
        the correction
        +
        +
      • +
      + + + +
        +
      • +

        copy

        +
        ErrorCorrection copy()
        +
        +
        Returns:
        +
        A copy of the error correction
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/GyroCorrection.html b/docs/javadoc/org/montclairrobotics/alloy/utils/GyroCorrection.html new file mode 100644 index 0000000..01bbd01 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/GyroCorrection.html @@ -0,0 +1,371 @@ + + + + + +GyroCorrection + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.utils
+

Class GyroCorrection

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Input
    +
    +
    +
    +
    public class GyroCorrection
    +extends InputComponent
    +
    A correction based on a gyroscope, to keep a consistent heading
    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        GyroCorrection

        +
        public GyroCorrection()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        calculateCorrection

        +
        public void calculateCorrection()
        +
      • +
      + + + +
        +
      • +

        getCorrection

        +
        public double getCorrection()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/Initializeable.html b/docs/javadoc/org/montclairrobotics/alloy/utils/Initializeable.html new file mode 100644 index 0000000..e5dd7b4 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/Initializeable.html @@ -0,0 +1,277 @@ + + + + + +Initializeable + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.utils
+

Class Initializeable

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.utils.Initializeable
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class Initializeable
    +extends java.lang.Object
    +
    An object that gets initialized once at the beginning of the teleop mode
    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Initializeable() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethod and Description
      abstract voidinit() +
      the method that is called at the beginning of the teleop mode
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Initializeable

        +
        public Initializeable()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        init

        +
        public abstract void init()
        +
        the method that is called at the beginning of the teleop mode
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/Input.html b/docs/javadoc/org/montclairrobotics/alloy/utils/Input.html new file mode 100644 index 0000000..474971f --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/Input.html @@ -0,0 +1,232 @@ + + + + + +Input + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.utils
+

Interface Input<T>

+
+
+
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        get

        +
        T get()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/Monitor.html b/docs/javadoc/org/montclairrobotics/alloy/utils/Monitor.html new file mode 100644 index 0000000..fad2dfe --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/Monitor.html @@ -0,0 +1,363 @@ + + + + + +Monitor + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.utils
+

Class Monitor

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.utils.Monitor
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Input<java.lang.Boolean>
    +
    +
    +
    +
    public class Monitor
    +extends java.lang.Object
    +implements Input<java.lang.Boolean>
    +
    Created by MHS Robotics on 3/12/2018. + +

    A monitor is a class that takes in 2 inputs, and returns true when they are within a certain + tolerance This can be good for monitoring if certain systems are working, for example if a motor + is spinning at a desired speed and can also be used to monitor a sensor to see if it has reached + a certain value.

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      Input<java.lang.Double>input +
      The input to be checked
      +
      Input<java.lang.Double>target +
      The desired target for the input
      +
      doubletolerance +
      How far the input can be away from the target while still being true
      +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Monitor(Input<java.lang.Double> target, + Input<java.lang.Double> input, + double tolerance) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      java.lang.Booleanget() 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        target

        +
        public Input<java.lang.Double> target
        +
        The desired target for the input
        +
      • +
      + + + +
        +
      • +

        input

        +
        public Input<java.lang.Double> input
        +
        The input to be checked
        +
      • +
      + + + +
        +
      • +

        tolerance

        +
        public double tolerance
        +
        How far the input can be away from the target while still being true
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Monitor

        +
        public Monitor(Input<java.lang.Double> target,
        +               Input<java.lang.Double> input,
        +               double tolerance)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        get

        +
        public java.lang.Boolean get()
        +
        +
        Specified by:
        +
        get in interface Input<java.lang.Boolean>
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/PID.html b/docs/javadoc/org/montclairrobotics/alloy/utils/PID.html new file mode 100644 index 0000000..2c9ed26 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/PID.html @@ -0,0 +1,505 @@ + + + + + +PID + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.utils
+

Class PID

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    ErrorCorrection<java.lang.Double>, Input
    +
    +
    +
    +
    public class PID
    +extends InputComponent<java.lang.Double>
    +implements ErrorCorrection<java.lang.Double>
    +
    Created by Montclair robotics on 2/27/2018 + +

    A PID controller is able to control a component that has a target, current state, and can be + controlled for example: - A robots heading using a Gryo - A motors position using encoders + +

    PID stands for Proportion, Integral and Derivative control. It uses the error of a component + and then calculates the correction the PID values must be tuned in order to have a working PID + loop A properly tuned implementation of a PID controller should result in a correction that goes + fast, and accurate to its target, and does not overshoot it. + +

    You can read more about implementing PID control here + https://github.com/GarrettBurroughs/Alloy/wiki/Using-PID-control You can read more + about how PID works here https://en.wikipedia.org/wiki/PID_controller

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        PID

        +
        public PID(double p,
        +           double i,
        +           double d)
        +
        Create a new PID
        +
        +
        Parameters:
        +
        p - proportional constant
        +
        i - integral constant
        +
        d - derivative constant
        +
        +
      • +
      + + + +
        +
      • +

        PID

        +
        public PID(double p,
        +           double i,
        +           double d,
        +           Input<java.lang.Double> input,
        +           double target)
        +
        Create a new PID with the input and target defined
        +
        +
        Parameters:
        +
        p - proportional constan
        +
        i - integral constant
        +
        d - derivative constant
        +
        input - the input of the component being controlled (current status)
        +
        target - the desired target (status) of the component being controlled
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setTarget

        +
        public PID setTarget(java.lang.Double target)
        +
        Description copied from interface: ErrorCorrection
        +
        Set the target for the correction When the input is equal to the target the error is 0
        +
        +
        Specified by:
        +
        setTarget in interface ErrorCorrection<java.lang.Double>
        +
        Parameters:
        +
        target - the goal of the error correction
        +
        +
      • +
      + + + +
        +
      • +

        setInput

        +
        public PID setInput(Input<java.lang.Double> input)
        +
        Description copied from class: InputComponent
        +
        A daisy-chainable method that sets the initial input of the input component
        +
        +
        Specified by:
        +
        setInput in interface ErrorCorrection<java.lang.Double>
        +
        Overrides:
        +
        setInput in class InputComponent<java.lang.Double>
        +
        Parameters:
        +
        input - the input to the error correction
        +
        +
      • +
      + + + +
        +
      • +

        update

        +
        public void update()
        +
      • +
      + + + +
        +
      • +

        getCorrection

        +
        public java.lang.Double getCorrection()
        +
        Description copied from interface: ErrorCorrection
        +
        Get the value to apply the correction
        +
        +
        Specified by:
        +
        getCorrection in interface ErrorCorrection<java.lang.Double>
        +
        Returns:
        +
        the calculated correction
        +
        +
      • +
      + + + + +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/Toggleable.Status.html b/docs/javadoc/org/montclairrobotics/alloy/utils/Toggleable.Status.html new file mode 100644 index 0000000..2dd1d3c --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/Toggleable.Status.html @@ -0,0 +1,356 @@ + + + + + +Toggleable.Status + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.utils
+

Enum Toggleable.Status

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<Toggleable.Status>
    • +
    • +
        +
      • org.montclairrobotics.alloy.utils.Toggleable.Status
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<Toggleable.Status>
    +
    +
    +
    Enclosing class:
    +
    Toggleable
    +
    +
    +
    +
    public static enum Toggleable.Status
    +extends java.lang.Enum<Toggleable.Status>
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Summary

      + + + + + + + + + + + +
      Enum Constants 
      Enum Constant and Description
      DISABLED 
      ENABLED 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      booleanisEnabled() 
      static Toggleable.StatusvalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static Toggleable.Status[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Toggleable.Status[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Toggleable.Status c : Toggleable.Status.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Toggleable.Status valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      + + + +
        +
      • +

        isEnabled

        +
        public boolean isEnabled()
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/Toggleable.html b/docs/javadoc/org/montclairrobotics/alloy/utils/Toggleable.html new file mode 100644 index 0000000..0af6890 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/Toggleable.html @@ -0,0 +1,411 @@ + + + + + +Toggleable + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.utils
+

Class Toggleable

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.utils.Toggleable
    • +
    +
  • +
+
+
    +
  • +
    +
    Direct Known Subclasses:
    +
    BooleanToggle, Component, Deadzone, VectorDeadzone
    +
    +
    +
    +
    public abstract class Toggleable
    +extends java.lang.Object
    +
    Created by MHS Robotics on 2/11/2018. + +

    Toggleables are used for objects of mechanisms that can either be on (Enabled), or off + toggleables can have actions defined for when they are enabled and disabled, as well as be tied + to different parts of alloy like buttons and auto states

    +
    +
    Since:
    +
    0.1
    +
    See Also:
    +
    ToggleButton
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      + + + + + + + + + + +
      Nested Classes 
      Modifier and TypeClass and Description
      static class Toggleable.Status 
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      Toggleable.Statusstatus +
      The status of the toggleable, to keep track of weather it is enabled, or disabled
      +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Toggleable() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddisable() +
      Disables the toggleable
      +
      abstract voiddisableAction() +
      Method to be called when the toggleable is disabled
      +
      voidenable() +
      Enables the toggleable
      +
      abstract voidenableAction() +
      Method to be called when the toggleable is enabled
      +
      voidtoggle() +
      Switches(Toggles), between the two states, If the toggleable is disabled, enable it If the + toggleable is enabled, disable it
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        status

        +
        public Toggleable.Status status
        +
        The status of the toggleable, to keep track of weather it is enabled, or disabled
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Toggleable

        +
        public Toggleable()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        enableAction

        +
        public abstract void enableAction()
        +
        Method to be called when the toggleable is enabled
        +
      • +
      + + + +
        +
      • +

        disableAction

        +
        public abstract void disableAction()
        +
        Method to be called when the toggleable is disabled
        +
      • +
      + + + +
        +
      • +

        enable

        +
        public void enable()
        +
        Enables the toggleable
        +
      • +
      + + + +
        +
      • +

        disable

        +
        public void disable()
        +
        Disables the toggleable
        +
      • +
      + + + +
        +
      • +

        toggle

        +
        public void toggle()
        +
        Switches(Toggles), between the two states, If the toggleable is disabled, enable it If the + toggleable is enabled, disable it
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/TuneablePID.html b/docs/javadoc/org/montclairrobotics/alloy/utils/TuneablePID.html new file mode 100644 index 0000000..970a3f7 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/TuneablePID.html @@ -0,0 +1,440 @@ + + + + + +TuneablePID + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.utils
+

Class TuneablePID

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    ErrorCorrection<java.lang.Double>, Input
    +
    +
    +
    +
    public class TuneablePID
    +extends InputComponent<java.lang.Double>
    +implements ErrorCorrection<java.lang.Double>
    +
    A PID class that takes in tunable inputs to make PID tuning easier + +

    Using a standard PID model, the user would have to re-deploy an test code which can end up + becoming a very long and drawn out process. By making them inputs, it is able to change these + values at runtime This could be done easily in FRC using smartdashboard or in FTC by using + buttons or joysticks to change values

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        TuneablePID

        +
        public TuneablePID()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setInput

        +
        public TuneablePID setInput(Input input)
        +
        Set the input of the error correction the input should be the source of what correction is + correcting. For example in a motor the input would be the encoder
        +
        +
        Specified by:
        +
        setInput in interface ErrorCorrection<java.lang.Double>
        +
        Overrides:
        +
        setInput in class InputComponent<java.lang.Double>
        +
        Parameters:
        +
        input - the input to the error correction
        +
        +
      • +
      + + + +
        +
      • +

        setTarget

        +
        public TuneablePID setTarget(java.lang.Double target)
        +
        Set the target for the correction When the input is equal to the target the error is 0
        +
        +
        Specified by:
        +
        setTarget in interface ErrorCorrection<java.lang.Double>
        +
        Parameters:
        +
        target - the goal of the error correction
        +
        +
      • +
      + + + +
        +
      • +

        getCorrection

        +
        public java.lang.Double getCorrection()
        +
        Get the value to apply the correction
        +
        +
        Specified by:
        +
        getCorrection in interface ErrorCorrection<java.lang.Double>
        +
        Returns:
        +
        the correction
        +
        +
      • +
      + + + + +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/Utils.html b/docs/javadoc/org/montclairrobotics/alloy/utils/Utils.html new file mode 100644 index 0000000..8f92458 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/Utils.html @@ -0,0 +1,377 @@ + + + + + +Utils + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.utils
+

Class Utils

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.utils.Utils
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Utils
    +extends java.lang.Object
    +
    A set of common methods that are useful in writing robot code + +

    The Utils class contains static methods that can perform basic functions that can be useful

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Utils() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static doubleconstrain(double in, + double min, + double max) +
      Makes sure that a value is between 2 different values
      +
      static doublemap(double in, + double inputMin, + double inputMax, + double outputMin, + double outputMax) +
      The map function takes an input value that can be between a certain range and maps it to a + specified output range
      +
      static doublepow2(double in, + int pow) +
      A modified power function that conserves the sign
      +
      static intsign(double in) +
      Returns the sign of a number
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Utils

        +
        public Utils()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        constrain

        +
        public static double constrain(double in,
        +                               double min,
        +                               double max)
        +
        Makes sure that a value is between 2 different values + +

        The constrain method will return the passed in value if it is between the boundaries (min + & max), amd will return the min or the max depending on which side it runs out on

        +
        +
        Parameters:
        +
        in - the value being passed in
        +
        min - minimum the value can be
        +
        max - maximum the value can be
        +
        Returns:
        +
        a value between the maximum and minimum value
        +
        +
      • +
      + + + +
        +
      • +

        map

        +
        public static double map(double in,
        +                         double inputMin,
        +                         double inputMax,
        +                         double outputMin,
        +                         double outputMax)
        +
        The map function takes an input value that can be between a certain range and maps it to a + specified output range
        +
        +
        Parameters:
        +
        in - the value being passed in
        +
        inputMin - the minimum value the input can be
        +
        inputMax - the maximum value the input can be
        +
        outputMin - the minimum value the output can be
        +
        outputMax - the maximum value the output can be
        +
        Returns:
        +
        a mapped value from the input range to the output range
        +
        +
      • +
      + + + +
        +
      • +

        sign

        +
        public static int sign(double in)
        +
        Returns the sign of a number
        +
        +
        Parameters:
        +
        in - the number whose sign will be calculated
        +
        Returns:
        +
        1 if the number is positive and -1 if it is negative
        +
        +
      • +
      + + + +
        +
      • +

        pow2

        +
        public static double pow2(double in,
        +                          int pow)
        +
        A modified power function that conserves the sign
        +
        +
        Parameters:
        +
        in - the number to be raised to a power
        +
        pow - the power the number will be raised to
        +
        Returns:
        +
        in^pow while keeping the sign of in
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/BangBang.html b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/BangBang.html new file mode 100644 index 0000000..96d1001 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/BangBang.html @@ -0,0 +1,174 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.utils.BangBang + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.utils.BangBang

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/BooleanToggle.html b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/BooleanToggle.html new file mode 100644 index 0000000..3c8e172 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/BooleanToggle.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.utils.BooleanToggle + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.utils.BooleanToggle

+
+
No usage of org.montclairrobotics.alloy.utils.BooleanToggle
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/ConstantInput.html b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/ConstantInput.html new file mode 100644 index 0000000..99309bc --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/ConstantInput.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.utils.ConstantInput + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.utils.ConstantInput

+
+
No usage of org.montclairrobotics.alloy.utils.ConstantInput
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Differential.html b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Differential.html new file mode 100644 index 0000000..0760c58 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Differential.html @@ -0,0 +1,168 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.utils.Differential + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.utils.Differential

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/ErrorCorrection.html b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/ErrorCorrection.html new file mode 100644 index 0000000..3029ed8 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/ErrorCorrection.html @@ -0,0 +1,342 @@ + + + + + +Uses of Interface org.montclairrobotics.alloy.utils.ErrorCorrection + + + + + + + + + + + +
+

Uses of Interface
org.montclairrobotics.alloy.utils.ErrorCorrection

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/GyroCorrection.html b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/GyroCorrection.html new file mode 100644 index 0000000..e0d8dd3 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/GyroCorrection.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.utils.GyroCorrection + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.utils.GyroCorrection

+
+
No usage of org.montclairrobotics.alloy.utils.GyroCorrection
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Initializeable.html b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Initializeable.html new file mode 100644 index 0000000..ed9ed1a --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Initializeable.html @@ -0,0 +1,164 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.utils.Initializeable + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.utils.Initializeable

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Input.html b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Input.html new file mode 100644 index 0000000..4bab8c8 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Input.html @@ -0,0 +1,469 @@ + + + + + +Uses of Interface org.montclairrobotics.alloy.utils.Input + + + + + + + + + + + +
+

Uses of Interface
org.montclairrobotics.alloy.utils.Input

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Monitor.html b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Monitor.html new file mode 100644 index 0000000..afbd24d --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Monitor.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.utils.Monitor + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.utils.Monitor

+
+
No usage of org.montclairrobotics.alloy.utils.Monitor
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/PID.html b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/PID.html new file mode 100644 index 0000000..b79acf8 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/PID.html @@ -0,0 +1,168 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.utils.PID + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.utils.PID

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Toggleable.Status.html b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Toggleable.Status.html new file mode 100644 index 0000000..357c0ef --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Toggleable.Status.html @@ -0,0 +1,188 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.utils.Toggleable.Status + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.utils.Toggleable.Status

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Toggleable.html b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Toggleable.html new file mode 100644 index 0000000..0a444d8 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Toggleable.html @@ -0,0 +1,403 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.utils.Toggleable + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.utils.Toggleable

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/TuneablePID.html b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/TuneablePID.html new file mode 100644 index 0000000..f166815 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/TuneablePID.html @@ -0,0 +1,173 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.utils.TuneablePID + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.utils.TuneablePID

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Utils.html b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Utils.html new file mode 100644 index 0000000..4231d51 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/class-use/Utils.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.utils.Utils + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.utils.Utils

+
+
No usage of org.montclairrobotics.alloy.utils.Utils
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/package-frame.html b/docs/javadoc/org/montclairrobotics/alloy/utils/package-frame.html new file mode 100644 index 0000000..8b45d3a --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/package-frame.html @@ -0,0 +1,39 @@ + + + + + +org.montclairrobotics.alloy.utils + + + + + +

org.montclairrobotics.alloy.utils

+ + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/package-summary.html b/docs/javadoc/org/montclairrobotics/alloy/utils/package-summary.html new file mode 100644 index 0000000..c1c7b74 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/package-summary.html @@ -0,0 +1,240 @@ + + + + + +org.montclairrobotics.alloy.utils + + + + + + + + + + + +
+

Package org.montclairrobotics.alloy.utils

+
+
+
    +
  • + + + + + + + + + + + + + + + + +
    Interface Summary 
    InterfaceDescription
    ErrorCorrection<T> +
    A interface that defines the process of correcting an error
    +
    Input<T> +
    A dynamically stored input
    +
    +
  • +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    BangBang +
    Simple error correction, that returns one value if the error is high, and another if it is low
    +
    BooleanToggle +
    An input that can be toggled between true and false
    +
    ConstantInput<T> +
    Created by MHS Robotics on 3/30/2018.
    +
    Differential +
    A class to calculate how an input varies with time
    +
    GyroCorrection +
    A correction based on a gyroscope, to keep a consistent heading
    +
    Initializeable +
    An object that gets initialized once at the beginning of the teleop mode
    +
    Monitor +
    Created by MHS Robotics on 3/12/2018.
    +
    PID +
    Created by Montclair robotics on 2/27/2018
    +
    Toggleable +
    Created by MHS Robotics on 2/11/2018.
    +
    TuneablePID +
    A PID class that takes in tunable inputs to make PID tuning easier
    +
    Utils +
    A set of common methods that are useful in writing robot code
    +
    +
  • +
  • + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    Toggleable.Status 
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/package-tree.html b/docs/javadoc/org/montclairrobotics/alloy/utils/package-tree.html new file mode 100644 index 0000000..4c7c293 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/package-tree.html @@ -0,0 +1,173 @@ + + + + + +org.montclairrobotics.alloy.utils Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package org.montclairrobotics.alloy.utils

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • org.montclairrobotics.alloy.utils.ConstantInput<T> (implements org.montclairrobotics.alloy.utils.Input<T>)
    • +
    • org.montclairrobotics.alloy.utils.Initializeable
    • +
    • org.montclairrobotics.alloy.utils.Monitor (implements org.montclairrobotics.alloy.utils.Input<T>)
    • +
    • org.montclairrobotics.alloy.utils.Toggleable +
        +
      • org.montclairrobotics.alloy.utils.BooleanToggle (implements org.montclairrobotics.alloy.utils.Input<T>)
      • +
      • org.montclairrobotics.alloy.components.Component + +
      • +
      +
    • +
    • org.montclairrobotics.alloy.utils.Utils
    • +
    +
  • +
+

Interface Hierarchy

+
    +
  • org.montclairrobotics.alloy.utils.ErrorCorrection<T>
  • +
  • org.montclairrobotics.alloy.utils.Input<T>
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/utils/package-use.html b/docs/javadoc/org/montclairrobotics/alloy/utils/package-use.html new file mode 100644 index 0000000..35d666b --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/utils/package-use.html @@ -0,0 +1,379 @@ + + + + + +Uses of Package org.montclairrobotics.alloy.utils + + + + + + + + + + + +
+

Uses of Package
org.montclairrobotics.alloy.utils

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/vector/Angle.html b/docs/javadoc/org/montclairrobotics/alloy/vector/Angle.html new file mode 100644 index 0000000..e5acb95 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/vector/Angle.html @@ -0,0 +1,553 @@ + + + + + +Angle + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.vector
+

Class Angle

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.vector.Angle
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Angle
    +extends java.lang.Object
    +
    A class to keep track of angles + +

    The angle class allows for easy management of angles as well as easy conversion between degree + and radian angle measure The class keeps track of the angle in degrees but can easily be + converted to radians

    +
    +
    Since:
    +
    0.1
    +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      Angle(org.montclairrobotics.alloy.vector.Angle.AngleMeasure angleMeasure, + double angle) +
      Creating a new angle with an angle measure unit and the measure of the angle itself
      +
      Angle(double degrees) +
      Creating an angle with degrees
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      doublecos() +
      get the cosine of the angle
      +
      static AnglecreateDegrees(double degrees) +
      Creates a new angle using degrees
      +
      static AnglecreateRadians(double radians) +
      Creates a new angle using radians
      +
      doublegetDegrees() +
      Get the angle measure in degrees
      +
      doublegetRadians() +
      Get the angle measure in radians
      +
      voidsetDegrees(double degrees) +
      set the angle in degrees
      +
      voidsetRadians(double radians) +
      set the angle in radians
      +
      doublesin() +
      get the sine of the angle
      +
      doubletan() +
      get the tangent of the angle
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        ZERO

        +
        public static final Angle ZERO
        +
      • +
      + + + +
        +
      • +

        HALF_PI

        +
        public static final Angle HALF_PI
        +
      • +
      + + + +
        +
      • +

        PI

        +
        public static final Angle PI
        +
      • +
      + + + +
        +
      • +

        TWO_PI

        +
        public static final Angle TWO_PI
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Angle

        +
        public Angle(org.montclairrobotics.alloy.vector.Angle.AngleMeasure angleMeasure,
        +             double angle)
        +
        Creating a new angle with an angle measure unit and the measure of the angle itself
        +
        +
        Parameters:
        +
        angleMeasure - What unit to be used for the angle measure
        +
        angle - The angle
        +
        +
      • +
      + + + +
        +
      • +

        Angle

        +
        public Angle(double degrees)
        +
        Creating an angle with degrees
        +
        +
        Parameters:
        +
        degrees - Degree angle measure
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getDegrees

        +
        public double getDegrees()
        +
        Get the angle measure in degrees
        +
        +
        Returns:
        +
        the degree angle measure
        +
        +
      • +
      + + + +
        +
      • +

        getRadians

        +
        public double getRadians()
        +
        Get the angle measure in radians
        +
        +
        Returns:
        +
        the radian angle measure
        +
        +
      • +
      + + + +
        +
      • +

        setDegrees

        +
        public void setDegrees(double degrees)
        +
        set the angle in degrees
        +
        +
        Parameters:
        +
        degrees - the degree angle measure
        +
        +
      • +
      + + + +
        +
      • +

        setRadians

        +
        public void setRadians(double radians)
        +
        set the angle in radians
        +
        +
        Parameters:
        +
        radians - the degree angle measure
        +
        +
      • +
      + + + +
        +
      • +

        sin

        +
        public double sin()
        +
        get the sine of the angle
        +
        +
        Returns:
        +
        the sine of the angle
        +
        +
      • +
      + + + +
        +
      • +

        cos

        +
        public double cos()
        +
        get the cosine of the angle
        +
        +
        Returns:
        +
        the cosine of the angle
        +
        +
      • +
      + + + +
        +
      • +

        tan

        +
        public double tan()
        +
        get the tangent of the angle
        +
        +
        Returns:
        +
        the tangent of the angle
        +
        +
      • +
      + + + +
        +
      • +

        createDegrees

        +
        public static Angle createDegrees(double degrees)
        +
        Creates a new angle using degrees
        +
        +
        Parameters:
        +
        degrees - the amount of degrees the new angle will be created with
        +
        Returns:
        +
        a new angle
        +
        +
      • +
      + + + +
        +
      • +

        createRadians

        +
        public static Angle createRadians(double radians)
        +
        Creates a new angle using radians
        +
        +
        Parameters:
        +
        radians - the amount of radians the new angle will be created with
        +
        Returns:
        +
        a new angle
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/vector/Polar.html b/docs/javadoc/org/montclairrobotics/alloy/vector/Polar.html new file mode 100644 index 0000000..b69087e --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/vector/Polar.html @@ -0,0 +1,738 @@ + + + + + +Polar + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.vector
+

Class Polar

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.vector.Polar
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Vector
    +
    +
    +
    +
    public class Polar
    +extends java.lang.Object
    +implements Vector
    +
    Created by MHS Robotics on 11/14/2017. + +

    A vector can be defined in rectangular(XY), or polar form.
    + This class is implementation for vectors in Polar form
    + It controls the conversions from rectangular to polar and vice versa + +

    https://en.wikipedia.org/wiki/Vector_notation

    +
    +
    Since:
    +
    0.1
    +
    See Also:
    +
    Vector
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      +
        +
      • + + +

        Fields inherited from interface org.montclairrobotics.alloy.vector.Vector

        +ZERO
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Polar(double magnitude, + Angle angle) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      Vectoradd(Vector vector) +
      Adds two vectors together and returns the result
      +
      AngleangleBetween(Vector vector) +
      gets the angle between two vectors
      +
      Vectorcopy() +
      Creates a copy of the vector
      +
      doublecross(Vector vector) +
      Returns the product of two vectors that have been crossed
      +
      doubledot(Vector vector) +
      Returns the dot product of two vectors
      +
      AnglegetAngle() +
      Gets the angle in standard position that the vector makes
      +
      doublegetManitude() +
      Gets the magnitude of the vector
      +
      doublegetX() +
      Gets the X component of the vector
      +
      doublegetY() +
      Gets the Y component of the vector
      +
      Vectornormalize() +
      Normalizes a vector and returns the result
      +
      Vectorrotate(Angle angle) +
      returns a vector rotated by a given angle
      +
      Vectorscale(double scalar) +
      Scales the vectors magnitude by a scalar value
      +
      voidsetAngle(Angle angle) +
      Sets the angle in standard position of the vector
      +
      voidsetMagnitude(double magnitude) +
      Sets the magnitude of the vector
      +
      voidsetX(double x) +
      Sets the x component of the vector
      +
      voidsetY(double y) +
      Sets the y component of the vector
      +
      Vectorsubtract(Vector vector) +
      Subtracts a vector and returns the result
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Polar

        +
        public Polar(double magnitude,
        +             Angle angle)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getX

        +
        public double getX()
        +
        Gets the X component of the vector
        +
        +
        Specified by:
        +
        getX in interface Vector
        +
        Returns:
        +
        the X component of the vector
        +
        +
      • +
      + + + +
        +
      • +

        setX

        +
        public void setX(double x)
        +
        Sets the x component of the vector
        +
        +
        Specified by:
        +
        setX in interface Vector
        +
        Parameters:
        +
        x - what the x value will be set to
        +
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public double getY()
        +
        Gets the Y component of the vector
        +
        +
        Specified by:
        +
        getY in interface Vector
        +
        Returns:
        +
        the Y component of the vector
        +
        +
      • +
      + + + +
        +
      • +

        setY

        +
        public void setY(double y)
        +
        Sets the y component of the vector
        +
        +
        Specified by:
        +
        setY in interface Vector
        +
        Parameters:
        +
        y - what the y value will be set to
        +
        +
      • +
      + + + +
        +
      • +

        getManitude

        +
        public double getManitude()
        +
        Gets the magnitude of the vector
        +
        +
        Specified by:
        +
        getManitude in interface Vector
        +
        Returns:
        +
        the magnitude of the vector
        +
        +
      • +
      + + + +
        +
      • +

        setMagnitude

        +
        public void setMagnitude(double magnitude)
        +
        Sets the magnitude of the vector
        +
        +
        Specified by:
        +
        setMagnitude in interface Vector
        +
        Parameters:
        +
        magnitude - what the magnitude will be set to
        +
        +
      • +
      + + + +
        +
      • +

        getAngle

        +
        public Angle getAngle()
        +
        Gets the angle in standard position that the vector makes
        +
        +
        Specified by:
        +
        getAngle in interface Vector
        +
        Returns:
        +
        the angle in standard position that the vector makes
        +
        +
      • +
      + + + +
        +
      • +

        setAngle

        +
        public void setAngle(Angle angle)
        +
        Sets the angle in standard position of the vector
        +
        +
        Specified by:
        +
        setAngle in interface Vector
        +
        Parameters:
        +
        angle - what the angle will be set to
        +
        +
      • +
      + + + +
        +
      • +

        add

        +
        public Vector add(Vector vector)
        +
        Adds two vectors together and returns the result + +

        + +

        The result of a vector addition will be another vector, One way of adding two vectors + together is splitting it up into it's x and y components and adding them together and making + a new vector out of those components
        + EX:
        + V1 = 3i + 4j
        + V2 = 7i + 5j
        +
        + V1 + V2 = 3i + 7i + 4j + 5j = 10i + 9j
        + Geometric Visualization:
        + Vectors can also be added in a geometric way through the "Tip-To-Tail" method, In this method + both the vectors are drawn using arrow vector notation + https://en.wikipedia.org/wiki/Vector_notation one vector is then drawn at the + edge of the first vector. The resultant vector is then drawn from the start of the first + vector to the tip of the second vector This is where the name tip to tail comes from + +

        +
        +
        Specified by:
        +
        add in interface Vector
        +
        Parameters:
        +
        vector - The vector to be added
        +
        Returns:
        +
        The result of the two vectors being added
        +
        +
      • +
      + + + +
        +
      • +

        subtract

        +
        public Vector subtract(Vector vector)
        +
        Subtracts a vector and returns the result + +

        + +

        vector subtraction is similar to vector addition but the direction of the vector being + subtracted is simply reversed
        + EX:
        + V1 = 3i + 4j
        + V2 = 7i + 5j
        +
        + V1 + V2 = 3i + 7i + 4j + 5j = 10i + 9j
        + V1 - V2 = 3i + (-7i) + 4j + (-5j) = -4i + -j

        +
        +
        Specified by:
        +
        subtract in interface Vector
        +
        Parameters:
        +
        vector - The vector to be subtracted
        +
        Returns:
        +
        The result of the passed in vector being subtracted from the vector object
        +
        +
      • +
      + + + +
        +
      • +

        scale

        +
        public Vector scale(double scalar)
        +
        Scales the vectors magnitude by a scalar value
        +
        +
        Specified by:
        +
        scale in interface Vector
        +
        Parameters:
        +
        scalar - double to scale the vector by
        +
        Returns:
        +
        The result of the vector being
        +
        +
      • +
      + + + +
        +
      • +

        cross

        +
        public double cross(Vector vector)
        +
        Returns the product of two vectors that have been crossed + +

        + +

        The result of the cross product is a vector, The cross product of a vector is the vector + that is perpendicular to both vectors When crossing two 2dimensional vectors the result will + be a 3dimensional vector Because of this this method only returns the magnitude (Z component) + of the cross product The magnitude of the cross product is same as the area of the + parallelogram that the two vectors make in the X/Y plane.
        + https://en.wikipedia.org/wiki/Cross_product

        +
        +
        Specified by:
        +
        cross in interface Vector
        +
        Parameters:
        +
        vector - the vector to be multiplied using the cross product
        +
        Returns:
        +
        the magnitude of the cross product of the two vectors
        +
        +
      • +
      + + + +
        +
      • +

        dot

        +
        public double dot(Vector vector)
        +
        Returns the dot product of two vectors + +

        + +

        The result of the dot product is a scalar value (number), The dot product can be viewed as + the projection of one vector on to another times the magnitude of the original vector
        + This can be written mathematically as |A||B|cos(theta), where theta is the angle between A + and B Another mathematical representation of the dot product using its components is:
        + A = <a1, a2>
        + B = <b1, b2>
        + A . B = a1*b1 + a2*b2
        + https://en.wikipedia.org/wiki/Dot_product

        +
        +
        Specified by:
        +
        dot in interface Vector
        +
        Parameters:
        +
        vector - The vector to be multiplied using the dot product
        +
        Returns:
        +
        the scalar result of the dot of the two vectors
        +
        +
      • +
      + + + +
        +
      • +

        rotate

        +
        public Vector rotate(Angle angle)
        +
        returns a vector rotated by a given angle
        +
        +
        Specified by:
        +
        rotate in interface Vector
        +
        Parameters:
        +
        angle - the angle that the vector is to be rotated by
        +
        Returns:
        +
        the result of the rotated vector
        +
        +
      • +
      + + + +
        +
      • +

        angleBetween

        +
        public Angle angleBetween(Vector vector)
        +
        gets the angle between two vectors
        +
        +
        Specified by:
        +
        angleBetween in interface Vector
        +
        Parameters:
        +
        vector - the vector that will be used to find the angle between
        +
        Returns:
        +
        the angle between the vectors
        +
        +
      • +
      + + + +
        +
      • +

        normalize

        +
        public Vector normalize()
        +
        Normalizes a vector and returns the result + +

        + +

        A normalized vector is a vector with magnitude 1. Normalized vectors are also called unit + vectors. A normalized vector keeps it's direction as well as the same proportions of its + components. When a vector is defined by its components it can be normalized it can be + expressed as
        + A = <a1, a2>
        + A' = <a1/|A|, a2/|A|>

        +
        +
        Specified by:
        +
        normalize in interface Vector
        +
        Returns:
        +
        the normalized vector
        +
        +
      • +
      + + + +
        +
      • +

        copy

        +
        public Vector copy()
        +
        Creates a copy of the vector
        +
        +
        Specified by:
        +
        copy in interface Vector
        +
        Returns:
        +
        a copy of the vector
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/vector/Vector.html b/docs/javadoc/org/montclairrobotics/alloy/vector/Vector.html new file mode 100644 index 0000000..977ce6b --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/vector/Vector.html @@ -0,0 +1,671 @@ + + + + + +Vector + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.vector
+

Interface Vector

+
+
+
+
    +
  • +
    +
    All Known Implementing Classes:
    +
    Polar, XY
    +
    +
    +
    +
    public interface Vector
    +
    Created by MHS Robotics on 11/14/2017.
    +
    + Interface for creating vector classes, implemented in vector.XY and vector.Polar
    +
    + Since a 2D vector can be made up of an angle and a Magnitude or it's vector components (XY) The + vector interface contains all functionality that a vector should have and it is then implemented + in each vector subclass
    +
    + NOTE: No mathematical operations are performed on the vector but return a new vector that is the + result of the operation
    +
    + To read more about vectors see here https://en.wikipedia.org/wiki/Euclidean_vector +
    + To read more about dot products see here https://en.wikipedia.org/wiki/Dot_product +
    + To read more about cross products see here + https://en.wikipedia.org/wiki/Cross_product
    +
    +
    Since:
    +
    0.1
    +
    See Also:
    +
    Polar, +XY
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      static VectorZERO 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethod and Description
      Vectoradd(Vector vector) +
      Adds two vectors together and returns the result
      +
      AngleangleBetween(Vector vector) +
      gets the angle between two vectors
      +
      Vectorcopy() +
      Creates a copy of the vector
      +
      doublecross(Vector vector) +
      Returns the product of two vectors that have been crossed
      +
      doubledot(Vector vector) +
      Returns the dot product of two vectors
      +
      AnglegetAngle() +
      Gets the angle in standard position that the vector makes
      +
      doublegetManitude() +
      Gets the magnitude of the vector
      +
      doublegetX() +
      Gets the X component of the vector
      +
      doublegetY() +
      Gets the Y component of the vector
      +
      Vectornormalize() +
      Normalizes a vector and returns the result
      +
      Vectorrotate(Angle angle) +
      returns a vector rotated by a given angle
      +
      Vectorscale(double scalar) +
      Scales the vectors magnitude by a scalar value
      +
      voidsetAngle(Angle angle) +
      Sets the angle in standard position of the vector
      +
      voidsetMagnitude(double magnitude) +
      Sets the magnitude of the vector
      +
      voidsetX(double x) +
      Sets the x component of the vector
      +
      voidsetY(double y) +
      Sets the y component of the vector
      +
      Vectorsubtract(Vector vector) +
      Subtracts a vector and returns the result
      +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        ZERO

        +
        static final Vector ZERO
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getX

        +
        double getX()
        +
        Gets the X component of the vector
        +
        +
        Returns:
        +
        the X component of the vector
        +
        +
      • +
      + + + +
        +
      • +

        setX

        +
        void setX(double x)
        +
        Sets the x component of the vector
        +
        +
        Parameters:
        +
        x - what the x value will be set to
        +
        +
      • +
      + + + +
        +
      • +

        getY

        +
        double getY()
        +
        Gets the Y component of the vector
        +
        +
        Returns:
        +
        the Y component of the vector
        +
        +
      • +
      + + + +
        +
      • +

        setY

        +
        void setY(double y)
        +
        Sets the y component of the vector
        +
        +
        Parameters:
        +
        y - what the y value will be set to
        +
        +
      • +
      + + + +
        +
      • +

        getManitude

        +
        double getManitude()
        +
        Gets the magnitude of the vector
        +
        +
        Returns:
        +
        the magnitude of the vector
        +
        +
      • +
      + + + +
        +
      • +

        setMagnitude

        +
        void setMagnitude(double magnitude)
        +
        Sets the magnitude of the vector
        +
        +
        Parameters:
        +
        magnitude - what the magnitude will be set to
        +
        +
      • +
      + + + +
        +
      • +

        getAngle

        +
        Angle getAngle()
        +
        Gets the angle in standard position that the vector makes
        +
        +
        Returns:
        +
        the angle in standard position that the vector makes
        +
        +
      • +
      + + + +
        +
      • +

        setAngle

        +
        void setAngle(Angle angle)
        +
        Sets the angle in standard position of the vector
        +
        +
        Parameters:
        +
        angle - what the angle will be set to
        +
        +
      • +
      + + + +
        +
      • +

        add

        +
        Vector add(Vector vector)
        +
        Adds two vectors together and returns the result + +

        The result of a vector addition will be another vector, One way of adding two vectors + together is splitting it up into it's x and y components and adding them together and making + a new vector out of those components
        + EX:
        + V1 = 3i + 4j
        + V2 = 7i + 5j
        +
        + V1 + V2 = 3i + 7i + 4j + 5j = 10i + 9j
        + Geometric Visualization:
        + Vectors can also be added in a geometric way through the "Tip-To-Tail" method, In this method + both the vectors are drawn using arrow vector notation + https://en.wikipedia.org/wiki/Vector_notation one vector is then drawn at the + edge of the first vector. The resultant vector is then drawn from the start of the first + vector to the tip of the second vector This is where the name tip to tail comes from

        +
        +
        Parameters:
        +
        vector - The vector to be added
        +
        Returns:
        +
        The result of the two vectors being added
        +
        +
      • +
      + + + +
        +
      • +

        subtract

        +
        Vector subtract(Vector vector)
        +
        Subtracts a vector and returns the result + +

        vector subtraction is similar to vector addition but the direction of the vector being + subtracted is simply reversed
        + EX:
        + V1 = 3i + 4j
        + V2 = 7i + 5j
        +
        + V1 + V2 = 3i + 7i + 4j + 5j = 10i + 9j
        + V1 - V2 = 3i + (-7i) + 4j + (-5j) = -4i + -j

        +
        +
        Parameters:
        +
        vector - The vector to be subtracted
        +
        Returns:
        +
        The result of the passed in vector being subtracted from the vector object
        +
        +
      • +
      + + + +
        +
      • +

        scale

        +
        Vector scale(double scalar)
        +
        Scales the vectors magnitude by a scalar value
        +
        +
        Parameters:
        +
        scalar - double to scale the vector by
        +
        Returns:
        +
        The result of the vector being
        +
        +
      • +
      + + + +
        +
      • +

        cross

        +
        double cross(Vector vector)
        +
        Returns the product of two vectors that have been crossed + +

        The result of the cross product is a vector, The cross product of a vector is the vector + that is perpendicular to both vectors When crossing two 2dimensional vectors the result will + be a 3dimensional vector Because of this this method only returns the magnitude (Z component) + of the cross product The magnitude of the cross product is same as the area of the + parallelogram that the two vectors make in the X/Y plane.
        + https://en.wikipedia.org/wiki/Cross_product

        +
        +
        Parameters:
        +
        vector - the vector to be multiplied using the cross product
        +
        Returns:
        +
        the magnitude of the cross product of the two vectors
        +
        +
      • +
      + + + +
        +
      • +

        dot

        +
        double dot(Vector vector)
        +
        Returns the dot product of two vectors + +

        The result of the dot product is a scalar value (number), The dot product can be viewed as + the projection of one vector on to another times the magnitude of the original vector
        + This can be written mathematically as |A||B|cos(theta), where theta is the angle between A + and B Another mathematical representation of the dot product using its components is:
        + A = <a1, a2>
        + B = <b1, b2>
        + A . B = <a1*b1, a2*b2>
        + https://en.wikipedia.org/wiki/Dot_product

        +
        +
        Parameters:
        +
        vector - The vector to be multiplied using the dot product
        +
        Returns:
        +
        the scalar result of the dot of the two vectors
        +
        +
      • +
      + + + +
        +
      • +

        rotate

        +
        Vector rotate(Angle angle)
        +
        returns a vector rotated by a given angle
        +
        +
        Parameters:
        +
        angle - the angle that the vector is to be rotated by
        +
        Returns:
        +
        the result of the rotated vector
        +
        +
      • +
      + + + +
        +
      • +

        angleBetween

        +
        Angle angleBetween(Vector vector)
        +
        gets the angle between two vectors
        +
        +
        Parameters:
        +
        vector - the vector that will be used to find the angle between
        +
        Returns:
        +
        the angle between the vectors
        +
        +
      • +
      + + + +
        +
      • +

        normalize

        +
        Vector normalize()
        +
        Normalizes a vector and returns the result + +

        A normalized vector is a vector with magnitude 1. Normalized vectors are also called unit + vectors. A normalized vector keeps it's direction as well as the same proportions of its + components. When a vector is defined by its components it can be normalized it can be + expressed as
        + A = <a1, a2>
        + A' = <a1/|A|, a2/|A|>

        +
        +
        Returns:
        +
        the normalized vector
        +
        +
      • +
      + + + +
        +
      • +

        copy

        +
        Vector copy()
        +
        Creates a copy of the vector
        +
        +
        Returns:
        +
        a copy of the vector
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/vector/XY.html b/docs/javadoc/org/montclairrobotics/alloy/vector/XY.html new file mode 100644 index 0000000..920f9a4 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/vector/XY.html @@ -0,0 +1,750 @@ + + + + + +XY + + + + + + + + + + + + +
+
org.montclairrobotics.alloy.vector
+

Class XY

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.montclairrobotics.alloy.vector.XY
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Vector
    +
    +
    +
    +
    public class XY
    +extends java.lang.Object
    +implements Vector
    +
    Created by MHS Robotics on 11/14/2017. + +

    A vector can be defined in rectangular(XY), or polar form.
    + This class is implementation for vectors in XY form
    + It controls the conversions from rectangular to polar and vice versa + +

    https://en.wikipedia.org/wiki/Vector_notation

    +
    +
    Since:
    +
    0.1
    +
    See Also:
    +
    Vector
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      +
        +
      • + + +

        Fields inherited from interface org.montclairrobotics.alloy.vector.Vector

        +ZERO
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      XY(double x, + double y) 
      XY(XY vector) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      Vectoradd(Vector vector) +
      Adds two vectors together and returns the result
      +
      AngleangleBetween(Vector vector) +
      gets the angle between two vectors
      +
      Vectorcopy() +
      Creates a copy of the vector
      +
      doublecross(Vector vector) +
      Returns the product of two vectors that have been crossed
      +
      doubledot(Vector vector) +
      Returns the dot product of two vectors
      +
      AnglegetAngle() +
      Gets the angle in standard position that the vector makes
      +
      doublegetManitude() +
      Gets the magnitude of the vector
      +
      doublegetX() +
      Gets the X component of the vector
      +
      doublegetY() +
      Gets the Y component of the vector
      +
      Vectornormalize() +
      Normalizes a vector and returns the result
      +
      Vectorrotate(Angle angle) +
      returns a vector rotated by a given angle
      +
      Vectorscale(double scalar) +
      Scales the vectors magnitude by a scalar value
      +
      voidsetAngle(Angle angle) +
      Sets the angle in standard position of the vector
      +
      voidsetMagnitude(double magnitude) +
      Sets the magnitude of the vector
      +
      voidsetX(double x) +
      Sets the x component of the vector
      +
      voidsetY(double y) +
      Sets the y component of the vector
      +
      Vectorsubtract(Vector vector) +
      Subtracts a vector and returns the result
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        XY

        +
        public XY(double x,
        +          double y)
        +
      • +
      + + + +
        +
      • +

        XY

        +
        public XY(XY vector)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getX

        +
        public double getX()
        +
        Gets the X component of the vector
        +
        +
        Specified by:
        +
        getX in interface Vector
        +
        Returns:
        +
        the X component of the vector
        +
        +
      • +
      + + + +
        +
      • +

        setX

        +
        public void setX(double x)
        +
        Sets the x component of the vector
        +
        +
        Specified by:
        +
        setX in interface Vector
        +
        Parameters:
        +
        x - what the x value will be set to
        +
        +
      • +
      + + + +
        +
      • +

        getY

        +
        public double getY()
        +
        Gets the Y component of the vector
        +
        +
        Specified by:
        +
        getY in interface Vector
        +
        Returns:
        +
        the Y component of the vector
        +
        +
      • +
      + + + +
        +
      • +

        setY

        +
        public void setY(double y)
        +
        Sets the y component of the vector
        +
        +
        Specified by:
        +
        setY in interface Vector
        +
        Parameters:
        +
        y - what the y value will be set to
        +
        +
      • +
      + + + +
        +
      • +

        getManitude

        +
        public double getManitude()
        +
        Gets the magnitude of the vector
        +
        +
        Specified by:
        +
        getManitude in interface Vector
        +
        Returns:
        +
        the magnitude of the vector
        +
        +
      • +
      + + + +
        +
      • +

        setMagnitude

        +
        public void setMagnitude(double magnitude)
        +
        Sets the magnitude of the vector
        +
        +
        Specified by:
        +
        setMagnitude in interface Vector
        +
        Parameters:
        +
        magnitude - what the magnitude will be set to
        +
        +
      • +
      + + + +
        +
      • +

        getAngle

        +
        public Angle getAngle()
        +
        Gets the angle in standard position that the vector makes
        +
        +
        Specified by:
        +
        getAngle in interface Vector
        +
        Returns:
        +
        the angle in standard position that the vector makes
        +
        +
      • +
      + + + +
        +
      • +

        setAngle

        +
        public void setAngle(Angle angle)
        +
        Sets the angle in standard position of the vector
        +
        +
        Specified by:
        +
        setAngle in interface Vector
        +
        Parameters:
        +
        angle - what the angle will be set to
        +
        +
      • +
      + + + +
        +
      • +

        add

        +
        public Vector add(Vector vector)
        +
        Adds two vectors together and returns the result + +

        + +

        The result of a vector addition will be another vector, One way of adding two vectors + together is splitting it up into it's x and y components and adding them together and making + a new vector out of those components
        + EX:
        + V1 = 3i + 4j
        + V2 = 7i + 5j
        +
        + V1 + V2 = 3i + 7i + 4j + 5j = 10i + 9j
        + Geometric Visualization:
        + Vectors can also be added in a geometric way through the "Tip-To-Tail" method, In this method + both the vectors are drawn using arrow vector notation + https://en.wikipedia.org/wiki/Vector_notation one vector is then drawn at the + edge of the first vector. The resultant vector is then drawn from the start of the first + vector to the tip of the second vector This is where the name tip to tail comes from + +

        +
        +
        Specified by:
        +
        add in interface Vector
        +
        Parameters:
        +
        vector - The vector to be added
        +
        Returns:
        +
        The result of the two vectors being added
        +
        +
      • +
      + + + +
        +
      • +

        subtract

        +
        public Vector subtract(Vector vector)
        +
        Subtracts a vector and returns the result + +

        + +

        vector subtraction is similar to vector addition but the direction of the vector being + subtracted is simply reversed
        + EX:
        + V1 = 3i + 4j
        + V2 = 7i + 5j
        +
        + V1 + V2 = 3i + 7i + 4j + 5j = 10i + 9j
        + V1 - V2 = 3i + (-7i) + 4j + (-5j) = -4i + -j

        +
        +
        Specified by:
        +
        subtract in interface Vector
        +
        Parameters:
        +
        vector - The vector to be subtracted
        +
        Returns:
        +
        The result of the passed in vector being subtracted from the vector object
        +
        +
      • +
      + + + +
        +
      • +

        scale

        +
        public Vector scale(double scalar)
        +
        Scales the vectors magnitude by a scalar value
        +
        +
        Specified by:
        +
        scale in interface Vector
        +
        Parameters:
        +
        scalar - double to scale the vector by
        +
        Returns:
        +
        The result of the vector being
        +
        +
      • +
      + + + +
        +
      • +

        cross

        +
        public double cross(Vector vector)
        +
        Returns the product of two vectors that have been crossed + +

        + +

        The result of the cross product is a vector, The cross product of a vector is the vector + that is perpendicular to both vectors When crossing two 2dimensional vectors the result will + be a 3dimensional vector Because of this this method only returns the magnitude (Z component) + of the cross product The magnitude of the cross product is same as the area of the + parallelogram that the two vectors make in the X/Y plane.
        + https://en.wikipedia.org/wiki/Cross_product

        +
        +
        Specified by:
        +
        cross in interface Vector
        +
        Parameters:
        +
        vector - the vector to be multiplied using the cross product
        +
        Returns:
        +
        the magnitude of the cross product of the two vectors
        +
        +
      • +
      + + + +
        +
      • +

        dot

        +
        public double dot(Vector vector)
        +
        Returns the dot product of two vectors + +

        + +

        The result of the dot product is a scalar value (number), The dot product can be viewed as + the projection of one vector on to another times the magnitude of the original vector
        + This can be written mathematically as |A||B|cos(theta), where theta is the angle between A + and B Another mathematical representation of the dot product using its components is:
        + A = <a1, a2>
        + B = <b1, b2>
        + A . B = <a1*b1, a2*b2>
        + https://en.wikipedia.org/wiki/Dot_product

        +
        +
        Specified by:
        +
        dot in interface Vector
        +
        Parameters:
        +
        vector - The vector to be multiplied using the dot product
        +
        Returns:
        +
        the scalar result of the dot of the two vectors
        +
        +
      • +
      + + + +
        +
      • +

        rotate

        +
        public Vector rotate(Angle angle)
        +
        returns a vector rotated by a given angle
        +
        +
        Specified by:
        +
        rotate in interface Vector
        +
        Parameters:
        +
        angle - the angle that the vector is to be rotated by
        +
        Returns:
        +
        the result of the rotated vector
        +
        +
      • +
      + + + +
        +
      • +

        angleBetween

        +
        public Angle angleBetween(Vector vector)
        +
        gets the angle between two vectors
        +
        +
        Specified by:
        +
        angleBetween in interface Vector
        +
        Parameters:
        +
        vector - the vector that will be used to find the angle between
        +
        Returns:
        +
        the angle between the vectors
        +
        +
      • +
      + + + +
        +
      • +

        normalize

        +
        public Vector normalize()
        +
        Normalizes a vector and returns the result + +

        + +

        A normalized vector is a vector with magnitude 1. Normalized vectors are also called unit + vectors. A normalized vector keeps it's direction as well as the same proportions of its + components. When a vector is defined by its components it can be normalized it can be + expressed as
        + A = <a1, a2>
        + A' = <a1/|A|, a2/|A|>

        +
        +
        Specified by:
        +
        normalize in interface Vector
        +
        Returns:
        +
        the normalized vector
        +
        +
      • +
      + + + +
        +
      • +

        copy

        +
        public Vector copy()
        +
        Creates a copy of the vector
        +
        +
        Specified by:
        +
        copy in interface Vector
        +
        Returns:
        +
        a copy of the vector
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/vector/class-use/Angle.html b/docs/javadoc/org/montclairrobotics/alloy/vector/class-use/Angle.html new file mode 100644 index 0000000..00bf785 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/vector/class-use/Angle.html @@ -0,0 +1,328 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.vector.Angle + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.vector.Angle

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/vector/class-use/Polar.html b/docs/javadoc/org/montclairrobotics/alloy/vector/class-use/Polar.html new file mode 100644 index 0000000..9bebc4b --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/vector/class-use/Polar.html @@ -0,0 +1,124 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.vector.Polar + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.vector.Polar

+
+
No usage of org.montclairrobotics.alloy.vector.Polar
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/vector/class-use/Vector.html b/docs/javadoc/org/montclairrobotics/alloy/vector/class-use/Vector.html new file mode 100644 index 0000000..2f79751 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/vector/class-use/Vector.html @@ -0,0 +1,622 @@ + + + + + +Uses of Interface org.montclairrobotics.alloy.vector.Vector + + + + + + + + + + + +
+

Uses of Interface
org.montclairrobotics.alloy.vector.Vector

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/vector/class-use/XY.html b/docs/javadoc/org/montclairrobotics/alloy/vector/class-use/XY.html new file mode 100644 index 0000000..959498e --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/vector/class-use/XY.html @@ -0,0 +1,162 @@ + + + + + +Uses of Class org.montclairrobotics.alloy.vector.XY + + + + + + + + + + + +
+

Uses of Class
org.montclairrobotics.alloy.vector.XY

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/vector/package-frame.html b/docs/javadoc/org/montclairrobotics/alloy/vector/package-frame.html new file mode 100644 index 0000000..c39f240 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/vector/package-frame.html @@ -0,0 +1,26 @@ + + + + + +org.montclairrobotics.alloy.vector + + + + + +

org.montclairrobotics.alloy.vector

+
+

Interfaces

+ +

Classes

+ +
+ + diff --git a/docs/javadoc/org/montclairrobotics/alloy/vector/package-summary.html b/docs/javadoc/org/montclairrobotics/alloy/vector/package-summary.html new file mode 100644 index 0000000..6e12539 --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/vector/package-summary.html @@ -0,0 +1,171 @@ + + + + + +org.montclairrobotics.alloy.vector + + + + + + + + + + + +
+

Package org.montclairrobotics.alloy.vector

+
+
+
    +
  • + + + + + + + + + + + + +
    Interface Summary 
    InterfaceDescription
    Vector +
    Created by MHS Robotics on 11/14/2017.
    +
    +
  • +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    Angle +
    A class to keep track of angles
    +
    Polar +
    Created by MHS Robotics on 11/14/2017.
    +
    XY +
    Created by MHS Robotics on 11/14/2017.
    +
    +
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/vector/package-tree.html b/docs/javadoc/org/montclairrobotics/alloy/vector/package-tree.html new file mode 100644 index 0000000..ae9f9ba --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/vector/package-tree.html @@ -0,0 +1,141 @@ + + + + + +org.montclairrobotics.alloy.vector Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package org.montclairrobotics.alloy.vector

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • org.montclairrobotics.alloy.vector.Angle
    • +
    • org.montclairrobotics.alloy.vector.Polar (implements org.montclairrobotics.alloy.vector.Vector)
    • +
    • org.montclairrobotics.alloy.vector.XY (implements org.montclairrobotics.alloy.vector.Vector)
    • +
    +
  • +
+

Interface Hierarchy

+
    +
  • org.montclairrobotics.alloy.vector.Vector
  • +
+
+ + + + + + diff --git a/docs/javadoc/org/montclairrobotics/alloy/vector/package-use.html b/docs/javadoc/org/montclairrobotics/alloy/vector/package-use.html new file mode 100644 index 0000000..037d04d --- /dev/null +++ b/docs/javadoc/org/montclairrobotics/alloy/vector/package-use.html @@ -0,0 +1,300 @@ + + + + + +Uses of Package org.montclairrobotics.alloy.vector + + + + + + + + + + + +
+

Uses of Package
org.montclairrobotics.alloy.vector

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/overview-frame.html b/docs/javadoc/overview-frame.html new file mode 100644 index 0000000..36da9a1 --- /dev/null +++ b/docs/javadoc/overview-frame.html @@ -0,0 +1,34 @@ + + + + + +Overview List + + + + + + + +

 

+ + diff --git a/docs/javadoc/overview-summary.html b/docs/javadoc/overview-summary.html new file mode 100644 index 0000000..9536193 --- /dev/null +++ b/docs/javadoc/overview-summary.html @@ -0,0 +1,185 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
+ + + + +
+ + + + + + + +
+ + + + diff --git a/docs/javadoc/overview-tree.html b/docs/javadoc/overview-tree.html new file mode 100644 index 0000000..28912d3 --- /dev/null +++ b/docs/javadoc/overview-tree.html @@ -0,0 +1,292 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
+ + + +
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • org.montclairrobotics.alloy.vector.Angle
    • +
    • org.montclairrobotics.alloy.control.ButtonAction + +
    • +
    • org.montclairrobotics.alloy.utils.ConstantInput<T> (implements org.montclairrobotics.alloy.utils.Input<T>)
    • +
    • org.montclairrobotics.alloy.core.Debug
    • +
    • org.montclairrobotics.alloy.core.Debugger + +
    • +
    • org.montclairrobotics.alloy.motor.DefaultMapper (implements org.montclairrobotics.alloy.motor.Mapper<T>)
    • +
    • org.montclairrobotics.alloy.drive.DTInput
    • +
    • org.montclairrobotics.alloy.ftc.FTCButton (implements org.montclairrobotics.alloy.core.Button)
    • +
    • org.montclairrobotics.alloy.utils.Initializeable
    • +
    • org.montclairrobotics.alloy.test.IntakeMapper (implements org.montclairrobotics.alloy.motor.Mapper<T>)
    • +
    • org.montclairrobotics.alloy.utils.Monitor (implements org.montclairrobotics.alloy.utils.Input<T>)
    • +
    • com.qualcomm.robotcore.eventloop.opmode.OpMode + +
    • +
    • org.montclairrobotics.alloy.vector.Polar (implements org.montclairrobotics.alloy.vector.Vector)
    • +
    • org.montclairrobotics.alloy.core.RobotCore
    • +
    • org.montclairrobotics.alloy.auto.State +
        +
      • org.montclairrobotics.alloy.auto.States.ConditionalState
      • +
      • org.montclairrobotics.alloy.auto.States.Drive
      • +
      • org.montclairrobotics.alloy.auto.StateMachine
      • +
      • org.montclairrobotics.alloy.auto.States.Turn
      • +
      +
    • +
    • java.lang.Throwable (implements java.io.Serializable) + +
    • +
    • org.montclairrobotics.alloy.utils.Toggleable +
        +
      • org.montclairrobotics.alloy.utils.BooleanToggle (implements org.montclairrobotics.alloy.utils.Input<T>)
      • +
      • org.montclairrobotics.alloy.components.Component +
          +
        • org.montclairrobotics.alloy.ftc.FTCMotor (implements org.montclairrobotics.alloy.core.Motor) + +
        • +
        • org.montclairrobotics.alloy.components.InputComponent<T> (implements org.montclairrobotics.alloy.utils.Input<T>) + +
        • +
        • org.montclairrobotics.alloy.motor.MotorGroup<T> +
            +
          • org.montclairrobotics.alloy.drive.DriveTrain +
              +
            • org.montclairrobotics.alloy.drive.TankDrive
            • +
            +
          • +
          +
        • +
        • org.montclairrobotics.alloy.motor.MotorModule + +
        • +
        • org.montclairrobotics.alloy.drive.TankMapper (implements org.montclairrobotics.alloy.drive.DTMapper)
        • +
        +
      • +
      • org.montclairrobotics.alloy.steps.Deadzone (implements org.montclairrobotics.alloy.components.Step<T>)
      • +
      • org.montclairrobotics.alloy.steps.VectorDeadzone (implements org.montclairrobotics.alloy.components.Step<T>)
      • +
      +
    • +
    • org.montclairrobotics.alloy.update.Updateable
    • +
    • org.montclairrobotics.alloy.update.Updater
    • +
    • org.montclairrobotics.alloy.utils.Utils
    • +
    • org.montclairrobotics.alloy.vector.XY (implements org.montclairrobotics.alloy.vector.Vector)
    • +
    +
  • +
+

Interface Hierarchy

+
    +
  • org.montclairrobotics.alloy.core.Button
  • +
  • org.montclairrobotics.alloy.utils.ErrorCorrection<T>
  • +
  • org.montclairrobotics.alloy.utils.Input<T>
  • +
  • org.montclairrobotics.alloy.core.Joystick
  • +
  • org.montclairrobotics.alloy.motor.Mapper<T> +
      +
    • org.montclairrobotics.alloy.drive.DTMapper
    • +
    +
  • +
  • org.montclairrobotics.alloy.core.Motor + +
  • +
  • org.montclairrobotics.alloy.components.Step<T>
  • +
  • org.montclairrobotics.alloy.vector.Vector
  • +
+

Annotation Type Hierarchy

+
    +
  • org.montclairrobotics.alloy.update.Update (implements java.lang.annotation.Annotation)
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
+ + + + diff --git a/docs/javadoc/package-list b/docs/javadoc/package-list new file mode 100644 index 0000000..57a2ed3 --- /dev/null +++ b/docs/javadoc/package-list @@ -0,0 +1,14 @@ +org.montclairrobotics.alloy.auto +org.montclairrobotics.alloy.auto.States +org.montclairrobotics.alloy.components +org.montclairrobotics.alloy.control +org.montclairrobotics.alloy.core +org.montclairrobotics.alloy.drive +org.montclairrobotics.alloy.exceptions +org.montclairrobotics.alloy.ftc +org.montclairrobotics.alloy.motor +org.montclairrobotics.alloy.steps +org.montclairrobotics.alloy.test +org.montclairrobotics.alloy.update +org.montclairrobotics.alloy.utils +org.montclairrobotics.alloy.vector diff --git a/docs/javadoc/script.js b/docs/javadoc/script.js new file mode 100644 index 0000000..b346356 --- /dev/null +++ b/docs/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/docs/javadoc/serialized-form.html b/docs/javadoc/serialized-form.html new file mode 100644 index 0000000..e043575 --- /dev/null +++ b/docs/javadoc/serialized-form.html @@ -0,0 +1,140 @@ + + + + + +Serialized Form + + + + + + + + + + + +
+

Serialized Form

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/stylesheet.css b/docs/javadoc/stylesheet.css new file mode 100644 index 0000000..98055b2 --- /dev/null +++ b/docs/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/docs/readme.md b/docs/readme.md new file mode 100644 index 0000000..b9a0ee9 --- /dev/null +++ b/docs/readme.md @@ -0,0 +1,37 @@ +version: 0.0.1 + + +See the full documentation [Here](https://garrettburroughs.github.io/Alloy/javadoc/) + + +## What is alloy + +Alloy is a robot framework that redesigns how robot functionality is coded, allowing for more complex systems, while also abstracting +more advanced functionality allowing for easier implementation. + +The goal of Alloy is to provide a robot framework that allows anyone, including new programmers, to be able to implement +high functioning and quality code for their robots. In other terms, Alloy aims to prevent robot code from being a limiting +factor on the performance of the robot. + + +Alloy is a robot framework designed specifically for the First Tech Challenge (FTC), but is also designed +with expandibility in mind. FRC implementation is possible and will be coming in the future. + +Alloy is based off the FRC robot framework [Sprocket](https://github.com/MontclairRobotics/Sprocket), but redesigned to abstract away the more complex ideas but still allow for advanced robot functionality. + +Any information regarding Alloy, including how it works, project structure, as well as in-depth explanation on how to use all of the components +can be found in the project [Wiki](https://github.com/GarrettBurroughs/Alloy/wiki) as well as a [quick start guide](https://github.com/GarrettBurroughs/Alloy/wiki/Getting-Started). + +## Getting started + + + +## Essentials + + +## Wiki + +The Wiki contains a large amount of information, examples, +tutorials and explanations about creating a robot with alloy. It +is highly suggested reading it to get the most out of alloy as possible +[Wiki](https://github.com/GarrettBurroughs/Alloy/wiki) diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 99340b4..758de96 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2c2bbe5..2d80b69 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/gradlew.bat b/gradlew.bat index f955316..e95643d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,84 +1,84 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/src/main/java/org/montclairrobotics/alloy/auto/AlloyAutonomous.java b/src/main/java/org/montclairrobotics/alloy/auto/AlloyAutonomous.java index e0444fc..bacb5e9 100644 --- a/src/main/java/org/montclairrobotics/alloy/auto/AlloyAutonomous.java +++ b/src/main/java/org/montclairrobotics/alloy/auto/AlloyAutonomous.java @@ -1,22 +1,132 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.auto; import com.qualcomm.robotcore.eventloop.opmode.OpMode; +import com.qualcomm.robotcore.util.ElapsedTime; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Modifier; +import java.util.Set; +import org.montclairrobotics.alloy.core.Alloy; +import org.montclairrobotics.alloy.core.RobotCore; +import org.reflections.Reflections; +import org.reflections.scanners.SubTypesScanner; /** * Created by MHS Robotics on 12/5/2017. * + * AlloyAutonomous is the core framework for coding auto modes + * When an auto mode extends AlloyAutonomous, it needs to override + * the setup() method, and has the option of overriding the userLoop() + * method. In the setup method, auto needs to be set to a + * state machine, that will be run during the auto mode + * + * The optional userLoop() method can be used to update or perform + * actions every loop, it is called before the state in the state machine + * * @author Garrett Burroughs + * @version 0.1 + * @since 0.1 */ -public abstract class AlloyAutonomous extends OpMode{ - - +public abstract class AlloyAutonomous extends OpMode { + + /** Keeps track of when the auto mode is running (True after started and before finished) */ + boolean running; + + /** The actual auto mode that should be instantiated in setup */ + public StateMachine auto; + + /** A timer to keep track of time in the autoMode */ + public ElapsedTime timer; + + /** + * This is where the user should define all their code and where "Auto", should be instantiated + */ + public abstract void setup(); + + /** + * Runs when the play button is pressed Start will set up everything that the auto mode needs to + * run + */ + @Override + public void start() { + auto.start(); // run the start method of the state machine + running = true; // the state machine has started running + timer.reset(); // reset the timer + } + + /** + * Init is called when the INIT button is pressed on the drivers station. The init method takes + * care of setting up global robot variables and running the user setup method + */ @Override public void init() { + Reflections reflections = new Reflections(new SubTypesScanner()); + Set> robots = reflections.getSubTypesOf(Alloy.class); + for (Class robot : robots) { + try { + if (!Modifier.isAbstract(robot.getMethod("robotSetup").getModifiers()) + || robot.getMethod("robotSetup") == null) { + robot.getMethod("robotSetup").invoke(robot.newInstance()); + } + } catch (NoSuchMethodException + | IllegalAccessException + | InstantiationException + | InvocationTargetException e) { + e.printStackTrace(); + } + } + new RobotCore(telemetry, hardwareMap, gamepad1, gamepad2); + setup(); } + /** + * The user loop can be overridden in the auto mode and is called every loop before the state is + * run. This can be useful for updating information used in states. + */ + public void userLoop() {} + + /** the Loop method takes care of running the state machine */ @Override public void loop() { + userLoop(); + if (running) { + auto.run(); // Run the state machine, which will in turn run the states + } + if (auto.isDone()) { // check if the state machine has finished (Last state achieved) + running = false; // stop the state machine + auto.stop(); // Finally stop the state machine + } + } + /** + * A wrapper around the add state method to allow the user to add states to the auto mode + * + * @param state the state to be added + */ + public void newState(State state) { + auto.addState(state); } } diff --git a/src/main/java/org/montclairrobotics/alloy/auto/README.md b/src/main/java/org/montclairrobotics/alloy/auto/README.md index 41048d5..c6c4e6c 100644 --- a/src/main/java/org/montclairrobotics/alloy/auto/README.md +++ b/src/main/java/org/montclairrobotics/alloy/auto/README.md @@ -6,7 +6,7 @@ can be found in the auto package. ## Contents -1. State Machine - A state machine is an object that takes in a number of states and then runs them, states can be ran
+1. State Machine - A state machine is an object that takes in a number of states and then runs them, states can be ran
in a linear fashion by default, but can have more fine tuned control by the user. State machines can also be used outside
of auto modes to run states in teleop. State machines are also states themselves so a state machine can run another state machine @@ -16,4 +16,7 @@ when they have finished running 3. Alloy Autonomus - This is the basic framework for alloy auto's. An alloy autonomous takes care of running the state machine
that the auto is using so all the user has to do is create the state machine and define functionality. -You can read more about how to use an Alloy Autonomous [Here](https://github.com/GarrettBurroughs/Alloy/wiki/Creating-An-Auto-Mode) \ No newline at end of file +You can read more about how to use an Alloy Autonomous [Here](https://github.com/GarrettBurroughs/Alloy/wiki/Creating-An-Auto-Mode) + +4. Simple Autonomous - A simple autonomous mode further abstracts away auto mode creation allowing +for command like auto mode programming. You can read more about how to use a Simple autonomous [Here](https://github.com/GarrettBurroughs/Alloy/wiki/Creating-An-Auto-Mode) diff --git a/src/main/java/org/montclairrobotics/alloy/auto/SimpleAutonomous.java b/src/main/java/org/montclairrobotics/alloy/auto/SimpleAutonomous.java new file mode 100644 index 0000000..f47ba4f --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/auto/SimpleAutonomous.java @@ -0,0 +1,62 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.auto; + +import org.montclairrobotics.alloy.auto.States.ConditionalState; +import org.montclairrobotics.alloy.auto.States.Drive; +import org.montclairrobotics.alloy.auto.States.Turn; +import org.montclairrobotics.alloy.utils.Input; +import org.montclairrobotics.alloy.vector.Angle; + +/** + * Created by MHS Robotics on 1/26/2018. + * + *

SimpleAutonomous abstracts away the concept of adding states to a state machine, so that + * states can be added as if they were commands to be executed by the auto mode. This class only has + * the pre-written states included, so another class extending this one would need to be created to + * add any custom states + * + * @author Garrett Burroughs + * @since + */ +public class SimpleAutonomous extends AlloyAutonomous { + @Override + public void setup() {} + + public void drive(double speed, double distance) { + addState(new Drive(speed, distance)); + } + + public void turn(double speed, Angle angle) { + addState(new Turn(speed, angle)); + } + + public void contition(Input condition, State state) { + addState(new ConditionalState(condition, state)); + } + + public void addState(State state) { + auto.addState(state); + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/auto/State.java b/src/main/java/org/montclairrobotics/alloy/auto/State.java index ebb5b45..d19ef5f 100644 --- a/src/main/java/org/montclairrobotics/alloy/auto/State.java +++ b/src/main/java/org/montclairrobotics/alloy/auto/State.java @@ -1,46 +1,89 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.auto; /** * Created by MHS Robotics on 12/16/2017. * - * States are designed to be passed in and run in a state machine. States can be used for + *

States are designed to be passed in and run in a state machine. States can be used for * Autonomous modes as well as autonomously doing actions in teleop. + * * @see StateMachine * @see AlloyAutonomous - * * @author Garrett Burroughs * @since 0.1 * @version 0.1 */ public abstract class State { - Integer nextState = null; + private Integer nextState = null; + protected String debug = "Running State: "; + protected String description = "None"; - /** - * The start method is the first thing called when the state is run - */ + /** The start method is the first thing called when the state is run */ public abstract void start(); - /** - * The run method is called every loop while the state is running - */ + /** The run method is called every loop while the state is running */ public abstract void run(); - /** - * The Stop method is the last thing called once the state is done - */ + /** The Stop method is the last thing called once the state is done */ public abstract void stop(); /** * IsDone should return true when the state is finished + * * @return true if the state is done */ public abstract boolean isDone(); - public int getNextState(int currentState){ - if(nextState != null){ + /** + * In order to have a non linear state machine, the state machine must know what state to go to + * when it is done with the previous state. The state also sometimes needs to know the current + * state for example if it just wanted to increment the state by one. + * + * @param currentState the state the state machine is currently running + * @return the state the state machine should go to + */ + public int getNextState(int currentState) { + if (nextState != null) { return nextState; } return currentState + 1; } + + /** + * When a state machine is running, it will debug out information about the state it is running. + * It will debug the result of debugInfo + * + * @param currentState the current state so that it can be used in the debug + * @return debug information about the state + */ + public String debugInfo(int currentState) { + return debug + currentState; + } + + public String verboseDebug() { + return description; + } } diff --git a/src/main/java/org/montclairrobotics/alloy/auto/StateMachine.java b/src/main/java/org/montclairrobotics/alloy/auto/StateMachine.java index 7fdbdc1..1472f4d 100644 --- a/src/main/java/org/montclairrobotics/alloy/auto/StateMachine.java +++ b/src/main/java/org/montclairrobotics/alloy/auto/StateMachine.java @@ -1,62 +1,189 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.auto; +import com.qualcomm.robotcore.util.ElapsedTime; import java.util.ArrayList; +import java.util.Arrays; +import org.montclairrobotics.alloy.components.Component; /** * Created by MHS Robotics on 12/16/2017. * - * A state machine takes in states and runs them in a controlled order.
- * By default the states will run in a linear fashion and the next state will start - * when the previous state has finished.
- *
- * State machines can be used for controlling auto modes, - * but can also be ran in teleop modes for pre coded instructions that make driving easier. + *

A state machine takes in states and runs them in a controlled order.
+ * By default the states will run in a linear fashion and the next state will start when the + * previous state has finished.
+ *
+ * State machines can be used for controlling auto modes, but can also be ran in teleop modes for + * pre coded instructions that make driving easier. * + *

State machines are also states themselves so a state machine can run another state machine. + * This allows for the reuse of auto code * * @author Garrett Burroughs - * @since + * @since 0.1 + * @version 0.1 */ public class StateMachine extends State { + /** The states list keeps track of all of the states that will be run in the state machine */ ArrayList states; - /** - * Since state machines can run in a non linear fashion, the last state in the array - * may not be the last state in the state machine, finalState keeps track of what signifies the end - * of the state machine. The final state should not be in reference to an actual state, but a number that - * is outside the index of the state machine.
- * For example, if a state machine had 5 states in it, a valid final state would could be 6, and to end the state - * machine, you would simply have the last state you want to run, go to state 6 once it is done.
- * Note: even if your state machine is running in a linear fashion, it needs to have a final state. + * Since state machines can run in a non linear fashion, the last state in the array may not be + * the last state in the state machine, finalState keeps track of what signifies the end of the + * state machine. The final state should not be in reference to an actual state, but a number + * that is outside the index of the state machine.
+ * For example, if a state machine had 5 states in it, a valid final state would could be 6, and + * to end the state machine, you would simply have the last state you want to run, go to state 6 + * once it is done.
+ * Note: even if your state machine is running in a linear fashion, it needs to have a final + * state. */ Integer finalState; - public StateMachine(State ... states){ + /** The name of the state machine, this is purely for debugging purposes */ + String name; + + /** + * A boolean that keeps track of weather or not the current state has been run yet, this is used + * to determine it the start() method of the state should be run + */ + boolean stateStarted; + + /** the time spent in the state that has most recently finished */ + double timeInLastState; + + /** A timer object to keep track of the time in states. */ + private ElapsedTime timer; + + /** Keeps track of weather or not the state machine has finished, True if it has */ + boolean done = false; + + /** Keeps track of the current state */ + int state; + + public StateMachine(String name, int finalState, State... states) { + this.name = name; + this.states = new ArrayList<>(Arrays.asList(states)); + this.finalState = finalState; + description = ""; + } + + public StateMachine(State... states) { + this("State Machine", 0, states); + } + + public StateMachine(String name, String description, int finalState, State... states) { + this(name, finalState, states); + super.description = description; + } + + public void setFinalState(Integer finalState) { + this.finalState = finalState; + } + public void setName(String name) { + this.name = name; } + /** Read out that the state has started and reset the timer */ @Override public void start() { - + Component.debugger.driverInfo("Running", name); + timer.reset(); } + /** The run method takes care of actually running the states */ @Override public void run() { + State currentState = states.get(state); + + //Check If the state has started, if it hasn't run the 'start()' method + if (!stateStarted) { + timer.reset(); + currentState.start(); + stateStarted = true; // State has been started + } + currentState.run(); //run the state + + if (currentState.isDone()) { //check if the state has finished + timeInLastState = timer.nanoseconds(); // Update the last state time + currentState.stop(); // Run the stop() method on the state + if (currentState.getNextState(state) + == finalState) { // Check if the state machine is done + done = true; // set the state machine as done + return; // return (exit) out of the run() method + } + if (currentState.getNextState(state) + < states.size()) { // make sure there is a next state to go to + state = currentState.getNextState(state); // go to the next state + } else { + Component.debugger.error( + "STATE MACHINE OUT OF BOUNDS"); // Give the user an error if there is no next state to go to + done = true; // stop the state machine + return; // exit the run method to ensure nothing else runs + } + stateStarted = false; // The next state has not started yet. + } + Component.debugger.test(name + " | State: ", state); // Debug info about the state + Component.debugger.debug(currentState.debugInfo(state), currentState.verboseDebug()); } + /** When the state machine is finished, read out it has finished */ @Override public void stop() { - + Component.debugger.test("Status", name + ", Finished "); } + /** + * determine if the state machine is done + * + * @return true if the state machine is done + */ @Override public boolean isDone() { - return false; + return done; } - public void addState(State state){ + /** + * Adds a state to the state machine. States can be added to a state machine but should not be + * added after the state machine + * + * @param state state that will be added to the state machine + */ + public void addState(State state) { states.add(state); } + + /** + * Gets the time in the most recently completed state + * + * @return The time in last state + */ + public double getTimeInLastState() { + return timeInLastState; + } } diff --git a/src/main/java/org/montclairrobotics/alloy/auto/States/ConditionalState.java b/src/main/java/org/montclairrobotics/alloy/auto/States/ConditionalState.java new file mode 100644 index 0000000..d92e0a4 --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/auto/States/ConditionalState.java @@ -0,0 +1,80 @@ +/* +MIT License + +Copyright (c) 2019 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.auto.States; + +import org.montclairrobotics.alloy.auto.State; +import org.montclairrobotics.alloy.utils.Input; + +/** + * A conditional state runs a state if the condition is true + * + *

A conditional state takes in a boolean input, and evaluates it when the state starts. If the + * input is true when the state starts, the passed in state will execute. + */ +public class ConditionalState extends State { + /** The boolean input that will determine if the state is run */ + Input condition; + + /** The state that will be run, if the input is true */ + State state; + + /** A variable to keep track whether or not the state should be run */ + boolean run; + + public ConditionalState(Input condition, State state) { + this.condition = condition; + this.state = state; + } + + @Override + public void start() { + run = condition.get(); // Evaluate the condition + if (run) { + state.start(); + } + } + + @Override + public void run() { + if (run) { + state.run(); + } + } + + @Override + public void stop() { + if (run) { + state.stop(); + } + } + + @Override + public boolean isDone() { + if (run) { + return state.isDone(); + } else { + return true; + } + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/auto/States/Drive.java b/src/main/java/org/montclairrobotics/alloy/auto/States/Drive.java new file mode 100644 index 0000000..9d0e114 --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/auto/States/Drive.java @@ -0,0 +1,90 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.auto.States; + +import org.montclairrobotics.alloy.auto.State; +import org.montclairrobotics.alloy.core.Alloy; +import org.montclairrobotics.alloy.drive.DTInput; +import org.montclairrobotics.alloy.drive.DriveTrain; +import org.montclairrobotics.alloy.utils.ConstantInput; +import org.montclairrobotics.alloy.vector.Angle; +import org.montclairrobotics.alloy.vector.Polar; +import org.montclairrobotics.alloy.vector.Vector; + +/** + * Created by MHS Robotics on 1/26/2018. + * + * @author Garrett Burroughs + * @since + */ +public class Drive extends State { + + DriveTrain driveTrain; + private double speed; + private double distance; + private int[] startValues; + private static int tolerance = 5; + + public static void setTolerance(int tolerance) { + Drive.tolerance = tolerance; + } + + public Drive(double speed, double distance) { + driveTrain = Alloy.getDriveTrain(); + this.speed = speed; + this.distance = distance; + } + + public Drive setDriveTrain(DriveTrain driveTrain) { + this.driveTrain = driveTrain; + return this; + } + + @Override + public void start() { + startValues = driveTrain.getEncoderValues(); + } + + @Override + public void run() { + driveTrain.setInput( + new ConstantInput(new DTInput(new Polar(speed, Angle.ZERO), Angle.ZERO))); + } + + @Override + public void stop() { + driveTrain.setInput(new ConstantInput(new DTInput(Vector.ZERO, Angle.ZERO))); + } + + @Override + public boolean isDone() { + int[] currentValues = driveTrain.getEncoderValues(); + double total = 0; + for (int i = 0; i < startValues.length; i++) { + total += currentValues[i] - startValues[i]; + } + double average = total / (double) currentValues.length; + return Math.abs(distance - average) < tolerance; + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/auto/States/Turn.java b/src/main/java/org/montclairrobotics/alloy/auto/States/Turn.java new file mode 100644 index 0000000..748a5ce --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/auto/States/Turn.java @@ -0,0 +1,106 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.auto.States; + +import org.montclairrobotics.alloy.auto.State; +import org.montclairrobotics.alloy.core.Alloy; +import org.montclairrobotics.alloy.drive.DTInput; +import org.montclairrobotics.alloy.drive.DriveTrain; +import org.montclairrobotics.alloy.utils.ConstantInput; +import org.montclairrobotics.alloy.vector.Angle; +import org.montclairrobotics.alloy.vector.Vector; + +/** + * Created by MHS Robotics on 1/26/2018. + * + * @author Garrett Burroughs + * @since 0.1 + */ +public class Turn extends State { + + private double speed; + private double degrees; + private int[] rightSideStartValues; + private int[] leftSideStartValues; + private DriveTrain driveTrain; + + private static double ticksPerDegree = 1; + + public static void setTicksPerDegree(double ticksPerDegree) { + Turn.ticksPerDegree = ticksPerDegree; + } + + private static double tolerance = 5; + + public static void setTolerance(double tolerance) { + Turn.tolerance = tolerance; + } + + public Turn(double speed, Angle angle) { + this.speed = speed; + this.degrees = angle.getDegrees(); + driveTrain = Alloy.getDriveTrain(); + } + + @Override + public void start() { + rightSideStartValues = Alloy.getDriveTrain().getRightEncoderValues(); + leftSideStartValues = Alloy.getDriveTrain().getLeftEncoderValues(); + } + + @Override + public void run() { + if (degrees > 0) { + driveTrain.setInput( + new ConstantInput(new DTInput(Vector.ZERO, new Angle(speed)))); + } else { + driveTrain.setInput( + new ConstantInput(new DTInput(Vector.ZERO, new Angle(-speed)))); + } + } + + @Override + public void stop() { + driveTrain.setInput(new ConstantInput(new DTInput(Vector.ZERO, Angle.ZERO))); + } + + @Override + public boolean isDone() { + int rightTicks = 0; + int[] currentRight = driveTrain.getRightEncoderValues(); + for (int i = 0; i < rightSideStartValues.length; i++) { + rightTicks += Math.abs(currentRight[i] - rightSideStartValues[i]); + } + + int leftTicks = 0; + int[] currentLeft = driveTrain.getLeftEncoderValues(); + for (int i = 0; i < leftSideStartValues.length; i++) { + leftTicks += Math.abs(currentLeft[i] - leftSideStartValues[i]); + } + + int ticksMoved = rightTicks + leftTicks; + + return Math.abs(ticksMoved - degrees * ticksPerDegree) < tolerance; + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/components/Action.java b/src/main/java/org/montclairrobotics/alloy/components/Action.java deleted file mode 100644 index 58272be..0000000 --- a/src/main/java/org/montclairrobotics/alloy/components/Action.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.montclairrobotics.alloy.components; - -public interface Action{ - public void start(); - public void enabled(); - public void stop(); - public void disabled(); -} diff --git a/src/main/java/org/montclairrobotics/alloy/components/Component.java b/src/main/java/org/montclairrobotics/alloy/components/Component.java index 761b82d..37d6356 100644 --- a/src/main/java/org/montclairrobotics/alloy/components/Component.java +++ b/src/main/java/org/montclairrobotics/alloy/components/Component.java @@ -1,45 +1,127 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.components; +import java.util.ArrayList; import org.montclairrobotics.alloy.core.Debug; import org.montclairrobotics.alloy.core.Debugger; import org.montclairrobotics.alloy.update.Update; import org.montclairrobotics.alloy.utils.Toggleable; -import java.util.ArrayList; +/** + * The main component class that all components of alloy should extend + * + *

Alloy is built of a system of components that all work together to operate a robot Components + * can be broken down into 2 simple parts
+ * -Physical Component
+ * -Input Component
+ * + *

A physical component would include any part, feature, or function that is physically on the + * robot This can include things like motors, manipulators shooters, drivetrain, etc. + * + *

An input component is more control based and includes things like buttons, joysticks, + * triggers, sensors, flow camera, optical control and anything else that would send an input to a + * physical component + * + *

All components have the ability to be toggled on and off as well as built in debug capability + * for easier testing and debugging of specific components. + * + *

There is also a static list of all components that are created so that the updater can + * reference them. This means that you can have a method in a component be updated just by adding + * the @Update annotation + * + * @see InputComponent + * @author Garrett Burroughs + * @version 0.1 + * @since 0.1 + */ +public abstract class Component extends Toggleable { + /** The object used for debugging information about all components */ + public static Debugger debugger; -public abstract class Component extends Toggleable{ + /** Will debug out information if true */ + private boolean debugMode = true; - public static Debugger debugger; + /** The debugs that will be printed for this component out each loop */ + private ArrayList debugs; - // All components are added to the component arraylist so they can be updated + /** a static reference of all the components that are made */ public static ArrayList components; public Component() { components.add(this); } - public static ArrayList getComponents(){ + public static ArrayList getComponents() { return components; } - private ArrayList debugs; - - public void addDebug(Debug debug){ + /** + * Adds a debug to the component, this will be debugged out every loop if debug mode is enabled + */ + public void addDebug(Debug debug) { debugs.add(debug); } - public void addDebugs(Iterable debugs){ - for(Debug debug : debugs){ + /** + * Adds multiple debugs to the components, they will be debugged out every loop if debug mode is + * enabled + */ + public void addDebugs(Iterable debugs) { + for (Debug debug : debugs) { this.debugs.add(debug); } } + /** Enabled debug mode, causing any debugs added to the component to be debugged out */ + public void enableDebug() { + debugMode = false; + } + + /** Disabled debug mode, stopping all debugs */ + public void disableDebug() { + debugMode = true; + } + @Update - public void debug(){ - if(status.booleanValue()) { + public void debug() { + if (status.isEnabled() && debugMode) { for (Debug debug : debugs) { debugger.debug(debug); } } } + + /** The action that is taken when the component is enabled should be overridden bu the user */ + @Override + public void enableAction() { + // Called when enabled + } + + /** The action that is taken when the component is disabled, should be overridden by the user */ + @Override + public void disableAction() { + // Called when disabled + } } diff --git a/src/main/java/org/montclairrobotics/alloy/components/InputComponent.java b/src/main/java/org/montclairrobotics/alloy/components/InputComponent.java index 7d11ec4..2ac87ef 100644 --- a/src/main/java/org/montclairrobotics/alloy/components/InputComponent.java +++ b/src/main/java/org/montclairrobotics/alloy/components/InputComponent.java @@ -1,14 +1,57 @@ -package org.montclairrobotics.alloy.components; +/* +MIT License -import org.montclairrobotics.alloy.utils.Input; +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.components; import java.util.ArrayList; +import org.montclairrobotics.alloy.utils.Input; -public abstract class InputComponent extends Component implements Input{ +/** + * An input component is an extension of a regular component, used for input and control systems + * + *

Input components take in a standard input, and have the ability to manipulate them using a + * number of steps that can be added. Steps take in the input, perform some sort of manipulation or + * calculation and then return the new value. Steps are applied in order of them being added, and + * the output of one step gets passed in as the input of the next step. The steps are only applied + * if the applySteps() method is called + * + *

Input components can also be enabled, or disabled just like regular components, and will + * return their calculated value as a regular input + * + * @param the type of the input + * @author Garrett Burroughs + * @version 0.1 + * @since 0.1 + */ +public abstract class InputComponent extends Component implements Input { + /** The initial input value */ public Input input; + + /** The value after steps have been applied */ public T output; + /** An arraylist to store all of the steps */ public ArrayList> steps = new ArrayList<>(); @Override @@ -16,18 +59,31 @@ public T get() { return output; } - public void applySteps(){ + /** + * Apply all of the steps, in order, taking the output of one step and passing it as the input + * to the next + */ + public void applySteps() { // Start off with the input T calculation = input.get(); // Apply steps - for(Step step : steps){ + for (Step step : steps) { calculation = step.getOutput(calculation); } // Set the output output = calculation; } - public void setInput(Input input){ + /** A daisy-chainable method that adds a step to the input component */ + public InputComponent addStep(Step s) { + // addDebug(new Debug(), ); + steps.add(s); + return this; + } + + /** A daisy-chainable method that sets the initial input of the input component */ + public InputComponent setInput(Input input) { this.input = input; + return this; } } diff --git a/src/main/java/org/montclairrobotics/alloy/components/MotorComponent.java b/src/main/java/org/montclairrobotics/alloy/components/MotorComponent.java deleted file mode 100644 index 4c6dba2..0000000 --- a/src/main/java/org/montclairrobotics/alloy/components/MotorComponent.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.montclairrobotics.alloy.components; - -import org.montclairrobotics.alloy.core.PoweredMotor; - -/** - * Created by MHS Robotics on 3/12/2018. - * - * @author Garrett Burroughs - * @since - */ -public class MotorComponent extends Component{ - - PoweredMotor motor; - - /** - * Method to be called when the toggleable is enabled - */ - @Override - public void enableAction() { - - } - - /** - * Method to be called when the toggleable is disabled - */ - @Override - public void disableAction() { - - } -} diff --git a/src/main/java/org/montclairrobotics/alloy/components/Step.java b/src/main/java/org/montclairrobotics/alloy/components/Step.java index d51f275..93169c8 100644 --- a/src/main/java/org/montclairrobotics/alloy/components/Step.java +++ b/src/main/java/org/montclairrobotics/alloy/components/Step.java @@ -1,5 +1,40 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.components; +/** + * A step is a manipulation or calculation performed on an input + * + *

When used in conjunction with an InputComponent, the steps will be applied in order, passing + * in the output of one step, into the input of the next step. + * + * @param the type that the step will be manipulating + * @author Garrett Burroughs + * @version 0.1 + * @since 0.1 + */ public interface Step { + /** The operation to be performed on the input, to get the output */ public T getOutput(T input); } diff --git a/src/main/java/org/montclairrobotics/alloy/control/ButtonAction.java b/src/main/java/org/montclairrobotics/alloy/control/ButtonAction.java index 4a82752..b7350de 100644 --- a/src/main/java/org/montclairrobotics/alloy/control/ButtonAction.java +++ b/src/main/java/org/montclairrobotics/alloy/control/ButtonAction.java @@ -1,65 +1,84 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.control; import org.montclairrobotics.alloy.core.Button; -import org.montclairrobotics.alloy.update.Updatable; import org.montclairrobotics.alloy.update.Update; -import org.montclairrobotics.alloy.update.Updater; /** - * Created by MHS Robotics on 2/11/2018. - * - * Every Button action is tied to a button, and controls what - * happens when the button is pressed, held, unpressed, and released + * Every Button action is tied to a button, and controls what happens when the button is pressed, + * held, unpressed, and released * * @author Garrett Burroughs + * @version 0.1 * @since 0.1 */ -public abstract class ButtonAction { - +public abstract class ButtonAction { + /** The button that controls the action */ public Button button; - - public ButtonAction(Button button){ - this.button = button; - } - - + /** - * On pressed is called once, when the button goes from being unpressed, to pressed + * Keeps track of if the button was pressed in the previous loop, used for telling when the + * button is pressed/unpressed */ + public boolean wasPressed = false; + + /** Creates a button action tied to a button */ + public ButtonAction(Button button) { + this.button = button; + } + + /** On pressed is called once, when the button goes from being unpressed, to pressed */ public abstract void onPressed(); - - /** - * On released is called once, when the button goes from being pressed, to unpressed - */ + + /** On released is called once, when the button goes from being pressed, to unpressed */ public abstract void onReleased(); - - /** - * While pressed is called every loop while the button is pressed - */ + + /** While pressed is called every loop while the button is pressed */ public abstract void whilePressed(); - - /** - * While released is called every loop while the button is unpressed - */ + + /** While released is called every loop while the button is unpressed */ public abstract void whileReleased(); - - public boolean wasPressed = false; - + @Update public void update() { - if(button.getValue()){ + if (button.getValue()) { // If the button is pressed, call whilePressed() whilePressed(); - }else{ + } else { // If the button is not pressed call whileReleased() whileReleased(); } - if(wasPressed && !button.getValue()){ + if (wasPressed + && !button + .getValue()) { // If the button was just pressed, but is no longer pressed, call onReleased() onReleased(); } - if(!wasPressed && button.getValue()){ + if (!wasPressed + && button + .getValue()) { // If the button was just not pressed, but is now pressed, call onPressed() onPressed(); } - - + wasPressed = button.getValue(); } } diff --git a/src/main/java/org/montclairrobotics/alloy/control/README.md b/src/main/java/org/montclairrobotics/alloy/control/README.md index f643833..828c0d0 100644 --- a/src/main/java/org/montclairrobotics/alloy/control/README.md +++ b/src/main/java/org/montclairrobotics/alloy/control/README.md @@ -1,13 +1,13 @@ # Control -The control package contains all of the classes that deal with the control features of the robot. +The control package contains all of the classes that deal with the control features of the robot. This is mostly includes the human to robot interaction as well as tools that help the user -control the robot. This package does not however, contain any autonomous robot control, that can be found +control the robot. This package does not however, contain any autonomous robot control, that can be found in the "auto" package -## Contents +## Contents -1. Button Action - Button actions are the way that functionality can be tied to buttons in alloy. A button action can +1. Button Action - Button actions are the way that functionality can be tied to buttons in alloy. A button action can have functionality defined for when a button is pressed, released, held, and un-held -2. Toggle Button - A toggle button is a button that is tied to a toggleable, they toggle the toggleable when the button +2. Toggle Button - A toggle button is a button that is tied to a toggleable, they toggle the toggleable when the button is pressed diff --git a/src/main/java/org/montclairrobotics/alloy/control/ToggleButton.java b/src/main/java/org/montclairrobotics/alloy/control/ToggleButton.java index a85371d..1afebe0 100644 --- a/src/main/java/org/montclairrobotics/alloy/control/ToggleButton.java +++ b/src/main/java/org/montclairrobotics/alloy/control/ToggleButton.java @@ -1,58 +1,70 @@ -package org.montclairrobotics.alloy.control; +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.control; import org.montclairrobotics.alloy.core.Button; import org.montclairrobotics.alloy.utils.Toggleable; /** - * Created by MHS Robotics on 2/11/2018. + * A ToggleButton is tied to a button and a toggleable, when the button is pressed the toggleable + * will toggle between states * - * A ToggleButton is tied to a button and a toggleable, - * when the button is pressed the toggleable will - * toggle between states * @see Toggleable * @see ButtonAction - * * @author Garrett Burroughs + * @version 0.1 * @since 0.1 */ -public class ToggleButton extends ButtonAction{ - Toggleable toggleable; - +public class ToggleButton extends ButtonAction { + private Toggleable toggleable; + public ToggleButton(Button button, Toggleable toggleable) { super(button); this.toggleable = toggleable; } - - /** - * On pressed is called once, when the button goes from being unpressed, to pressed - */ + + /** On pressed is called once, when the button goes from being unpressed, to pressed */ @Override public void onPressed() { toggleable.toggle(); } - - /** - * On released is called once, when the button goes from being pressed, to unpressed - */ + + /** On released is called once, when the button goes from being pressed, to unpressed */ @Override public void onReleased() { - + // Will be run right after the button is released } - - /** - * While pressed is called every loop while the button is pressed - */ + + /** While pressed is called every loop while the button is pressed */ @Override public void whilePressed() { - + // Will be run while the button is held } - - /** - * While released is called every loop while the button is unpressed - */ + + /** While released is called every loop while the button is unpressed */ @Override public void whileReleased() { - + // Wil be run while the button is unpressed } } diff --git a/src/main/java/org/montclairrobotics/alloy/core/Alloy.java b/src/main/java/org/montclairrobotics/alloy/core/Alloy.java index 7fc7eb8..1ec9c93 100644 --- a/src/main/java/org/montclairrobotics/alloy/core/Alloy.java +++ b/src/main/java/org/montclairrobotics/alloy/core/Alloy.java @@ -1,60 +1,101 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.core; import com.qualcomm.robotcore.eventloop.opmode.OpMode; +import java.util.ArrayList; import org.montclairrobotics.alloy.components.Component; +import org.montclairrobotics.alloy.drive.DriveTrain; import org.montclairrobotics.alloy.ftc.FTCDebugger; import org.montclairrobotics.alloy.update.Updater; +import org.montclairrobotics.alloy.utils.Initializeable; /** - * Created by MHS Robotics on 11/13/2017. + * The main class that takes care of setting up the environment, and running all of the main methods * - * The main purpose behind the alloy class is to controll how and when all of the mehotds in Robot are run - * as well as initialize all global variables + *

The alloy class is an extension of the FTC OpMode class, and takes care of preliminary setup + * of:
+ * - Setting up the global FTC variables in RobotCore
+ * - Setting up the global Debugger
+ * - Initializing any "initializeables" in the project
+ * - Running the users defined methods
* * @author Garrett Burroughs * @version 0.1 * @since 0.1 - * */ -public abstract class Alloy extends OpMode{ - - +public abstract class Alloy extends OpMode { + + public static ArrayList initObjects = new ArrayList<>(); + private static DriveTrain driveTrain; + /** - * The robotSetup is where all code specific to robot setup is placed - * If you only have one teleop this can be done in the initialization - * Method. robotSetup is called right after the robot core is initialized + * The robotSetup is where all code specific to robot setup is placed If you only have one + * teleop this can be done in the initialization Method. robotSetup is called right after the + * robot core is initialized */ public abstract void robotSetup(); - + /** - * The initialization method is were everything specific to the OpMode - * Should be set up. Initialization will be the first thing called after - * The robot setup. + * The initialization method is were everything specific to the OpMode Should be set up. + * Initialization will be the first thing called after The robot setup. */ public abstract void initialization(); /** - * Although most of the periodic actions are taken care by the updater, the user may want to - * add their own methods and code that need to be updated or run periodically, this can be done in - * the periodic() method - * periodic will be run every loop. + * Although most of the periodic actions are taken care by the updater, the user may want to add + * their own methods and code that need to be updated or run periodically, this can be done in + * the periodic() method periodic will be run every loop. */ public abstract void periodic(); - @Override public void init() { // Set Up the core robot components, This allows them to be accessed throughout the project new RobotCore(telemetry, hardwareMap, gamepad1, gamepad2); Component.debugger = new FTCDebugger(); + + for (Initializeable i : initObjects) { + i.init(); + } + robotSetup(); initialization(); + driveTrain.setDefaultInput(); } @Override - public void loop() - { + public void loop() { Updater.update(); periodic(); } + + public static void setDriveTrain(DriveTrain driveTrain) { + Alloy.driveTrain = driveTrain; + } + + public static DriveTrain getDriveTrain() { + return driveTrain; + } } diff --git a/src/main/java/org/montclairrobotics/alloy/core/Button.java b/src/main/java/org/montclairrobotics/alloy/core/Button.java index 5386b46..c23151d 100644 --- a/src/main/java/org/montclairrobotics/alloy/core/Button.java +++ b/src/main/java/org/montclairrobotics/alloy/core/Button.java @@ -1,21 +1,44 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.core; /** - * Created by MHS Robotics on 11/13/2017. + * An outline for the fundamental behavior of a button * - * The button interface is implemented in ftc button - * The user can get the value of the button, - * In most cases this will be a Boolean (True if pressed, false if not), + *

A button can either be pressed, or unpressed, so the button interface has a method that + * returns a boolean value. When implemented, getValue() should return true when the button is + * pressed and false when it is unpressed * * @author Garrett Burroughs * @version 0.1 * @since 0.1 - * */ -public interface Button{ +public interface Button { /** * Gets the value of a button - * @return returns the value of the button, in most cases True(pressed) or False(unpressed) + * + * @return returns the value of the button, in most case True(pressed) or False(unpressed) */ public boolean getValue(); } diff --git a/src/main/java/org/montclairrobotics/alloy/core/Debug.java b/src/main/java/org/montclairrobotics/alloy/core/Debug.java index be74ee6..8bc64dd 100644 --- a/src/main/java/org/montclairrobotics/alloy/core/Debug.java +++ b/src/main/java/org/montclairrobotics/alloy/core/Debug.java @@ -1,24 +1,61 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.core; +import org.montclairrobotics.alloy.utils.ConstantInput; import org.montclairrobotics.alloy.utils.Input; +/** + * Contains the necessary information for a debug + * + *

Every debug has a key, which is a title or label of the information being debugged This can be + * the type of information ex. 'ERROR', where the information is coming from and what it is ex. + * "Right Left Motor encoder value", or any other descriptor of the information + * + *

Every debug also has the actual value that is being debugged The part where it is actually + * debugged is taken care of the Debugger + * + * @see Debugger + * @author Garrett Burroughs + * @version 0.1 + * @since 0.1 + */ public class Debug { + /** The key, label, or name of the information */ + public String key; + /** The information, or object to be debugged */ + public Input value; + /** debug a changing value */ public Debug(String key, Input value) { this.key = key; this.value = value; } - public Debug(String key, Object value){ + /** debug a constant value */ + public Debug(String key, Object value) { this.key = key; - this.value = new Input() { - @Override - public Object get() { - return value; - } - }; + this.value = new ConstantInput<>(value); } - - public String key; - public Input value; } diff --git a/src/main/java/org/montclairrobotics/alloy/core/Debugger.java b/src/main/java/org/montclairrobotics/alloy/core/Debugger.java index 8453ebb..91559ef 100644 --- a/src/main/java/org/montclairrobotics/alloy/core/Debugger.java +++ b/src/main/java/org/montclairrobotics/alloy/core/Debugger.java @@ -1,45 +1,202 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.core; /** - * Created by MHS Robotics on 11/13/2017. + * Controls the flow of how debug information is read out + * + *

Debugs are used for debugging information to the user In ftc the debugs use Telemetry to read + * an output to the phone The debug allows for easier usage of the telemetry methods That are most + * used for debugging. * - * Debugs are used for debugging information to the user - * In ftc the debugs use Telemetry to read an output to the phone - * The debug allows for easier usage of the telemetry methods - * That are most used for debugging. + *

The Debugger also has different debug levels, so that the user can easily switch the amount of + * information they are getting. For example, the user would want a lot of information about a + * particular part when they are fixing a problem or tuning the robot, but only important + * information when they are driving in a competition * * @author Garrett Burroughs * @version 0.1 * @since 0.1 - * */ -public interface Debugger { +public abstract class Debugger { + public enum Level { + + /** + * The override can be used to override the level system and ouput any information Overrides + * are always enabled + */ + OVERRIDE(-1), + + /** + * Error Debugs should never be Turned off. Error debugs will display when anything that is + * critical to robot operation occurs + */ + ERROR(0), + + /** + * Competition debugs should contain information that is important to the drive team during + * a competition match. + */ + COMPETITION(1), + + /** Warnings should display when there is a potential problem with robot operation */ + WARNING(2), + + /** + * Test debugs should be used when testing functionality of a process or mechanism, Tests + * should contain simple and important information to the process rather than an in depth + * look on how everything is working. + */ + TEST(3), + + /** + * Debugs should contain the most information about a mechanism or process. For example, + * debug information for a motor would include its target speed, current speed, target + * position, current position, direction, % error, and so on. Debugs should only be turned + * on when fixing problems, as the amount of information can be quite cluttering + */ + DEBUG(4); + + /** + * Each debug level has a rank, the lower the rank, the more important. For example, if + * running debug level 3, information from levels 3, 2, 1, and 0 will be debugged. + * + *

Ranks should not be lower than 0 + */ + int rank; + + private Level(int rank) { + this.rank = rank; + } + + public int getRank() { + return rank; + } + } + + /** Current Debug Level */ + public static Level debugLevel = Level.DEBUG; + /** - * Debugs a value with a Key(Identifier) + * Set the debug level * - * @param key Name of the value - * @param value Value to be debugged + * @param level The level to be set */ - public void log(String key, Object value); + public static void setDebugLevel(Level level) { + if (level.getRank() < 0) { + Debugger.debugLevel = level; + } else { + Debugger.debugLevel = Level.ERROR; + } + } /** - * Debugs any value or message(note) to the user with a default key + * The most basic debug that simply outputs information given a key and value * + * @param key Key of the value being debugged * @param value Value to be debugged */ - public void msg(Object value); + public abstract void out(String key, Object value); + /** + * Debugs a value if the level is lower than the current debug level + * + * @param key Name of the value + * @param value Value to be debugged + * @param level the level this debug is, if the debug level is lower than the current level, + * this will not be degbugged + */ + public void log(String key, Object value, Level level) { + if (level.getRank() < debugLevel.getRank()) { + out(key, value); + } + } /** * Debugs out a debug object * * @param debug the object to be debugged */ - public void debug(Debug debug); + public void debug(Debug debug) { + log(debug.key, debug.value, Level.DEBUG); + } + + /** + * Debug out verbose information + * + * @param key Name of the value + * @param value Value to be displayed + */ + public void debug(String key, Object value) { + log(key, value, Level.DEBUG); + } /** * Gives a warning to the user + * * @param warning the warning */ - public void warning(String warning); + public void warn(String warning) { + log("WARNING", warning, Level.WARNING); + } + + /** + * Gives an error message to the user + * + * @param error the error message to be displayed + */ + public void error(String error) { + log("ERROR", error, Level.ERROR); + } + + /** + * Give a message intended for the driver during practice or competition operation + * + * @param key Name of the value + * @param value Value to be displayed + */ + public void driverInfo(String key, Object value) { + log(key, value, Level.COMPETITION); + } + + /** + * Information to be displayed when testing a process or mechanism + * + * @param key Name of the value + * @param value Value to be displayed + */ + public void test(String key, Object value) { + log(key, value, Level.TEST); + } + + /** + * A message that overrides the debug level system + * + * @param key Name of the value + * @param value Value to be displayed + */ + public void override(String key, Object value) { + log(key, value, Level.OVERRIDE); + } } diff --git a/src/main/java/org/montclairrobotics/alloy/core/Encoder.java b/src/main/java/org/montclairrobotics/alloy/core/Encoder.java new file mode 100644 index 0000000..c35aa59 --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/core/Encoder.java @@ -0,0 +1,179 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.core; + +import org.montclairrobotics.alloy.components.InputComponent; +import org.montclairrobotics.alloy.utils.Differential; +import org.montclairrobotics.alloy.utils.Input; + +/** + * A motor encoder that keeps track of kinematic information about the motor + * + *

At a basic level hardware encoders are able to get how far a motor has gone as a unit of + * encoder ticks. The encoder class also calculates the acceleration anc velocity of the motor in + * terms of encoder ticks, and then the user can define the distance of unit to measure the motor in + * + * @author Garrett Burroughs + * @version 0.1 + * @since 0.1 + */ +public abstract class Encoder extends InputComponent { + + /** + * An Object that calculates the change in position with respect to time (Velocity) Measured in + * Ticks per Second + */ + private Differential calcVelocity; + + /** + * An Object that calculates the change in velocity with respect to time (Acceleration) Measured + * in Ticks per Second per Second + */ + private Differential calcAcceleration; + + /** + * How far the motor goes for each encoder tick NOTE : It is very important that distances are + * consistent + */ + private double distancePerTick; + + /** Max speed that the motor can go Measured in Ticks per Second */ + private double maxSpeed; + + /** Keeps track of the ticks when the encoder was "reset" */ + private int ticksAtReset; + + /** + * A method that should be overridden by the encoder + * + * @return the raw value of encoder ticks that the encoder reads + */ + public abstract int getRawTicks(); + + /** @return the currnet ticks, this value is affected by encoder resets */ + public int getTicks() { + return getRawTicks() - ticksAtReset; + } + + /** soft reset the encoder, setting the current value as 0 ticks */ + public void reset() { + ticksAtReset = getRawTicks(); + } + + public Encoder(double distancePerTick, double maxSpeed) { + this.distancePerTick = distancePerTick; + this.maxSpeed = maxSpeed; + setInput(() -> getTicks()); + calcVelocity = new Differential((Input) () -> (double) getTicks()); + calcAcceleration = new Differential(calcVelocity); + } + + /** Create a new encoder with default values */ + public Encoder() { + this(1.0, 1.0); + } + + /** + * Set the distance per tick + * + *

The distance per tick is the amount of distance the motor will move (or what the motor is + * attached to, eg wheel/lift) The distance unit should stay consistent throughout the robot + * project This method can also be daisychained as it returns a reference to itself + * + * @param distancePerTick how far the motor moves for 1 encoder tick + * @return the encoder + */ + public Encoder setDistancePerTick(double distancePerTick) { + this.distancePerTick = distancePerTick; + return this; + } + + /** + * Set the max speed (In Ticks per Second) that the motor can run + * + * @param maxSpeed max speed that the motor can run + * @return the encoder + */ + public Encoder setMaxSpeed(double maxSpeed) { + this.maxSpeed = maxSpeed; + return this; + } + + /** + * Get the velocity in Ticks per Second + * + * @return velocity in ticks per second + */ + public double getRawVelocity() { + return calcVelocity.get(); + } + + /** + * Get the acceleration in ticks per second per second + * + * @return acceleration in ticks per second per second + */ + private double getRawAcceleration() { + return calcAcceleration.get(); + } + + /** + * Get the velocity in distance per second The distance is set by the distance per tick method, + * it is important to keep distances consistent throughout the project. + * + * @return velocity in distance per second + */ + public double getVelocity() { + return getRawVelocity() / distancePerTick; + } + + /** + * Get the acceleration in distance per second The distance is set by the distance per tick + * method, it is important to keep distances consistent throughout + * + * @return acceleration in distance per second + */ + public double getAcceleration() { + return getRawAcceleration() / distancePerTick; + } + + /** + * Get a scaled value (0 - 1) of how fast the motor is going + * + * @return a value 0 - 1 depending on how fast the motor is going + */ + public double getScaledVelocity() { + return getRawVelocity() / maxSpeed; + } + + /** @return the differential object that calculates the velocity */ + public Differential getVelocityDifferential() { + return calcVelocity; + } + + /** @return the differential object that calculates the acceleration */ + public Differential getAccelerationDifferential() { + return calcAcceleration; + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/core/Joystick.java b/src/main/java/org/montclairrobotics/alloy/core/Joystick.java index 9f807ce..cd4f172 100644 --- a/src/main/java/org/montclairrobotics/alloy/core/Joystick.java +++ b/src/main/java/org/montclairrobotics/alloy/core/Joystick.java @@ -1,16 +1,38 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.core; import org.montclairrobotics.alloy.vector.Vector; /** - * Created by MHS Robotics on 11/14/2017. + * The fundamental outline for all standard 2-axis joysticks * - * Joysticks should return a vector made up of the X and Y values of their position + *

Joysticks should return a vector made up of the X and Y values of their position * * @author Garrett Burroughs * @version 0.1 * @since 0.1 - * */ public interface Joystick { /** diff --git a/src/main/java/org/montclairrobotics/alloy/core/Mode.java b/src/main/java/org/montclairrobotics/alloy/core/Mode.java index 784280b..b4ac63b 100644 --- a/src/main/java/org/montclairrobotics/alloy/core/Mode.java +++ b/src/main/java/org/montclairrobotics/alloy/core/Mode.java @@ -1,22 +1,38 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.core; /** - * Created by MHS Robotics on 11/14/2017. - * - * Mode stores all the different run modes that a robot can run in + * All of the different running states that the robot can be in * * @author Garrett Burroughs * @version 0.1 * @since 0.1 - * */ public enum Mode { - /** - * ftc Telemetry Operated Mode - */ + /** ftc Telemetry Operated Mode */ FTCTELEOP, - /** - * ftc autonomous mode - */ + /** ftc autonomous mode */ FTCAUTONOMOUS } diff --git a/src/main/java/org/montclairrobotics/alloy/core/Motor.java b/src/main/java/org/montclairrobotics/alloy/core/Motor.java new file mode 100644 index 0000000..21d69a9 --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/core/Motor.java @@ -0,0 +1,64 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.core; + +/** + * An outline for all of the basic motor behavior + * + *

The very basic functionality of any mechanical motor This includes setting power, and + * inverting the motor + * + * @author Garrett Burroughs + * @version 0.1 + * @since 0.1 + */ +public interface Motor { + /** + * Sets the motor Power + * + * @param power the power that the motor will be set to (0-1 inclusive ) + */ + public void setMotorPower(double power); + + /** + * Gets the motor power + * + * @return the current motor power, a value between (0-1) + */ + public double getMotorPower(); + + /** + * Sets weather the motor runs the default way , or inverted + * + * @param inverted true for inverted, false for normal + */ + public void setInverted(boolean inverted); + + /** + * Gets weather the motor is inverted + * + * @return true if the motor is inverted + */ + public boolean getInverted(); +} diff --git a/src/main/java/org/montclairrobotics/alloy/core/PoweredMotor.java b/src/main/java/org/montclairrobotics/alloy/core/PoweredMotor.java deleted file mode 100644 index 57f2831..0000000 --- a/src/main/java/org/montclairrobotics/alloy/core/PoweredMotor.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.montclairrobotics.alloy.core; - -import java.util.ArrayList; - -/** - * Created by MHS Robotics on 11/13/2017. - * - * - * - * @author Garrett Burroughs - * @version 0.1 - * @since 0.1 - * - */ -public interface PoweredMotor { - /** - * Sets the motor Power - * - * @param power the power that the motor will be set to (0-1 inclusive ) - */ - public void setMotorPower(double power); - - /** - * Gets the motor power - * - * @return the current motor power, a value between (0-1) - */ - public double getMotorPower(); - - - /** - * Sets weather the motor runs the default way , or inverted - * - * @param inverted true for inverted, false for normal - */ - public void setInverted(boolean inverted); - - /** - * Gets weather the motor is inverted - * - * @return true if the motor is inverted - */ - public boolean getInverted(); - - /** - * gets the debug information for the motor - * - * @return the motor debugs - */ - public ArrayList getDebugs(); -} diff --git a/src/main/java/org/montclairrobotics/alloy/core/README.md b/src/main/java/org/montclairrobotics/alloy/core/README.md index a6e9bd9..3216c85 100644 --- a/src/main/java/org/montclairrobotics/alloy/core/README.md +++ b/src/main/java/org/montclairrobotics/alloy/core/README.md @@ -1,8 +1,8 @@ # CORE -This is where all the base functionality and components are located. +This is where all the base functionality and components are located. -The intent of Alloy is to be Multi-Platform (FTC aswell as FRC), so everything in core +The intent of Alloy is to be Multi-Platform (FTC aswell as FRC), so everything in core was designed to be the very base components of a robot and should then be implemented in the respective FTC and FRC folders. diff --git a/src/main/java/org/montclairrobotics/alloy/core/RobotCore.java b/src/main/java/org/montclairrobotics/alloy/core/RobotCore.java index 197b55b..99130ee 100644 --- a/src/main/java/org/montclairrobotics/alloy/core/RobotCore.java +++ b/src/main/java/org/montclairrobotics/alloy/core/RobotCore.java @@ -1,3 +1,26 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.core; import com.qualcomm.robotcore.hardware.Gamepad; @@ -5,49 +28,48 @@ import org.firstinspires.ftc.robotcore.external.Telemetry; /** - * Created by MHS Robotics on 12/5/2017. + * Stores all of the global robot objects, including telemetry, the hardware map, and gamepads + * + *

Since essential parts to the robots operation are stored in OpMode + * + *

With this, the user can acess all of the objects throughout the project. + * + *

The robot core class creates static instances of all of the essential objects on + * initialization The actual objects are passed in in the alloy class * - * Since essential parts to the robots operation are stored in OpMode * @see com.qualcomm.robotcore.eventloop.opmode.OpMode - * The robot core class creates static instances of all of the essentail objects on initialization - * The actual objects are passed in in the alloy class * @see Alloy - * With this, the user can acess all of the objects throughout the project. - * * @author Garrett Burroughs * @version 0.1 * @since 0.1 - * */ public class RobotCore { /** - * Telemetry is used for reading out information on the phones and is useful for debugging, - * The telemetry is also used in Debugger - * @see Debugger + * Telemetry is used for reading out information on the phones and is useful for debugging, The + * telemetry is also used in Debug + * + * @see Debug */ public static Telemetry telemetry; /** - * The hardware map is essential to any robot and is how the ftc core interacts with the hardware devices - * on the phones + * The hardware map is essential to any robot and is how the ftc core interacts with the + * hardware devices on the phones */ public static HardwareMap hardwareMap; - /** - * The first gamepad, generated by pressing start + 'a' on the controller - */ + /** The first gamepad, generated by pressing start + 'a' on the controller */ public static Gamepad gamepad1; - /** - * The second gamepad, generated by pressing start + 'b' on the controller - */ + /** The second gamepad, generated by pressing start + 'b' on the controller */ public static Gamepad gamepad2; - public RobotCore(Telemetry telemetry, HardwareMap hardwareMap, Gamepad gamepad1, Gamepad gamepad2) { - //Instantiate all static instances - this.telemetry = telemetry; + public RobotCore( + Telemetry telemetry, HardwareMap hardwareMap, Gamepad gamepad1, Gamepad gamepad2) { + // Instantiate all static instances + this.telemetry = telemetry; this.hardwareMap = hardwareMap; - this.gamepad1 = gamepad1; - this.gamepad2 = gamepad2; + this.gamepad1 = gamepad1; + this.gamepad2 = gamepad2; } /** @@ -55,7 +77,7 @@ public RobotCore(Telemetry telemetry, HardwareMap hardwareMap, Gamepad gamepad1, * * @return the hardware map */ - public static HardwareMap getHardwareMap(){ + public static HardwareMap getHardwareMap() { return hardwareMap; } @@ -64,7 +86,7 @@ public static HardwareMap getHardwareMap(){ * * @return telemetry */ - public static Telemetry getTelemetry() throws NullPointerException{ + public static Telemetry getTelemetry() throws NullPointerException { return telemetry; } diff --git a/src/main/java/org/montclairrobotics/alloy/core/TargetMotor.java b/src/main/java/org/montclairrobotics/alloy/core/TargetMotor.java index d783c1c..e3aec8c 100644 --- a/src/main/java/org/montclairrobotics/alloy/core/TargetMotor.java +++ b/src/main/java/org/montclairrobotics/alloy/core/TargetMotor.java @@ -1,42 +1,55 @@ -package org.montclairrobotics.alloy.core; +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs +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: -import java.util.ArrayList; +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. +*/ +package org.montclairrobotics.alloy.core; /** - * Target motor is a motor interface for motors that have encoders. - * Target motors can set encoder positions using PID control + * Target motor is a motor interface for motors that have encoders. Target motors can set encoder + * positions using PID control + * + *

Target motors define the action for more advanced motors, that have access to more information + * and are able to be more finely tuned. Because they have encoders, more advanced control + * mechanisms can be used such as PID control, to gain better, more accurate control over the motors + * + * @author Garrett Burroughs + * @version 0.1 + * @since 0.1 */ -public interface TargetMotor{ +public interface TargetMotor extends Motor { /** * Sets the motor Power * * @param power the power that the motor will be set to (0-1 inclusive ) */ public void setTargetPower(double power); - + /** * Gets the motor power * * @return the current motor power, a value between (0-1) */ public double getTargetPower(); - - - /** - * Sets weather the motor runs the default way , or inverted - * - * @param inverted true for inverted, false for normal - */ - public void setInverted(boolean inverted); - - /** - * Gets weather the motor is inverted - * - * @return true if the motor is inverted - */ - public boolean getInverted(); - + /** * Sets the motor position * @@ -49,12 +62,5 @@ public interface TargetMotor{ * * @return the position that the motor is at (in encoder ticks) */ - public double getPosition(); - - /** - * Gets the debug information of the motor - * - * @return the debugs for the motor - */ - public ArrayList getDebugs(); + public int getPosition(); } diff --git a/src/main/java/org/montclairrobotics/alloy/core/UniversalMotor.java b/src/main/java/org/montclairrobotics/alloy/core/UniversalMotor.java deleted file mode 100644 index bae027e..0000000 --- a/src/main/java/org/montclairrobotics/alloy/core/UniversalMotor.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.montclairrobotics.alloy.core; - -/** - * Created by MHS Robotics on 2/25/2018. - * - * A universal motor is a motor that has the ability to both be controlled by motor power - * As well as controlled by encoder position. In FTC this also means dynamically switching - * the modes that the motor is in - * @see TargetMotor - * @see PoweredMotor - * - * @author Garrett Burroughs - * @since - */ -public interface UniversalMotor extends TargetMotor, PoweredMotor { -} diff --git a/src/main/java/org/montclairrobotics/alloy/drive/DTInput.java b/src/main/java/org/montclairrobotics/alloy/drive/DTInput.java new file mode 100644 index 0000000..95542d7 --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/drive/DTInput.java @@ -0,0 +1,65 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.drive; + +import org.montclairrobotics.alloy.vector.Angle; +import org.montclairrobotics.alloy.vector.Vector; + +/** + * An input for a drivetrain that takes a rate of translation, and rotation + * + *

A DTInput contains the information for controlling a drivetrain. This information is the + * translation, or the rate at which the robot wil move and the rotation, the rate that the robot + * will turn + * + * @author Garrett Burroughs + * @version 0.1 + * @since 0.1 + */ +public class DTInput { + /** + * A translation vector that controls the rate at which the robot will move In a tank drivetrain + * only the Y component will be taken into account In omnidirectional drivetrains, both the x + * and y components will be used in drive calculations + */ + private Vector translation; + + /** The rate at which the drivetrain will turn */ + private Angle rotation; + + public DTInput(Vector translation, Angle rotation) { + this.translation = translation; + this.rotation = rotation; + } + + /** @return the rate at which the robot will move */ + public Vector getTranslation() { + return translation; + } + + /** @return the rate at which the robot will rotate */ + public Angle getRotation() { + return rotation; + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/drive/DTMapper.java b/src/main/java/org/montclairrobotics/alloy/drive/DTMapper.java index 9a64841..f6aeb3d 100644 --- a/src/main/java/org/montclairrobotics/alloy/drive/DTMapper.java +++ b/src/main/java/org/montclairrobotics/alloy/drive/DTMapper.java @@ -1,11 +1,35 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.drive; +import org.montclairrobotics.alloy.motor.Mapper; + /** - * Created by MHS Robotics on 12/16/2017. + * A mapper that specifically takes in DTInputs * * @author Garrett Burroughs * @since 0.1 + * @version 0.1 */ -public interface DTMapper { - public void map(); -} +public interface DTMapper extends Mapper {} diff --git a/src/main/java/org/montclairrobotics/alloy/drive/DriveModule.java b/src/main/java/org/montclairrobotics/alloy/drive/DriveModule.java new file mode 100644 index 0000000..b5dc42c --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/drive/DriveModule.java @@ -0,0 +1,51 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.drive; + +import org.montclairrobotics.alloy.core.Encoder; +import org.montclairrobotics.alloy.core.Motor; +import org.montclairrobotics.alloy.motor.MotorModule; +import org.montclairrobotics.alloy.utils.ErrorCorrection; +import org.montclairrobotics.alloy.vector.Vector; + +public class DriveModule extends MotorModule { + /** + * Create a fully functioning motor module + * + *

Modules created like this will be able to adjust their speed based on an error correction + * to maintain a more accurate speed. + * + * @param direction the direction that the module runs (for use in motor groups) + * @param encoder the encoder that keeps track of the motors position + * @param powerControl an error correction to adjust the speed of the module + * @param motors the motors that the module controls + */ + public DriveModule( + Vector direction, + Encoder encoder, + ErrorCorrection powerControl, + Motor... motors) { + super(direction, encoder, powerControl, motors); + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/drive/DriveTrain.java b/src/main/java/org/montclairrobotics/alloy/drive/DriveTrain.java index 04299a2..dde70ba 100644 --- a/src/main/java/org/montclairrobotics/alloy/drive/DriveTrain.java +++ b/src/main/java/org/montclairrobotics/alloy/drive/DriveTrain.java @@ -1,10 +1,92 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.drive; +import java.util.ArrayList; +import org.montclairrobotics.alloy.motor.Mapper; +import org.montclairrobotics.alloy.motor.MotorGroup; +import org.montclairrobotics.alloy.motor.MotorModule; +import org.montclairrobotics.alloy.utils.Input; + /** * Created by MHS Robotics on 12/16/2017. * * @author Garrett Burroughs * @since 0.1 */ -public class DriveTrain { +public class DriveTrain extends MotorGroup { + Input defaultInput; + + public DriveTrain(Input input, Mapper mapper, MotorModule... modules) { + super(input, mapper, modules); + defaultInput = input; + } + + public void setDefaultInput() { + setInput(defaultInput); + } + + public int[] getEncoderValues() { + ArrayList modules = getModules(); + int[] values = new int[modules.size()]; + for (int i = 0; i < values.length; i++) { + values[i] = modules.get(i).getEncoder().getTicks(); + } + return values; + } + + public int[] getRightEncoderValues() { + ArrayList modules = getModules(); + int total = 0; + for (MotorModule m : modules) { + if (m.getOffset().getX() > 0) { + total++; + } + } + int[] values = new int[total]; + for (int i = 0; i < values.length; i++) { + if (modules.get(i).getOffset().getX() > 0) { + values[i] = modules.get(i).getEncoder().getTicks(); + } + } + return values; + } + + public int[] getLeftEncoderValues() { + ArrayList modules = getModules(); + int total = 0; + for (MotorModule m : modules) { + if (m.getOffset().getX() < 0) { + total++; + } + } + int[] values = new int[total]; + for (int i = 0; i < values.length; i++) { + if (modules.get(i).getOffset().getX() < 0) { + values[i] = modules.get(i).getEncoder().getTicks(); + } + } + return values; + } } diff --git a/src/main/java/org/montclairrobotics/alloy/drive/TankDrive.java b/src/main/java/org/montclairrobotics/alloy/drive/TankDrive.java new file mode 100644 index 0000000..ad42e97 --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/drive/TankDrive.java @@ -0,0 +1,37 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.drive; + +import org.montclairrobotics.alloy.components.InputComponent; +import org.montclairrobotics.alloy.motor.MotorModule; + +public class TankDrive extends DriveTrain { + public TankDrive(InputComponent input, MotorModule... modules) { + super(input, new TankMapper(), modules); + } + + public TankDrive(MotorModule... modules) { + this(null, modules); + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/drive/TankMapper.java b/src/main/java/org/montclairrobotics/alloy/drive/TankMapper.java new file mode 100644 index 0000000..d480fd8 --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/drive/TankMapper.java @@ -0,0 +1,83 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.drive; + +import org.montclairrobotics.alloy.components.Component; +import org.montclairrobotics.alloy.motor.MotorModule; +import org.montclairrobotics.alloy.utils.Utils; +import org.montclairrobotics.alloy.vector.Angle; +import org.montclairrobotics.alloy.vector.Polar; +import org.montclairrobotics.alloy.vector.Vector; + +/** + * @author Garrett Burroughs + * @version 0.1 + * @since 0.1 + */ +public class TankMapper extends Component implements DTMapper { + + private Vector maxSpeed; + private Angle maxRotation; + + public TankMapper() { + this(1, 1); + } + + public TankMapper(Vector maxSpeed, Angle maxRotation) { + this.maxSpeed = maxSpeed; + this.maxRotation = maxRotation; + } + + public TankMapper(double maxSpeed, double maxRotation) { + this.maxSpeed = new Polar(maxSpeed, new Angle(0)); + this.maxRotation = new Angle(maxRotation); + } + + @Override + public void map(DTInput input, MotorModule... modules) { + double inputSpeed = input.getTranslation().getManitude(); + double inputRotation = input.getRotation().getDegrees(); + + // The values have a possibility of being from the maximum value, to their negative maximum + // values and should be scaled to (-1,1) to be applied to the motors + double scaledSpeed = + Utils.map(inputSpeed, -maxSpeed.getManitude(), maxSpeed.getManitude(), -1, 1); + double scaledRotation = + Utils.map( + inputRotation, -maxRotation.getDegrees(), maxRotation.getDegrees(), -1, 1); + + // Calculate the right and left powers and constrain them to (-1, 1) + double rightPower = Utils.constrain(scaledSpeed + scaledRotation, -1, 1); + double leftPower = Utils.constrain(scaledSpeed - scaledRotation, -1, 1); + + for (MotorModule m : modules) { + // Determine whether the module is on the right side or the left + if (m.getOffset().getX() > 0) { + m.setPower(rightPower); + } else { + m.setPower(leftPower); + } + } + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/exceptions/InvalidConfigurationException.java b/src/main/java/org/montclairrobotics/alloy/exceptions/InvalidConfigurationException.java new file mode 100644 index 0000000..4f81d0e --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/exceptions/InvalidConfigurationException.java @@ -0,0 +1,39 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.exceptions; + +import org.montclairrobotics.alloy.components.Component; + +/** + * An exception that is thrown when a robot is improperly setup An invalid configuration can be + * thrown when:
+ * - Global robot properties are accessed before they exist
+ * - Motor, or controller ports are improperly specified or accessed
+ */ +public class InvalidConfigurationException extends RuntimeException { + public InvalidConfigurationException(String message) { + super(message); + Component.debugger.error(message); + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/exceptions/UpdateException.java b/src/main/java/org/montclairrobotics/alloy/exceptions/UpdateException.java new file mode 100644 index 0000000..bc924ce --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/exceptions/UpdateException.java @@ -0,0 +1,34 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.exceptions; + +import org.montclairrobotics.alloy.components.Component; + +/** An exception that is thrown when there is problem with the update system */ +public class UpdateException extends RuntimeException { + public UpdateException(String message) { + super(message); + Component.debugger.error(message); + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/ftc/FTCButton.java b/src/main/java/org/montclairrobotics/alloy/ftc/FTCButton.java index 8711a9f..1fb1a37 100644 --- a/src/main/java/org/montclairrobotics/alloy/ftc/FTCButton.java +++ b/src/main/java/org/montclairrobotics/alloy/ftc/FTCButton.java @@ -1,49 +1,69 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.ftc; +import com.qualcomm.robotcore.hardware.Gamepad; import org.montclairrobotics.alloy.core.Button; import org.montclairrobotics.alloy.utils.Input; /** - * Created by MHS Robotics on 11/14/2017. - * * An FTC button provides implementation for a button used in the FTC competition + * * @author Garrett Burroughs + * @version 0.1 * @since 0.1 */ public class FTCButton implements Button { + /** Will return the value of the button */ + private Input buttonInput; - /** - * Will return the value of the button - */ - Input buttonInput; - - /** - * If true inverts the value of the button. - */ + /** If true inverts the value of the button. */ private boolean inverted; /** * Creates a new button using a buttonInput * - * @param buttonInput an input that returns true if the button is being pressed, and false if unpressed + * @param buttonInput an input that returns true if the button is being pressed, and false if + * unpressed */ - public FTCButton(Input buttonInput){ + public FTCButton(Input buttonInput) { this(buttonInput, false); } /** - * Creates a new button specifying a button input and an invert + * Creates a new button specifying a button input and an invert * - * @param buttonInput an input that returns true if the button is being pressed, and false if unpressed + * @param buttonInput an input that returns true if the button is being pressed, and false if + * unpressed * @param invert if true inverts the value of buttonInput */ - public FTCButton(Input buttonInput, boolean invert){ + public FTCButton(Input buttonInput, boolean invert) { this.buttonInput = buttonInput; this.inverted = invert; } - /** * Gets the values for a button * @@ -51,10 +71,62 @@ public FTCButton(Input buttonInput, boolean invert){ */ @Override public boolean getValue() { - if(inverted) { + if (inverted) { return !buttonInput.get(); - }else{ + } else { return buttonInput.get(); } } + + // BUTTON PAD + public static FTCButton getAButton(Gamepad gamepad) { + return new FTCButton(() -> gamepad.a); + } + + public static FTCButton getBButton(Gamepad gamepad) { + return new FTCButton(() -> gamepad.b); + } + + public static FTCButton getXButton(Gamepad gamepad) { + return new FTCButton(() -> gamepad.x); + } + + public static FTCButton getYButton(Gamepad gamepad) { + return new FTCButton(() -> gamepad.y); + } + + // DPAD + public static FTCButton getDPADUp(Gamepad gamepad) { + return new FTCButton(() -> gamepad.dpad_up); + } + + public static FTCButton getDPADDown(Gamepad gamepad) { + return new FTCButton(() -> gamepad.dpad_down); + } + + public static FTCButton getYDPADRight(Gamepad gamepad) { + return new FTCButton(() -> gamepad.dpad_right); + } + + public static FTCButton getDPADLeft(Gamepad gamepad) { + return new FTCButton(() -> gamepad.dpad_left); + } + + // Bumpers + public static FTCButton getRightBumper(Gamepad gamepad) { + return new FTCButton(() -> gamepad.right_bumper); + } + + public static FTCButton getLeftBumper(Gamepad gamepad) { + return new FTCButton(() -> gamepad.left_bumper); + } + + // Triggers + public static FTCButton getRightTrigger(Gamepad gamepad) { + return new FTCButton(() -> gamepad.right_trigger > .5); + } + + public static FTCButton getLeftTrigger(Gamepad gamepad) { + return new FTCButton(() -> gamepad.left_trigger > .5); + } } diff --git a/src/main/java/org/montclairrobotics/alloy/ftc/FTCDebugger.java b/src/main/java/org/montclairrobotics/alloy/ftc/FTCDebugger.java index c2ea3dc..9eee733 100644 --- a/src/main/java/org/montclairrobotics/alloy/ftc/FTCDebugger.java +++ b/src/main/java/org/montclairrobotics/alloy/ftc/FTCDebugger.java @@ -1,77 +1,68 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.ftc; import org.firstinspires.ftc.robotcore.external.Telemetry; -import org.montclairrobotics.alloy.core.Debug; import org.montclairrobotics.alloy.core.Debugger; import org.montclairrobotics.alloy.core.RobotCore; +import org.montclairrobotics.alloy.exceptions.InvalidConfigurationException; /** - * Created by MHS Robotics on 11/14/2017. - * - * The FTCDebugger class is a basic wrapper around the - * ftc telemetry framework and allows telemetry to be - * used in any class as well as making debugging information - * easier + * implementation of the debugger for the FTC competition * * @author Garrett Burroughs + * @version 0.1 * @since 0.1 */ -public class FTCDebugger implements Debugger { +public class FTCDebugger extends Debugger { - /** - * The telemetry used for debugging - */ - Telemetry telemetry; + /** The telemetry used for debugging */ + private Telemetry telemetry; - /** - * Create a new FTCDebugger, and throw an exception if it has not been initialized - */ + /** Create a new FTCDebugger, and throw an exception if it has not been initialized */ public FTCDebugger() { try { this.telemetry = RobotCore.getTelemetry(); - }catch (NullPointerException e){ + } catch (NullPointerException e) { e.printStackTrace(); - throw new RuntimeException("You tried to access the telemetry before the robotcore has been initialized"); + throw new InvalidConfigurationException( + "You tried to access the telemetry before the robotcore has been initialized"); } } - /** - * Debugger out information - * @param key Name of the value - * @param value Value to be debugged - */ - @Override - public void log(String key, Object value) { - telemetry.addData(key, value); + public Telemetry getTelemetry() { + return telemetry; } /** - * Debugger out a message - * @param value Value to be debugged - */ - @Override - public void msg(Object value) { - telemetry.addData("Debugger", value); - } - - /** - * Debugs out a debug object - * - * @param debug the object to be debugged - */ - @Override - public void debug(Debug debug) { - log(debug.key, debug.value.get()); - } - - /** - * Gives a warning to the user + * The most basic debug that simply outputs information given a key and value * - * @param warning the warning + * @param key Key of the value being debugged + * @param value Value to be debugged */ @Override - public void warning(String warning) { - log("WARNING", warning); + public void out(String key, Object value) { + telemetry.addData(key, value); } - } diff --git a/src/main/java/org/montclairrobotics/alloy/ftc/FTCJoystick.java b/src/main/java/org/montclairrobotics/alloy/ftc/FTCJoystick.java index 053173c..4eb468d 100644 --- a/src/main/java/org/montclairrobotics/alloy/ftc/FTCJoystick.java +++ b/src/main/java/org/montclairrobotics/alloy/ftc/FTCJoystick.java @@ -1,49 +1,73 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.ftc; -import com.qualcomm.robotcore.eventloop.opmode.OpMode; import com.qualcomm.robotcore.hardware.Gamepad; +import org.montclairrobotics.alloy.components.InputComponent; import org.montclairrobotics.alloy.core.Joystick; -import org.montclairrobotics.alloy.utils.Input; +import org.montclairrobotics.alloy.update.Update; import org.montclairrobotics.alloy.vector.Vector; import org.montclairrobotics.alloy.vector.XY; /** - * Created by MHS Robotics on 11/14/2017. + * Implementation of the Joystick class for FTC * - * There are a total of 4 accessible joysticks when controlling an FTC robot, - * There are 2 controllers and each one has 2 joysticks, (One right, one left). - * A joystick can be defined using a controller and a side + *

There are a total of 4 accessible joysticks when controlling an FTC robot, There are 2 + * controllers and each one has 2 joysticks, (One right, one left). A joystick can be defined using + * a controller and a side * - * Joysticks can also be used as inputs that return a vector + *

Joysticks can also be used as inputs that return a vector * * @author Garrett Burroughs + * @version 0.1 * @since 0.1 */ -public class FTCJoystick implements Joystick, Input{ +public class FTCJoystick extends InputComponent implements Joystick { /** - * The side in a FTCJoystick is referring to the side of the controller is on, - * there are 2 joysticks, one on the right, one on the left - */ - public enum Side{ - RIGHT, - LEFT - } - - /** - * The gamepad that the joystick is attached to, - * this will either be joystick 1, or joystick2, these can be accessed from the RobotCore class + * The gamepad that the joystick is attached to, this will either be joystick 1, or joystick2, + * these can be accessed from the RobotCore class + * * @see org.montclairrobotics.alloy.core.RobotCore */ - Gamepad gamepad; + private Gamepad gamepad; + + /** The side that the joystick is on */ + private Side side; /** - * The side that the joystick is on + * The side in a FTCJoystick is referring to the side of the controller is on, there are 2 + * joysticks, one on the right, one on the left */ - Side side; + public enum Side { + RIGHT, + LEFT + } /** * Create a new Joystick using the gamepad and side + * * @param gamepad The gamepad the joystick is on * @param side The side the joystick is on (Right/Left) */ @@ -54,11 +78,12 @@ public FTCJoystick(Gamepad gamepad, Side side) { /** * Gets the position of the joystick as a vector + * * @return the position of the joystick as a vector */ @Override - public Vector getValue(){ - switch (side){ + public Vector getValue() { + switch (side) { case RIGHT: return new XY(gamepad.right_stick_x, gamepad.right_stick_y); case LEFT: @@ -68,8 +93,8 @@ public Vector getValue(){ } } - @Override - public Vector get() { - return getValue(); + @Update + public void updateControls() { + output = getValue(); } } diff --git a/src/main/java/org/montclairrobotics/alloy/ftc/FTCMotor.java b/src/main/java/org/montclairrobotics/alloy/ftc/FTCMotor.java index 79abf6e..f76f548 100644 --- a/src/main/java/org/montclairrobotics/alloy/ftc/FTCMotor.java +++ b/src/main/java/org/montclairrobotics/alloy/ftc/FTCMotor.java @@ -1,30 +1,60 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.ftc; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.hardware.DcMotorSimple; +import java.awt.*; +import org.montclairrobotics.alloy.components.Component; import org.montclairrobotics.alloy.core.*; import org.montclairrobotics.alloy.update.Update; import org.montclairrobotics.alloy.utils.Input; -import java.util.ArrayList; - /** - * Created by MHS Robotics on 11/14/2017. + * Implementation of a basic motor for the FTC competition * - * FTCMotor is a class that dynamically switches a motor's runmode - * depending on what functionality is being used + *

The basic motor for use in FTC. Basic motors are not aware of encoders and are not recommended + * for use in FTC as all motors come with encoders * + * @see FTCTargetMotor * @author Garrett Burroughs + * @version 0.1 * @since 0.1 */ -public class FTCMotor extends FTCMotorBase implements UniversalMotor { +public class FTCMotor extends Component implements Motor { + + /** The physical hardware motor reference to the motor being controlled */ + public DcMotor motor; - private double power; + /** The power that the motor should be running at */ + public double power; public FTCMotor(String motorConfiguration) { - super(motorConfiguration); + motor = RobotCore.getHardwareMap().dcMotor.get(motorConfiguration); + addDebug(new Debug(motorConfiguration + " Motor Power: ", (Input) () -> power)); } - + /** * Sets the motor Power * @@ -35,7 +65,7 @@ public void setMotorPower(double power) { motor.setMode(DcMotor.RunMode.RUN_USING_ENCODER); this.power = power; } - + /** * Gets the motor power * @@ -45,90 +75,52 @@ public void setMotorPower(double power) { public double getMotorPower() { return motor.getPower(); } - - /** - * Sets the power at which the motor will move when set to a position - * - * @param power the power that the motor will be set to (0-1 inclusive ) - */ - @Override - public void setTargetPower(double power) { - motor.setMode(DcMotor.RunMode.RUN_TO_POSITION); - this.power = power; - } - - /** - * Gets the motor power - * - * @return the current motor power, a value between (0-1) - */ - @Override - public double getTargetPower() { - return motor.getPower(); - } - + /** - * Sets the motor position + * Sets whether the motor runs the default way , or inverted * - * @param position the position the motor will be set to (in encoder ticks) + * @param inverted true for inverted, false for normal */ @Override - public void setPosition(int position) { - motor.setMode(DcMotor.RunMode.RUN_TO_POSITION); - motor.setTargetPosition(position); + public void setInverted(boolean inverted) { + if (inverted) { + motor.setDirection(DcMotorSimple.Direction.REVERSE); + } else { + motor.setDirection(DcMotorSimple.Direction.FORWARD); + } } - + /** - * Gets the motors position + * Gets weather the motor is inverted * - * @return the position that the motor is at (in encoder ticks) + * @return true if the motor is inverted */ @Override - public double getPosition() { - return motor.getCurrentPosition(); + public boolean getInverted() { + return motor.getDirection() == DcMotorSimple.Direction.REVERSE; } + public Encoder getEncoder() { + return new Encoder() { + @Override + public int getRawTicks() { + return motor.getCurrentPosition(); + } + }; + } @Update - public void updateMotor(){ - if(status.booleanValue()){ + public void updateMotor() { + // Set Motor Power if it is enabled + if (status.isEnabled()) { motor.setPower(power); - }else{ + } else { motor.setPower(0); } } - /** - * @return the motor position, and powers - */ @Override - public ArrayList getDebugs(){ - ArrayList motorDebugs = new ArrayList<>(); - - motorDebugs.add(new Debug("Motor Power", new Input(){ - - @Override - public Double get() { - return getMotorPower(); - } - })); - - motorDebugs.add(new Debug("Motor Position", new Input(){ - - @Override - public Double get() { - return getPosition(); - } - })); - - motorDebugs.add(new Debug("Target Power", new Input(){ - - @Override - public Double get() { - return getTargetPower(); - } - })); - - return motorDebugs; + public void disableAction() { + motor.setPower(0); } } diff --git a/src/main/java/org/montclairrobotics/alloy/ftc/FTCMotorBase.java b/src/main/java/org/montclairrobotics/alloy/ftc/FTCMotorBase.java deleted file mode 100644 index 56c6418..0000000 --- a/src/main/java/org/montclairrobotics/alloy/ftc/FTCMotorBase.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.montclairrobotics.alloy.ftc; - -import com.qualcomm.robotcore.hardware.DcMotor; -import com.qualcomm.robotcore.hardware.DcMotorSimple; -import org.montclairrobotics.alloy.components.Component; -import org.montclairrobotics.alloy.core.RobotCore; - -/** - * Created by MHS Robotics on 2/25/2018. - * - * FTCMotorBase is the base class that contains all of the methods - * that every motor has - * - * @author Garrett Burroughs - * @since - */ -public class FTCMotorBase extends Component{ - DcMotor motor; - - public FTCMotorBase(String motorConfiguration) { - motor = RobotCore.getHardwareMap().dcMotor.get(motorConfiguration); - } - - /** - * Sets weather the motor runs the default way , or inverted - * - * @param inverted true for inverted, false for normal - */ - public void setInverted(boolean inverted) { - if(inverted) { - motor.setDirection(DcMotorSimple.Direction.REVERSE); - } else{ - motor.setDirection(DcMotorSimple.Direction.FORWARD); - } - } - - /** - * Gets weather the motor is inverted - * - * @return true if the motor is inverted - */ - public boolean getInverted() { - return motor.getDirection() == DcMotorSimple.Direction.REVERSE ? true : false; - } - - /** - * Method to be called when the toggleable is enabled - */ - @Override - public void enableAction() { - - } - - /** - * Method to be called when the toggleable is disabled - */ - @Override - public void disableAction() { - - } -} diff --git a/src/main/java/org/montclairrobotics/alloy/ftc/FTCPoweredMotor.java b/src/main/java/org/montclairrobotics/alloy/ftc/FTCPoweredMotor.java deleted file mode 100644 index 9c185e4..0000000 --- a/src/main/java/org/montclairrobotics/alloy/ftc/FTCPoweredMotor.java +++ /dev/null @@ -1,91 +0,0 @@ -package org.montclairrobotics.alloy.ftc; - -import com.qualcomm.robotcore.hardware.DcMotor; -import com.qualcomm.robotcore.hardware.DcMotorSimple; -import org.montclairrobotics.alloy.core.Debug; -import org.montclairrobotics.alloy.core.PoweredMotor; -import org.montclairrobotics.alloy.core.RobotCore; -import org.montclairrobotics.alloy.update.Update; -import org.montclairrobotics.alloy.utils.Input; - -import java.util.ArrayList; -import java.util.Arrays; - -/** - * Created by MHS Robotics on 2/24/2018. - * - * A powered motor is a motor that is controlled by setting motor voltage - * A powered motor takes care of setting the motor configuration as well - * as setting the motor runmode do not change the robot runmode, if you - * plan to use a motor that is both controlled by voltage and position - * use FTCMotor - * @see FTCMotor - * - * @author Garrett Burroughs - * @since 0.1 - */ -public class FTCPoweredMotor extends FTCMotorBase implements PoweredMotor { - - private double power; - - public FTCPoweredMotor(String motorConfiguration) { - super(motorConfiguration); - } - - /** - * Sets the motor Power - * - * @param power the power that the motor will be set to (0-1 inclusive ) - */ - @Override - public void setMotorPower(double power) { - this.power = power; - } - - /** - * Gets the motor power - * - * @return the current motor power, a value between (0-1) - */ - @Override - public double getMotorPower() { - return motor.getPower(); - } - - /** - * gets the debug information for the motor - * - * @return the motor debugs - */ - @Override - public ArrayList getDebugs() { - ArrayList motorDebugs = new ArrayList<>(); - - motorDebugs.add(new Debug("Motor Power", new Input(){ - - @Override - public Double get() { - return getMotorPower(); - } - })); - - return motorDebugs; - } - - @Update - public void motorUpdate(){ - if(status.booleanValue()){ - motor.setPower(power); - }else{ - motor.setPower(0); - } - } - - - /** - * @return the motor being controlled - */ - public DcMotor getMotor() { - return motor; - } -} diff --git a/src/main/java/org/montclairrobotics/alloy/ftc/FTCTargetMotor.java b/src/main/java/org/montclairrobotics/alloy/ftc/FTCTargetMotor.java index 0d1399d..f3a7240 100644 --- a/src/main/java/org/montclairrobotics/alloy/ftc/FTCTargetMotor.java +++ b/src/main/java/org/montclairrobotics/alloy/ftc/FTCTargetMotor.java @@ -1,62 +1,100 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.ftc; import com.qualcomm.robotcore.hardware.DcMotor; import org.montclairrobotics.alloy.core.Debug; +import org.montclairrobotics.alloy.core.Encoder; import org.montclairrobotics.alloy.core.TargetMotor; import org.montclairrobotics.alloy.update.Update; +import org.montclairrobotics.alloy.utils.ErrorCorrection; import org.montclairrobotics.alloy.utils.Input; -import org.montclairrobotics.alloy.utils.PID; - -import java.util.ArrayList; - /** - * Created by MHS Robotics on 2/24/2018. + * Implementation of a target motor for the FTC competition * - * A target motor is a motor that can use encoders to be set to a certain position - * Since FTC motors have their own PIDs that they are controlled with by default, - * the user has the ability to override this and use custom PIDs if need be. - * By default, the user does not have to worry about any of this. - * Do not attempt to change the PID if you do not know what you are doing - * You can read more about PIDs here https://en.wikipedia.org/wiki/PID_controller + *

A target motor is a motor that can use encoders to be set to a certain position Since FTC + * motors have their own PIDs that they are controlled with by default, the user has the ability to + * override this and use custom PIDs if need be. By default, the user does not have to worry about + * any of this. Do not attempt to change the PID if you do not know what you are doing You can read + * more about PIDs here https://en.wikipedia.org/wiki/PID_controller * * @author Garrett Burroughs + * @version 0.1 * @since 0.1 */ -public class FTCTargetMotor extends FTCMotorBase implements TargetMotor { +public class FTCTargetMotor extends FTCMotor implements TargetMotor { - private double power; + /** The power that the motor will aim to be, a value between (-1, 1) */ + private double targetPower; + /** PID being used to control the motor in custom mode */ + private ErrorCorrection correction; + + /** Current target motor runmode NOTE: not equal to the DCMotor runmode */ + private Mode runmode = Mode.DEFAULT; + + /** + * Creates a new FTC Target motor, using the motor id from the FTC configuration + * + *

The configuration must be set on the phone before accessing it in code + * + *

A target motor created like this will have the default FTC motor regulation, to set a + * custom error correction, you can do this by calling 'setErrorCorrection(ErrorCorrection)' You + * should only do this if you know what you are doing + * + * @see ErrorCorrection + * @param motorConfiguration the name of the motor + */ public FTCTargetMotor(String motorConfiguration) { super(motorConfiguration); motor.setMode(DcMotor.RunMode.RUN_TO_POSITION); + addDebug(new Debug(motorConfiguration + " Motor Power: ", (Input) () -> power)); + addDebug( + new Debug( + motorConfiguration + " Motor Position: ", + (Input) () -> getPosition())); + addDebug( + new Debug( + motorConfiguration + " Target Motor Power: ", + (Input) () -> targetPower)); } - - enum Mode{ + + enum Mode { /** - * Defualt target motor runmode - * The default mode will run using the build in Motor PIDs to control the motor + * Defualt target motor runmode The default mode will run using the build in Motor PIDs to + * control the motor */ DEFAULT, /** - * Custom target motor runmode - * The custom mode will control the motor with a user defined PID controller + * Custom target motor runmode The custom mode will control the motor with a user defined + * PID controller */ CUSTOM } - /** - * PID being used to control the motor in custom mode - */ - private PID pid; - - /** - * Current target motor runmode - * NOTE: not equal to the DCMotor runmode - */ - private Mode runmode = Mode.DEFAULT; - /** * Sets the motor position * @@ -64,10 +102,11 @@ enum Mode{ */ @Override public void setPosition(int position) { - if(runmode == Mode.DEFAULT){ + if (runmode == Mode.DEFAULT) { + motor.setMode(DcMotor.RunMode.RUN_TO_POSITION); motor.setTargetPosition(position); - }else{ - pid.setTarget(position); + } else { + correction.setTarget((double) position); } } @@ -77,38 +116,10 @@ public void setPosition(int position) { * @return the position that the motor is at (in encoder ticks) */ @Override - public double getPosition() { + public int getPosition() { return motor.getCurrentPosition(); } - /** - * Gets the debug information of the motor - * - * @return the debugs for the motor - */ - @Override - public ArrayList getDebugs() { - ArrayList motorDebugs = new ArrayList<>(); - - motorDebugs.add(new Debug("Motor Position", new Input(){ - - @Override - public Double get() { - return getPosition(); - } - })); - - motorDebugs.add(new Debug("Motor Power", new Input(){ - - @Override - public Double get() { - return getTargetPower(); - } - })); - - return motorDebugs; - } - /** * Sets the motor Power * @@ -116,7 +127,8 @@ public Double get() { */ @Override public void setTargetPower(double power) { - this.power = power; + motor.setMode(DcMotor.RunMode.RUN_TO_POSITION); + this.targetPower = power; } /** @@ -130,19 +142,18 @@ public double getTargetPower() { } /** - * Set the motor to run using a custom PID - * @param pid the PID that the motor will be controlled with + * Set the motor to run using a custom Error Correction + * + * @param correction the correction that the motor will be controlled with */ - public void setPID(PID pid){ - this.pid = pid; + public void setErrorCorrection(ErrorCorrection correction) { + this.correction = correction.copy(); runmode = runmode.CUSTOM; } - /** - * Stop using the custom PID and return to using the default mode - */ - public void disablePID(){ - this.pid = null; + /** Stop using the custom Error Correction and return to using the default mode */ + public void disableErrorCorrection() { + this.correction = null; runmode = Mode.DEFAULT; } @@ -151,35 +162,55 @@ public void disablePID(){ */ @Update public void update() { - if(status.booleanValue()) { - if (runmode == Mode.CUSTOM) { - setTargetPower(pid.get()); + if (status.isEnabled()) { // Check if enabled + if (motor.getMode() == DcMotor.RunMode.RUN_TO_POSITION) { + if (runmode == Mode.CUSTOM) { + setTargetPower( + correction + .getCorrection()); // If running using custom PID mode, set power to PID output + } else { + motor.setPower( + targetPower); // If running in default target mode, set the target power + } + } else { + motor.setPower(power); // If running by power, set the power } - motor.setPower(power); - }else{ - motor.setPower(0); + } else { + motor.setPower(0); // If disabled, set power to 0 } } - /** - * @return the PID being used to control the motor - */ - public PID getPid() { - return pid; + /** @return the Error Correction being used to control the motor */ + public ErrorCorrection getErrorCorrection() { + return correction; } - /** - * @return the motor being controlled - */ + /** @return the motor being controlled */ public DcMotor getMotor() { return motor; } /** * NOTE: this is not the same as the DCMotor runmode + * * @return the current target motor runmode */ public Mode getRunmode() { return runmode; } + + /** + * Allows for the creation of an encoder object that is aware of the amount of ticks the motor + * has gone + * + * @return a new encoder object that will return the amount of encoder ticks the motor is at + */ + public Encoder getEncoder() { + return new Encoder() { + @Override + public int getRawTicks() { + return getPosition(); + } + }; + } } diff --git a/src/main/java/org/montclairrobotics/alloy/motor/DefaultMapper.java b/src/main/java/org/montclairrobotics/alloy/motor/DefaultMapper.java new file mode 100644 index 0000000..19ef8ed --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/motor/DefaultMapper.java @@ -0,0 +1,41 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.motor; + +import org.montclairrobotics.alloy.utils.Input; +import org.montclairrobotics.alloy.utils.Utils; + +/** + * A simple default mapper + * + *

This mapper will run all of the motors in the group in the same direction + */ +public class DefaultMapper implements Mapper> { + @Override + public void map(Input input, MotorModule... modules) { + for (MotorModule m : modules) { + m.setPower(input.get() * Utils.sign(m.getDirection().getManitude())); + } + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/motor/Mapper.java b/src/main/java/org/montclairrobotics/alloy/motor/Mapper.java new file mode 100644 index 0000000..2da4af9 --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/motor/Mapper.java @@ -0,0 +1,40 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.motor; + +/** + * A mapper takes an input, and maps it to the set of motor modules + * + *

For example, a tank drive mapper might map a 2D vector to the drive modules by calculating the + * rotation, and the power based on the x&y components of the vector + * + * @param the type of input the mapper takes in + * @author Garrett Burroughs + * @since 0.1 + * @version 0.1 + */ +public interface Mapper { + /** map the input to the modules */ + public void map(T input, MotorModule... modules); +} diff --git a/src/main/java/org/montclairrobotics/alloy/motor/MotorGroup.java b/src/main/java/org/montclairrobotics/alloy/motor/MotorGroup.java new file mode 100644 index 0000000..f676b2f --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/motor/MotorGroup.java @@ -0,0 +1,94 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.motor; + +import java.util.ArrayList; +import java.util.Arrays; +import org.montclairrobotics.alloy.components.Component; +import org.montclairrobotics.alloy.update.Update; +import org.montclairrobotics.alloy.utils.Input; + +/** + * A motor group is a group of motor modules that run together + * + *

A motor group should control any collection of motors that take an input, and then maps the + * output to a set of motors that run together. For example in a lift mechanism there may be 2 motor + * that both run in the same direction but one should be inverted to lift the lift up. The modules + * would define what direction the motors are running in the mapper would define that they need to + * run in opposite directions and the MotorGroup would run the motors together fully operating the + * lift. This could work with other things like an intake, shooter or other manipulator that + * requires multiple motors running together from one input + */ +public class MotorGroup extends Component { + + /** The mapper that will be used for power assignment and calculation */ + private Mapper mapper; + + /** The modules contained in the motor group */ + private ArrayList modules; + + /** The control input for the motor group */ + private Input input; + + public MotorGroup(Input input, Mapper mapper, MotorModule... modules) { + this.input = input; + this.mapper = mapper; + this.modules = (ArrayList) Arrays.asList(modules); + } + + /** + * Creates a motor group with a default mapper that simply + * + * @param input + * @param modules + */ + public MotorGroup(Input input, MotorModule... modules) { + this(input, new DefaultMapper(), modules); + } + + @Update + public void controlPower() { + mapper.map(input, modules.toArray(new MotorModule[modules.size()])); + } + + public Mapper getMapper() { + return mapper; + } + + public void setMapper(Mapper mapper) { + this.mapper = mapper; + } + + public Input getInput() { + return input; + } + + public void setInput(Input input) { + this.input = input; + } + + public ArrayList getModules() { + return modules; + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/motor/MotorModule.java b/src/main/java/org/montclairrobotics/alloy/motor/MotorModule.java new file mode 100644 index 0000000..72567af --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/motor/MotorModule.java @@ -0,0 +1,279 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.motor; + +import java.util.ArrayList; +import java.util.Arrays; +import org.montclairrobotics.alloy.components.Component; +import org.montclairrobotics.alloy.components.InputComponent; +import org.montclairrobotics.alloy.components.Step; +import org.montclairrobotics.alloy.core.Encoder; +import org.montclairrobotics.alloy.core.Motor; +import org.montclairrobotics.alloy.exceptions.InvalidConfigurationException; +import org.montclairrobotics.alloy.update.Update; +import org.montclairrobotics.alloy.utils.BangBang; +import org.montclairrobotics.alloy.utils.ConstantInput; +import org.montclairrobotics.alloy.utils.ErrorCorrection; +import org.montclairrobotics.alloy.vector.Vector; + +/** + * Highly Functional set of motors that run together + * + *

A motor module consists of multiple motors that run together in the same direction. Modules + * are aware of what direction the run in so they can be used in MoroGroups to be run together with + * other modules. Modules can also be controlled with an encoder and a ErrorCorrection to ensure + * that the are going the right speed. + * + *

You can also add steps to the Module that can alter the amount of power that the module will + * receive. This can be useful for modules that are being controlled by a separate entity such as a + * motor group. + * + * @author Garrett Burroughs + * @version 0.1 + * @since 0.1 + */ +public class MotorModule extends Component { + /** The motors that the module will control */ + private ArrayList motors; + + /** The direction that the modules run for use in a motor group */ + private Vector direction; + + /** the position of the motor, relative to the center of the motor group */ + private Vector offset; + + /** An error correction that will control the power */ + private ErrorCorrection powerControl; + + /** The encoder that keeps track of the position and controls the motors */ + private Encoder encoder; + + /** how fast the module should be running */ + private double targetPower; + + /** + * An input component, that takes in the motor input, and runs it to the output (setting the + * motor powers) this way, steps can be added to this modifier, and the input of the module can + * be changed + */ + private InputComponent modifier; + + /** True when the module is being set to a position */ + private boolean toPotsition = false; + + /** If running to a position, the target position the motor will aim to go to */ + private double targetPosition; + + /** Error Corrector to get to the right position */ + private ErrorCorrection positionCorrection; + + /** How fast the motors move when they are having their position be set */ + private double movementSpeed; + + /** + * Create a fully functioning motor module + * + *

Modules created like this will be able to adjust their speed based on an error correction + * to maintain a more accurate speed. + * + * @param direction the direction that the module runs (for use in motor groups) + * @param encoder the encoder that keeps track of the motors position + * @param powerControl an error correction to adjust the speed of the module + * @param motors the motors that the module controls + */ + public MotorModule( + Vector direction, + Encoder encoder, + ErrorCorrection powerControl, + Motor... motors) { + this.direction = direction; + this.motors = new ArrayList<>(Arrays.asList(motors)); + this.powerControl = powerControl.copy(); + this.encoder = encoder; + try { + powerControl.setInput(() -> encoder.getScaledVelocity()); + } catch (NullPointerException e) { + powerControl.setInput(new ConstantInput<>(0.0)); + } + + modifier = new InputComponent() {}; + + positionCorrection = new BangBang(1); + + positionCorrection.setInput(encoder); + } + + /** + * Create motor module without the use of an encoder + * + *

Modules created like this will not be abe to monitor or adjust their speed to maintain a + * constant and more exact speed. + * + * @param direction what direction the module runs + * @param motors the motors the module controls + */ + public MotorModule(Vector direction, Motor... motors) { + this(direction, null, null, motors); + } + + /** + * Set an encoder for the module + * + * @param encoder the encoder that keeps track of the position of the module + */ + public MotorModule setEncoder(Encoder encoder) { + this.encoder = encoder; + return this; + } + + /** + * set the power control for the module + * + * @param powerControl an error correction to adjust the speed of the module + */ + public MotorModule setErrorCorrection(ErrorCorrection powerControl) { + this.powerControl = powerControl.copy(); + return this; + } + + public MotorModule setPositionCorrection(ErrorCorrection positionCorrection) { + this.positionCorrection = positionCorrection; + return this; + } + + @Update + public void powerCorrection() { + if (status.isEnabled()) { // Check if its enabled + if (!toPotsition) { // Manual operation + for (Motor m : motors) { + if (powerControl != null) { + m.setMotorPower(targetPower + powerControl.getCorrection()); + } else { + m.setMotorPower(targetPower); + } + } + } else { // Autonomous operation + for (Motor m : motors) { + if (encoder == null) + throw new InvalidConfigurationException( + "Modules must have an encoder to set their position"); + m.setMotorPower(positionCorrection.getCorrection() * movementSpeed); + } + } + } else { // If disabled, set the power to 0 + for (Motor m : motors) { + m.setMotorPower(0); + } + } + } + + /** + * Set the target power of the module + * + * @param power how fast the module will go (-1 to 1) + */ + public void setPower(double power) { + modifier.setInput(new ConstantInput<>(power)); + modifier.applySteps(); + targetPower = modifier.get(); + powerControl.setTarget(modifier.get()); + toPotsition = false; + } + + public void setMovementSpeed(double speed) { + this.movementSpeed = speed; + } + + public void setTargetPosition(double targetPosition) { + positionCorrection.setTarget(targetPosition); + toPotsition = true; + } + + public MotorModule setPowerModifier(InputComponent modifier) { + this.modifier = modifier; + return this; + } + + public MotorModule addStep(Step s) { + modifier.addStep(s); + return this; + } + + /** Method to be called when the toggleable is disabled */ + @Override + public void disableAction() { + for (Motor m : motors) { + m.setMotorPower(0); + } + } + + // Autonomous operation + + /** @return the motor arraylist in the module */ + public ArrayList getMotors() { + return motors; + } + + /** @return the direction the module runs in */ + public Vector getDirection() { + return direction; + } + + /** @return the error correction used for the module */ + public ErrorCorrection getPowerControl() { + return powerControl; + } + + /** @return the encoder that monitors the position of the monitor */ + public Encoder getEncoder() { + return encoder; + } + + /** @return the current target power of the module */ + public double getTargetPower() { + return targetPower; + } + + /** @return the power modifier of the motor */ + public InputComponent getModifier() { + return modifier; + } + + /** @return the relative position to the center of the motor group */ + public Vector getOffset() { + return offset; + } + + public boolean atTargetPosition(double tolerance) { + return Math.abs(encoder.getTicks() - targetPosition) < tolerance; + } + + public void toPosition() { + toPotsition = true; + } + + public void usingPower() { + toPotsition = false; + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/steps/Deadzone.java b/src/main/java/org/montclairrobotics/alloy/steps/Deadzone.java new file mode 100644 index 0000000..153eac7 --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/steps/Deadzone.java @@ -0,0 +1,79 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.steps; + +import org.montclairrobotics.alloy.components.Step; +import org.montclairrobotics.alloy.utils.Toggleable; + +/** + * A step that returns 0 if the input is under a certain threshold + * + * @author Garrett Burroughs + * @version 0.1 + * @since 0.1 + */ +public class Deadzone extends Toggleable implements Step { + + /** the threshold value that the input has to be lower than for the step to return 0 */ + private double tolerance; + + /** Create a deadzone specifying the tolerance */ + public Deadzone(double tolerance) { + this.tolerance = tolerance; + } + + /** Create a deadzone with a default tolerance of 0.05 */ + public Deadzone() { + this(0.05); + } + + @Override + public Double getOutput(Double input) { + if (status.isEnabled()) { + return input < tolerance ? 0 : input; + } else { + return input; + } + } + + @Override + public void enableAction() { + // Do nothing because all action is taken care of + } + + @Override + public void disableAction() { + // Do nothing because all action is taken care of + } + + /** @return the threshold value */ + public double getTolerance() { + return tolerance; + } + + /** set the threshold value */ + public void setTolerance(int tolerance) { + this.tolerance = tolerance; + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/steps/VectorDeadzone.java b/src/main/java/org/montclairrobotics/alloy/steps/VectorDeadzone.java new file mode 100644 index 0000000..c66f2a0 --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/steps/VectorDeadzone.java @@ -0,0 +1,79 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.steps; + +import org.montclairrobotics.alloy.components.Step; +import org.montclairrobotics.alloy.utils.Toggleable; +import org.montclairrobotics.alloy.vector.Vector; +/** + * A step that returns 0 if the inputs magnitude is under a certain threshold + * + * @author Garrett Burroughs + * @version 0.1 + * @since 0.1 + */ +public class VectorDeadzone extends Toggleable implements Step { + + /** the threshold value that the input has to be lower than for the step to return 0 */ + private double tolerance; + + /** Create a VectorDeadzone specifying the tolerance */ + public VectorDeadzone(double tolerance) { + this.tolerance = tolerance; + } + + /** Create a VectorDeadzone with a default tolerance of 0.05 */ + public VectorDeadzone() { + this(0.05); + } + + @Override + public Vector getOutput(Vector input) { + if (status.isEnabled()) { + return input.getManitude() < tolerance ? Vector.ZERO : input; + } else { + return input; + } + } + + @Override + public void enableAction() { + // Do nothing because all action is taken care of + } + + @Override + public void disableAction() { + // Do nothing because all action is taken care of + } + + /** @return the threshold value */ + public double getTolerance() { + return tolerance; + } + + /** set the threshold value */ + public void setTolerance(double tolerance) { + this.tolerance = tolerance; + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/test/IntakeMapper.java b/src/main/java/org/montclairrobotics/alloy/test/IntakeMapper.java new file mode 100644 index 0000000..1dc7e68 --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/test/IntakeMapper.java @@ -0,0 +1,42 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.test; + +import org.montclairrobotics.alloy.motor.Mapper; +import org.montclairrobotics.alloy.motor.MotorModule; +import org.montclairrobotics.alloy.utils.Utils; +import org.montclairrobotics.alloy.vector.Vector; + +public class IntakeMapper implements Mapper { + @Override + public void map(Vector input, MotorModule... modules) { + for (MotorModule m : modules) { + if (m.getOffset().getX() > 0) { + m.setPower((input.getY() + input.getX()) * Utils.sign(m.getDirection().getY())); + } else { + m.setPower((input.getY() - input.getX()) * Utils.sign(m.getDirection().getY())); + } + } + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/test/Shooter.java b/src/main/java/org/montclairrobotics/alloy/test/Shooter.java deleted file mode 100644 index f616084..0000000 --- a/src/main/java/org/montclairrobotics/alloy/test/Shooter.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.montclairrobotics.alloy.test; - -import org.montclairrobotics.alloy.components.Component; -import org.montclairrobotics.alloy.core.Debug; -import org.montclairrobotics.alloy.core.PoweredMotor; -import org.montclairrobotics.alloy.ftc.FTCMotor; -import org.montclairrobotics.alloy.utils.Toggleable; - -import java.util.ArrayList; - -public class Shooter extends Component { - PoweredMotor motorR = new FTCMotor("Right PoweredMotor"); - PoweredMotor motorL = new FTCMotor("Left PoweredMotor"); - - public Shooter(){ - super(); - addDebugs(motorL.getDebugs()); - addDebugs(motorR.getDebugs()); - } - - @Override - public void enableAction() { - motorR.setMotorPower(1); - motorL.setMotorPower(1); - } - - @Override - public void disableAction() { - motorR.setMotorPower(0); - motorL.setMotorPower(0); - } -} diff --git a/src/main/java/org/montclairrobotics/alloy/test/SquareAuto.java b/src/main/java/org/montclairrobotics/alloy/test/SquareAuto.java new file mode 100644 index 0000000..728af90 --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/test/SquareAuto.java @@ -0,0 +1,54 @@ +/* +MIT License + +Copyright (c) 2019 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.test; + +import org.montclairrobotics.alloy.auto.SimpleAutonomous; +import org.montclairrobotics.alloy.auto.States.Turn; +import org.montclairrobotics.alloy.vector.Angle; + +public class SquareAuto extends SimpleAutonomous { + + @Override + public void setup() { + Turn.setTicksPerDegree(10); // This is a dummy value, this value will need to be tested for + + /* + Keep in mind, even though states can be added like this, because they are created by methods inherited from + Simple autonomous, they are not actually run right here. + This means that you can not conditional add states here, for example + + if(sensor.value > 5){ + drive(1, 5); + } + a + would not work, because it would be reading the sensor value on startup. + If you want to run states conditionally, use ConditionalState + */ + for (int i = 0; i < 4; i++) { + // These functions come from SimpleAutonomous, they just add a new state to the state machine + drive(1, 100); + turn(1, new Angle(90)); + } + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/test/TestRobot.java b/src/main/java/org/montclairrobotics/alloy/test/TestRobot.java index cfac47a..e994a9f 100644 --- a/src/main/java/org/montclairrobotics/alloy/test/TestRobot.java +++ b/src/main/java/org/montclairrobotics/alloy/test/TestRobot.java @@ -1,36 +1,137 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.test; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; +import org.montclairrobotics.alloy.components.InputComponent; +import org.montclairrobotics.alloy.core.*; +import org.montclairrobotics.alloy.drive.DriveTrain; +import org.montclairrobotics.alloy.drive.TankDrive; +import org.montclairrobotics.alloy.ftc.FTCJoystick; +import org.montclairrobotics.alloy.ftc.FTCMotor; +import org.montclairrobotics.alloy.motor.MotorGroup; +import org.montclairrobotics.alloy.motor.MotorModule; +import org.montclairrobotics.alloy.steps.Deadzone; +import org.montclairrobotics.alloy.utils.PID; +import org.montclairrobotics.alloy.vector.XY; + +/* +This class is solely for testing and example of the Alloy framework + +This is an implementation of a basic robot using the fundamental +features of Alloy, much more is possible, and this example is far +from all encompassing of the features that you can use, and how to +use them, but meant as a basic start to get an Idea of what Alloy is +and how to use it. -import org.montclairrobotics.alloy.control.ToggleButton; -import org.montclairrobotics.alloy.core.Alloy; -import org.montclairrobotics.alloy.ftc.FTCButton; -import org.montclairrobotics.alloy.utils.Input; +Also keep in mind, that this is not necessarily how a robot "should" +be implemented. Some of this code is written purely to show that something +is possible, while not being necessary for a basic application. As well as +the fact that each robot is different and the code will be heavily dependant +on that, and alloy allows for the design of many different robots and parts. + */ @TeleOp public class TestRobot extends Alloy { + // Lower level hardware abstractions + FTCMotor rightIntakeMotor; + FTCMotor leftIntakeMotor; + FTCMotor d_rightFront; + FTCMotor d_rightBack; + FTCMotor d_leftFront; + FTCMotor d_leftBack; - Shooter shooter; + // Higher Level Hardware abstractions + MotorGroup intake; + + // Global motor control + PID motorCorrection; + + // Physical control systems + InputComponent intakeController; + InputComponent driveStick; @Override public void robotSetup() { - shooter = new Shooter(); - } - @Override - public void initialization() { + // ============================================================================================================= + // EXAMPLE DRIVETRAIN SETUP + // ============================================================================================================= + + // Create Drivetrain Modules (wheels) + // By making it a tank drive, we use the default tank drive mapper + DriveTrain dt = + new TankDrive( + new MotorModule(new XY(1, 0), d_rightFront, d_rightBack), + new MotorModule(new XY(-1, 0), d_leftFront, d_leftBack)); + // Create the Drivetrain input + driveStick = new FTCJoystick(RobotCore.getGamepad1(), FTCJoystick.Side.RIGHT); + + // Add modifiers toe the controls + driveStick.addStep(new Deadzone()); + + // Set the Drivetrain Input + dt.setInput(driveStick); + + // ============================================================================================================= + // EXAMPLE INTAKE SETUP + // ============================================================================================================= + + // Define the PID Correction + motorCorrection = new PID(1, 0, 0); + + // Create the input + intakeController = new FTCJoystick(RobotCore.getGamepad2(), FTCJoystick.Side.RIGHT); + // Modify the input + intakeController.addStep(new Deadzone()); + + // Get the encoders from the motors + Encoder intakeRightEncoder = + rightIntakeMotor + .getEncoder() + .setMaxSpeed(100) + .setDistancePerTick(30); // These 100, and 30, are experimental values + Encoder intakeLeftEncoder = + rightIntakeMotor.getEncoder().setMaxSpeed(100).setDistancePerTick(30); + + // Define the right and left modules + MotorModule intakeRightSide = + new MotorModule( + new XY(0, 1), intakeRightEncoder, motorCorrection, rightIntakeMotor); + MotorModule intakeLeftSide = + new MotorModule(new XY(0, 1), intakeLeftEncoder, motorCorrection, leftIntakeMotor); + + // Create the intake + intake = + new MotorGroup( + intakeController, new IntakeMapper(), intakeRightSide, intakeLeftSide); } @Override - public void periodic() { - Input shooterButton = new Input() { - @Override - public Boolean get() { - return gamepad1.a; - } - }; - - new ToggleButton(new FTCButton(shooterButton), shooter); - } + public void initialization() {} + + @Override + public void periodic() {} } diff --git a/src/main/java/org/montclairrobotics/alloy/update/Updatable.java b/src/main/java/org/montclairrobotics/alloy/update/Updatable.java deleted file mode 100644 index 7b26128..0000000 --- a/src/main/java/org/montclairrobotics/alloy/update/Updatable.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.montclairrobotics.alloy.update; - -import org.montclairrobotics.alloy.components.Component; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Parameter; - -/** - * Created by MHS Robotics on 2/11/2018. - * - * @author Garrett Burroughs - * @since 0.1 - */ -public class Updatable { - private Method update; - private int updateRate; - private Class clazz; - private Parameter[] parameters; - - Updatable(Method update, int updateRate, Class clazz, Parameter[] parameters) { - this.update = update; - this.updateRate = updateRate; - this.clazz = clazz; - this.parameters = parameters; - } - - public void run(){ - if(parameters.length != 0){ - throw new RuntimeException("UPDATED METHODS CAN NOT HAVE PARAMETERS"); - } - try { - for(Component component : Component.getComponents()) { - if (component.getClass().equals(clazz)) { - update.invoke(component, (Object[]) parameters); - } - } - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { - e.printStackTrace(); - } - } - - public int getUpdateRate(){ - return updateRate; - } -} diff --git a/src/main/java/org/montclairrobotics/alloy/update/Update.java b/src/main/java/org/montclairrobotics/alloy/update/Update.java index f9db354..da498fa 100644 --- a/src/main/java/org/montclairrobotics/alloy/update/Update.java +++ b/src/main/java/org/montclairrobotics/alloy/update/Update.java @@ -1,3 +1,26 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.update; import java.lang.annotation.ElementType; @@ -5,9 +28,20 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * Indicates that the annotated method will be updated by the updater + * + *

All methods annotated with @Update, will be added to the updater, but can only be successfully + * updated if the method exists within a {@link org.montclairrobotics.alloy.components.Component} + * + * @author Garrett Burroughs + * @version 0.1 + * @since 0.1 + */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD}) public @interface Update { int updateRate() default 1; + int priority() default 0; } diff --git a/src/main/java/org/montclairrobotics/alloy/update/Updateable.java b/src/main/java/org/montclairrobotics/alloy/update/Updateable.java new file mode 100644 index 0000000..8218a78 --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/update/Updateable.java @@ -0,0 +1,95 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.update; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Parameter; +import java.util.ArrayList; +import org.montclairrobotics.alloy.components.Component; +import org.montclairrobotics.alloy.exceptions.UpdateException; + +/** + * A class used for creating objects that can be updated by the Updater + * + *

An updateable contains a method to be updates along with any extra information needed for it + * to be properly called and updated like the update rate, parameters and objects that it should be + * invoked on + * + * @see Updater + * @author Garrett Burroughs + * @since 0.1 + */ +public class Updateable { + + /** The method that will be called when it is updated */ + private Method update; + + /** How often the updateable should be updated */ + private int updateRate; + + /** The class that contains the method */ + private Class clazz; + + /** Any parameters for the method (This should be empty) */ + private Parameter[] parameters; + + /** All objects that the method needs to be called on */ + private ArrayList objects; + + Updateable(Method update, int updateRate, Class clazz, Parameter[] parameters) { + this.update = update; + this.updateRate = updateRate; + this.clazz = clazz; + this.parameters = parameters; + } + + /** Gets references to all of the object that the update method should be called on */ + public void getReferences() { + for (Component c : Component.getComponents()) { + if (c.getClass().equals(clazz)) { + objects.add(c); + } + } + } + + public void run() { + if (parameters.length != 0) { + throw new UpdateException("UPDATED METHODS CAN NOT HAVE PARAMETERS"); + } + try { + for (Object o : objects) { + update.invoke(o, (Object[]) parameters); + } + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } + } + + public int getUpdateRate() { + return updateRate; + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/update/Updater.java b/src/main/java/org/montclairrobotics/alloy/update/Updater.java index e572368..405e93c 100644 --- a/src/main/java/org/montclairrobotics/alloy/update/Updater.java +++ b/src/main/java/org/montclairrobotics/alloy/update/Updater.java @@ -1,60 +1,118 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.update; +import java.lang.annotation.Annotation; +import java.lang.reflect.Method; +import java.util.*; +import org.montclairrobotics.alloy.components.Component; import org.reflections.Reflections; import org.reflections.scanners.MethodAnnotationsScanner; import org.reflections.scanners.SubTypesScanner; -import java.lang.annotation.Annotation; -import java.lang.reflect.Method; -import java.util.Comparator; -import java.util.Set; -import java.util.TreeMap; - /** * Created by MHS Robotics on 12/5/2017. * * @author Garrett Burroughs * @since 0.1 */ - -//I'm making my life so much harder than it has to be because I hate myself public class Updater { + /** + * Keeps track of the number of times the updater has run Used in diagnostics and calculating + * when to update methods + */ private static int counter; - private static TreeMap updateables = new TreeMap<>(new Comparator() { - @Override - public int compare(Integer o1, Integer o2) { - return o2 - o1; - } - }); + private static TreeMap updateables = + new TreeMap<>( + new Comparator() { + @Override + public int compare(Integer o1, Integer o2) { + return o2 - o1; + } + }); + public static void registerUpdatables() { + // Create an arraylist to store all package names + ArrayList packageReferences = new ArrayList<>(); + // Create an arraylist of all the reflections that will later be used to get annotated methods + ArrayList reflections = new ArrayList<>(); + // Create a set of all the methods + Set methods = new HashSet<>(); - public static void registerUpdatables() { - String userFiles = ""; - Reflections alloyReflections = new Reflections("org.montclairrobotics", new MethodAnnotationsScanner(), new SubTypesScanner()); - // Reflections userRefelecitons = new Reflections(userFiles); - System.out.println(alloyReflections.getMethodsAnnotatedWith(Update.class)); + // Iterate through all of the components to get the package + for (Object o : Component.getComponents()) { + System.out.println(o.getClass().getPackage().getName()); + // Check if the package has already been added + if (!packageReferences.contains(o.getClass().getPackage().getName())) { + packageReferences.add(o.getClass().getPackage().getName()); // add the package + } + } - Set methods = alloyReflections.getMethodsAnnotatedWith(Update.class); - for(Method method : methods){ + // Iterate through all of the package referneces to create a reflections object + for (String p : packageReferences) { + reflections.add( + new Reflections(p, new MethodAnnotationsScanner(), new SubTypesScanner())); + } + + // Get all update methods + for (Reflections r : reflections) { + methods.addAll(r.getMethodsAnnotatedWith(Update.class)); + } + // Loop through all methods and create Updateable objects + for (Method method : methods) { int updateRate = 1; int priority = 0; - for(Annotation annotation : method.getDeclaredAnnotations()){ - if(annotation instanceof Update){ + for (Annotation annotation : method.getDeclaredAnnotations()) { + if (annotation instanceof Update) { updateRate = ((Update) annotation).updateRate(); priority = ((Update) annotation).priority(); } } - updateables.put(priority, new Updatable(method, updateRate, method.getDeclaringClass(), method.getParameters())); + updateables.put( + priority, + new Updateable( + method, + updateRate, + method.getDeclaringClass(), + method.getParameters())); + } + for (Updateable u : updateables.values()) { + u.getReferences(); } } - + /** + * The update method takes care of updating all of the methods in the project that are within a + * component and are annotated with @Update It will also check the Update rate and decide + * weather to update the method accordingly + */ public static void update() { - for (Updatable updatable : updateables.values()){ - if(counter % updatable.getUpdateRate() == 0){ - updatable.run(); + for (Updateable updateable : updateables.values()) { + if (counter % updateable.getUpdateRate() == 0) { + updateable.run(); } } } diff --git a/src/main/java/org/montclairrobotics/alloy/utils/BangBang.java b/src/main/java/org/montclairrobotics/alloy/utils/BangBang.java new file mode 100644 index 0000000..43f2079 --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/utils/BangBang.java @@ -0,0 +1,98 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.utils; + +import org.montclairrobotics.alloy.components.InputComponent; +import org.montclairrobotics.alloy.update.Update; + +/** + * Simple error correction, that returns one value if the error is high, and another if it is low + * + *

Bang bang error correction, checks if the error is higher or lower than a target, and returns + * an output based on that result. This is not a very good, accurate or reliable way of error + * correcting but can be useful in some cases where more exact error correction is not needed + * + * @author Garrett Burroughs + * @version 0.1 + * @since 0.1 + */ +public class BangBang extends InputComponent implements ErrorCorrection { + + public double target; + public double lowOut; + public double highOut; + + public BangBang(double lowOut, double highOut) { + this.lowOut = lowOut; + this.highOut = highOut; + } + + public BangBang(double correction) { + this(-correction, correction); + } + + /** + * Set the target for the correction When the input is equal to the target the error is 0 + * + * @param target the goal of the error correction + */ + @Override + public BangBang setTarget(Double target) { + this.target = target; + return this; + } + + @Override + public BangBang setInput(Input input) { + this.input = input; + return this; + } + + /** + * Get the value to apply the correction + * + * @return the correction + */ + @Override + public Double getCorrection() { + return output; + } + + /** @return A copy of the error correction */ + @Override + public BangBang copy() { + return new BangBang(lowOut, highOut).setTarget(target).setInput(input); + } + + @Update + public void calculateCorrection() { + if (input.get() > target) { + output = highOut; + } else if (input.get() < target) { + output = lowOut; + } else { + output = 0d; + } + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/utils/BooleanToggle.java b/src/main/java/org/montclairrobotics/alloy/utils/BooleanToggle.java new file mode 100644 index 0000000..d1d73ea --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/utils/BooleanToggle.java @@ -0,0 +1,51 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.utils; + +/** + * An input that can be toggled between true and false + * + * @author Garrett Burroughs + * @version 0.1 + * @since 0.1 + */ +public class BooleanToggle extends Toggleable implements Input { + + @Override + public Boolean get() { + return status.isEnabled(); + } + + @Override + /** Method to be called when the toggleable is enabled */ + public void enableAction() { + // Do nothing because all the action it taken care of by toggle() + } + + @Override + /** Method to be called when the toggleable is disabled */ + public void disableAction() { + // Do nothing because all the action it taken care of by toggle() + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/utils/ConstantInput.java b/src/main/java/org/montclairrobotics/alloy/utils/ConstantInput.java index 4254bd9..9e9e3b5 100644 --- a/src/main/java/org/montclairrobotics/alloy/utils/ConstantInput.java +++ b/src/main/java/org/montclairrobotics/alloy/utils/ConstantInput.java @@ -1,28 +1,55 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.utils; /** * Created by MHS Robotics on 3/30/2018. * - * The constant input can be used when a object or method requires an Input, - * but the input will not change. This can be useful in testing and debugging, - * As well as certain component implementations + *

The constant input can be used when a object or method requires an Input, but the input will + * not change. This can be useful in testing and debugging, As well as certain component + * implementations * * @author Garrett Burroughs - * @since + * @version 0.1 + * @since 0.1 */ public class ConstantInput implements Input { - - /** - * The constant to be returned by the input - */ - T constant; - - public ConstantInput(T constant){ + + /** The constant to be returned by the input */ + private T constant; + + public ConstantInput(T constant) { this.constant = constant; } - + @Override public T get() { - return null; + return constant; + } + + /** Sets the value that the input will return */ + public void setConstantValue(T constant) { + this.constant = constant; } } diff --git a/src/main/java/org/montclairrobotics/alloy/utils/Differential.java b/src/main/java/org/montclairrobotics/alloy/utils/Differential.java new file mode 100644 index 0000000..0f25ec6 --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/utils/Differential.java @@ -0,0 +1,73 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.utils; + +import org.montclairrobotics.alloy.components.InputComponent; +import org.montclairrobotics.alloy.update.Update; + +/** + * A class to calculate how an input varies with time + * + *

A differential is the rate of change of a certain variable with respect to another one. In + * simpler terms is is the slope. The Differential class takes an input and calculates the average + * rate of change over a very small interval of the input with respect to time + * + *

This concept is a calculus concept when and can be most easily understood when looking at a + * graph where time is the independent variable and the input is dependant on the time + * + *

For example, a time differential of position would be velocity because velocity is how much + * the position changes over time (eg. meters per second) + * + * @author Garrett Burroughs + * @since 0.1 + * @version 0.1 + */ +public class Differential extends InputComponent { + /** The dependant variable in the situation */ + public Input input; + + private double prevTime; + private double prevIn; + + public Differential(Input in) { + input = in; + } + + @Update + public void calculateDifferential() { + double elapsedTime = System.nanoTime() - prevTime; // Calculate how much time has passed + double elapsedIn = input.get() - prevIn; // Caclulate how much the input has changed + if (System.nanoTime() != 0) { // Avoid a divide by zero error + output = elapsedIn / elapsedTime; // Return the slope (Delta Input / Delta time) + } else { + output = 0.0; + } + prevIn = input.get(); // set previous input to current input for next calculation + prevTime = System.nanoTime(); // Set previous time to current time for next calculation + } + + public Double getInput() { + return input.get(); + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/utils/ErrorCorrection.java b/src/main/java/org/montclairrobotics/alloy/utils/ErrorCorrection.java new file mode 100644 index 0000000..5f6e57f --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/utils/ErrorCorrection.java @@ -0,0 +1,68 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.utils; + +/** + * A interface that defines the process of correcting an error + * + *

Error correction can be implemented in different ways but is very important in creating a + * functional robot. The most common + * + *

Most error corrections calculate the error based on the difference of the input and the target + * and then return an output correction based on that. + * + *

Some common examples of error corrections are - PID Loop - Bang Bang control + * + * @see PID + * @param the type of error that will be corrected + * @version 0.1 + * @since 0.1 + */ +public interface ErrorCorrection { + + /** + * Set the input of the error correction the input should be the source of what correction is + * correcting. For example in a motor the input would be the encoder + * + * @param input the input to the error correction + */ + public ErrorCorrection setInput(Input input); + + /** + * Set the target for the correction When the input is equal to the target the error is 0 + * + * @param target the goal of the error correction + */ + public ErrorCorrection setTarget(T target); + + /** + * Get the value to apply the correction + * + * @return the correction + */ + public T getCorrection(); + + /** @return A copy of the error correction */ + public ErrorCorrection copy(); +} diff --git a/src/main/java/org/montclairrobotics/alloy/utils/GyroCorrection.java b/src/main/java/org/montclairrobotics/alloy/utils/GyroCorrection.java new file mode 100644 index 0000000..c0b30e3 --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/utils/GyroCorrection.java @@ -0,0 +1,47 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.utils; + +import org.montclairrobotics.alloy.components.InputComponent; +import org.montclairrobotics.alloy.update.Update; + +/** + * A correction based on a gyroscope, to keep a consistent heading + * + * @author Garrett Burroughs + * @version 0.1 + * @since 0.1 + */ +public class GyroCorrection extends InputComponent { + private double correction; + + @Update + public void calculateCorrection() { + output = correction; + } + + public double getCorrection() { + return correction; + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/utils/Initializeable.java b/src/main/java/org/montclairrobotics/alloy/utils/Initializeable.java new file mode 100644 index 0000000..62e13a0 --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/utils/Initializeable.java @@ -0,0 +1,42 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.utils; + +import org.montclairrobotics.alloy.core.Alloy; + +/** + * An object that gets initialized once at the beginning of the teleop mode + * + * @author Garrett Burroughs + * @version 0.1 + * @since 0.1 + */ +public abstract class Initializeable { + + public Initializeable() { + Alloy.initObjects.add(this); + } + /** the method that is called at the beginning of the teleop mode */ + public abstract void init(); +} diff --git a/src/main/java/org/montclairrobotics/alloy/utils/Input.java b/src/main/java/org/montclairrobotics/alloy/utils/Input.java index 5b5bee3..ad1e119 100644 --- a/src/main/java/org/montclairrobotics/alloy/utils/Input.java +++ b/src/main/java/org/montclairrobotics/alloy/utils/Input.java @@ -1,9 +1,37 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.utils; /** - * Created by MHS Robotics on 2/2/2018. + * A dynamically stored input + * + *

Instead of storing a value, an input creates a method to get the value so if an object is + * created with an input, whenever it tries to access the input it will access the most up to date + * value of that input, rather than a constant value when the object is created * * @author Garrett Burroughs + * @version 0.1 * @since 0.1 */ public interface Input { diff --git a/src/main/java/org/montclairrobotics/alloy/utils/Monitor.java b/src/main/java/org/montclairrobotics/alloy/utils/Monitor.java index a1165fa..bc49469 100644 --- a/src/main/java/org/montclairrobotics/alloy/utils/Monitor.java +++ b/src/main/java/org/montclairrobotics/alloy/utils/Monitor.java @@ -1,37 +1,55 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.utils; /** * Created by MHS Robotics on 3/12/2018. * - * A monitor is a class that takes in 2 inputs, and returns true when they are within a certain tolerance - * This can be good for monitoring if certain systems are working, for example if a motor is spinning at a desired speed - * and can also be used to monitor a sensor to see if it has reached a certain value. + *

A monitor is a class that takes in 2 inputs, and returns true when they are within a certain + * tolerance This can be good for monitoring if certain systems are working, for example if a motor + * is spinning at a desired speed and can also be used to monitor a sensor to see if it has reached + * a certain value. * * @author Garrett Burroughs * @since 0.1 */ public class Monitor implements Input { - /** - * The desired target for the input - */ + /** The desired target for the input */ public Input target; - - /** - * The input to be checked - */ + + /** The input to be checked */ public Input input; - - /** - * How far the input can be away from the target while still being true - */ + + /** How far the input can be away from the target while still being true */ public double tolerance; - + public Monitor(Input target, Input input, double tolerance) { this.target = target; this.input = input; this.tolerance = tolerance; } - + @Override public Boolean get() { return Math.abs(target.get() - input.get()) < tolerance; diff --git a/src/main/java/org/montclairrobotics/alloy/utils/PID.java b/src/main/java/org/montclairrobotics/alloy/utils/PID.java index 30591d7..e0524ee 100644 --- a/src/main/java/org/montclairrobotics/alloy/utils/PID.java +++ b/src/main/java/org/montclairrobotics/alloy/utils/PID.java @@ -1,62 +1,99 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.utils; import org.montclairrobotics.alloy.components.InputComponent; +import org.montclairrobotics.alloy.exceptions.InvalidConfigurationException; import org.montclairrobotics.alloy.update.Update; /** * Created by Montclair robotics on 2/27/2018 * - * A PID controller is able to control a component that has a target, current state, and can be controlled for example: - * - A robots heading using a Gryo - * - A motors position using encoders + *

A PID controller is able to control a component that has a target, current state, and can be + * controlled for example: - A robots heading using a Gryo - A motors position using encoders * - * PID stands for Proportion, Integral and Derivative control. - * It uses the error of a component and then calculates the correction - * the PID values must be tuned in order to have a working PID loop - * A properly tuned implementation of a PID controller should result in a correction that goes fast, and accurate to - * its target, and does not overshoot it. + *

PID stands for Proportion, Integral and Derivative control. It uses the error of a component + * and then calculates the correction the PID values must be tuned in order to have a working PID + * loop A properly tuned implementation of a PID controller should result in a correction that goes + * fast, and accurate to its target, and does not overshoot it. * - * You can read more about implementing PID control here https://github.com/GarrettBurroughs/Alloy/wiki/Using-PID-control - * You can read more about how PID works here https://en.wikipedia.org/wiki/PID_controller + *

You can read more about implementing PID control here + * https://github.com/GarrettBurroughs/Alloy/wiki/Using-PID-control You can read more + * about how PID works here https://en.wikipedia.org/wiki/PID_controller * * @author Garrett Burroughs * @since 0.1 + * @version 0.1 */ -public class PID extends InputComponent { +public class PID extends InputComponent implements ErrorCorrection { private double p; private double i; private double d; private double target; - /** The error of the PID, calculated by the target - input*/ + /** The error of the PID, calculated by the target - input */ private double error; - /** The rate that the error is changing on a certain interval (Slope of the error if it were graphed) AKA derivative*/ + /** + * The rate that the error is changing on a certain interval (Slope of the error if it were + * graphed) AKA derivative + */ private double errorRate; - /** The total error that has accumulated over time (Area under the graph if the error were graphed) AKA Integral*/ + + /** + * The total error that has accumulated over time (Area under the graph if the error were + * graphed) AKA Integral + */ private double totalError; - /** The error of the previous calculation, used for calculating the rate of error*/ + + /** The error of the previous calculation, used for calculating the rate of error */ private double prevError; - /** The time of the previous calculation, used for calculating the rate of error*/ + + /** The time of the previous calculation, used for calculating the rate of error */ private double prevTime; - /** The difference in time between update loops*/ + + /** The difference in time between update loops */ private double timeDifference; - /** The difference in error between update loops*/ + + /** The difference in error between update loops */ private double errorDifference; - + /** * Create a new PID + * * @param p proportional constant * @param i integral constant * @param d derivative constant */ - public PID(double p, double i, double d){ + public PID(double p, double i, double d) { this.p = p; this.i = i; this.d = d; } - + /** * Create a new PID with the input and target defined + * * @param p proportional constan * @param i integral constant * @param d derivative constant @@ -71,27 +108,27 @@ public PID(double p, double i, double d, Input input, double target) { this.target = target; } - public PID setTarget(double target){ + @Override + public PID setTarget(Double target) { this.target = target; return this; } - public void setInput(Input input){ + @Override + public PID setInput(Input input) { this.input = input; + return this; } - /** - * The update method should be defined for every updatable, and is called every loop if added to the updater - */ - @Update public void update() { // Calculate Error try { error = target - input.get(); - }catch(NullPointerException e){ - throw new RuntimeException("PID input has not been defined use pid.setInput(Input input), to set it"); + } catch (NullPointerException e) { + throw new InvalidConfigurationException( + "PID input has not been defined use pid.setInput(Input input), to set it"); } // calculate time difference in time since the last update @@ -103,7 +140,7 @@ public void update() { // Calculate slope of the error (Derivative) change in error / change in time try { errorRate = errorDifference / timeDifference; - }catch(ArithmeticException e){ + } catch (ArithmeticException e) { errorRate = 0; } @@ -111,28 +148,24 @@ public void update() { totalError += error; // Calculate Correction and set the output - if(status.booleanValue()) { + if (status.isEnabled()) { output = p * error + i * totalError + d * errorRate; - }else{ + } else { output = 0d; } prevError = error; - prevTime = System.currentTimeMillis()/1000d; + prevTime = System.currentTimeMillis() / 1000d; } - /** - * Method to be called when the toggleable is enabled - */ + /** @return the calculated correction */ @Override - public void enableAction() { - + public Double getCorrection() { + return output; } - /** - * Method to be called when the toggleable is disabled - */ + /** @return A copy of the error correction */ @Override - public void disableAction() { - + public ErrorCorrection copy() { + return new PID(p, i, d).setTarget(target).setInput(input); } } diff --git a/src/main/java/org/montclairrobotics/alloy/utils/Toggleable.java b/src/main/java/org/montclairrobotics/alloy/utils/Toggleable.java index 1973034..ce27d9a 100644 --- a/src/main/java/org/montclairrobotics/alloy/utils/Toggleable.java +++ b/src/main/java/org/montclairrobotics/alloy/utils/Toggleable.java @@ -1,75 +1,83 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.utils; /** * Created by MHS Robotics on 2/11/2018. * - * Toggleables are used for objects of mechanisms that can - * either be on (Enabled), or off toggleables can have - * actions defined for when they are enabled and disabled, - * as well as be tied to different parts of alloy like - * buttons and auto states - * @see org.montclairrobotics.alloy.control.ToggleButton + *

Toggleables are used for objects of mechanisms that can either be on (Enabled), or off + * toggleables can have actions defined for when they are enabled and disabled, as well as be tied + * to different parts of alloy like buttons and auto states * + * @see org.montclairrobotics.alloy.control.ToggleButton * @author Garrett Burroughs * @since 0.1 */ public abstract class Toggleable { - - /** - * Method to be called when the toggleable is enabled - */ + + /** The status of the toggleable, to keep track of weather it is enabled, or disabled */ + public Status status; + + /** Method to be called when the toggleable is enabled */ public abstract void enableAction(); - - /** - * Method to be called when the toggleable is disabled - */ + + /** Method to be called when the toggleable is disabled */ public abstract void disableAction(); - - /** - * The status of the toggleable, to keep track of weather it is enabled, or disabled - */ - public Status status; - - - public enum Status{ + + public enum Status { ENABLED(true), DISABLED(false); - - + boolean enabled; - private Status(boolean enabled){ + + Status(boolean enabled) { this.enabled = enabled; } - - public boolean booleanValue(){ + + public boolean isEnabled() { return enabled; } } - - /** - * Enables the toggleable - */ - public void enable(){ + + /** Enables the toggleable */ + public void enable() { status = Status.ENABLED; enableAction(); } - - - /** - * Disables the toggleable - */ - public void disable(){ + + /** Disables the toggleable */ + public void disable() { status = Status.DISABLED; disableAction(); } - + /** - * Switches(Toggles), between the two states, - * If the toggleable is disabled, enable it - * If the toggleable is enabled, disable it + * Switches(Toggles), between the two states, If the toggleable is disabled, enable it If the + * toggleable is enabled, disable it */ - public void toggle(){ - switch (status){ + public void toggle() { + switch (status) { case ENABLED: disable(); break; diff --git a/src/main/java/org/montclairrobotics/alloy/utils/TuneablePID.java b/src/main/java/org/montclairrobotics/alloy/utils/TuneablePID.java index 6936ed5..385d987 100644 --- a/src/main/java/org/montclairrobotics/alloy/utils/TuneablePID.java +++ b/src/main/java/org/montclairrobotics/alloy/utils/TuneablePID.java @@ -1,6 +1,77 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.utils; -public class TuneablePID { +import org.montclairrobotics.alloy.components.InputComponent; + +/** + * A PID class that takes in tunable inputs to make PID tuning easier + * + *

Using a standard PID model, the user would have to re-deploy an test code which can end up + * becoming a very long and drawn out process. By making them inputs, it is able to change these + * values at runtime This could be done easily in FRC using smartdashboard or in FTC by using + * buttons or joysticks to change values + * + * @author Garrett Burroughs + * @version 0.1 + * @since 0.1 + */ +public class TuneablePID extends InputComponent implements ErrorCorrection { + + /** + * Set the input of the error correction the input should be the source of what correction is + * correcting. For example in a motor the input would be the encoder + * + * @param input the input to the error correction + */ + @Override + public TuneablePID setInput(Input input) { + return this; + } + + /** + * Set the target for the correction When the input is equal to the target the error is 0 + * + * @param target the goal of the error correction + */ + @Override + public TuneablePID setTarget(Double target) { + return this; + } + /** + * Get the value to apply the correction + * + * @return the correction + */ + @Override + public Double getCorrection() { + return null; + } + @Override + public ErrorCorrection copy() { + return new TuneablePID(); + } } diff --git a/src/main/java/org/montclairrobotics/alloy/utils/Utils.java b/src/main/java/org/montclairrobotics/alloy/utils/Utils.java new file mode 100644 index 0000000..56269cb --- /dev/null +++ b/src/main/java/org/montclairrobotics/alloy/utils/Utils.java @@ -0,0 +1,98 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.utils; + +/** + * A set of common methods that are useful in writing robot code + * + *

The Utils class contains static methods that can perform basic functions that can be useful + * + * @author garrettburroughs + * @version 0.1 + * @since 0.1 + */ +public class Utils { + /** + * Makes sure that a value is between 2 different values + * + *

The constrain method will return the passed in value if it is between the boundaries (min + * & max), amd will return the min or the max depending on which side it runs out on + * + * @param in the value being passed in + * @param min minimum the value can be + * @param max maximum the value can be + * @return a value between the maximum and minimum value + */ + public static double constrain(double in, double min, double max) { + if (in > max) { + return max; + } else if (in < min) { + return min; + } + return in; + } + + /** + * The map function takes an input value that can be between a certain range and maps it to a + * specified output range + * + * @param in the value being passed in + * @param inputMin the minimum value the input can be + * @param inputMax the maximum value the input can be + * @param outputMin the minimum value the output can be + * @param outputMax the maximum value the output can be + * @return a mapped value from the input range to the output range + */ + public static double map( + double in, double inputMin, double inputMax, double outputMin, double outputMax) { + double scaled = + (in - inputMin) / (inputMax - inputMin); // scale the input to a value from 0-1 + double output = + (outputMax - outputMin) * scaled + + outputMin; // adjust the scaled value to fit the output + return output; + } + + /** + * Returns the sign of a number + * + * @param in the number whose sign will be calculated + * @return 1 if the number is positive and -1 if it is negative + */ + public static int sign(double in) { + return in > 0 ? 1 : -1; + } + + /** + * A modified power function that conserves the sign + * + * @param in the number to be raised to a power + * @param pow the power the number will be raised to + * @return in^pow while keeping the sign of in + */ + public static double pow2(double in, int pow) { + double regularResult = Math.pow(in, pow); + return pow % 2 == 0 ? regularResult * sign(in) : regularResult; + } +} diff --git a/src/main/java/org/montclairrobotics/alloy/vector/Angle.java b/src/main/java/org/montclairrobotics/alloy/vector/Angle.java index f41766c..9283ef1 100644 --- a/src/main/java/org/montclairrobotics/alloy/vector/Angle.java +++ b/src/main/java/org/montclairrobotics/alloy/vector/Angle.java @@ -1,12 +1,34 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.vector; /** - * Created by MHS Robotics on 11/13/2017. + * A class to keep track of angles * - * - * The angle class allows for easy management of angles as well as easy conversion between degree and radian - * angle measure - * The class keeps track of the angle in degrees but can easily be converted to radians + *

The angle class allows for easy management of angles as well as easy conversion between degree + * and radian angle measure The class keeps track of the angle in degrees but can easily be + * converted to radians * * @author Garrett Burroughs * @version 0.1 @@ -14,42 +36,38 @@ */ public class Angle { + public static final Angle ZERO = new Angle(0); + public static final Angle HALF_PI = new Angle(90); + public static final Angle PI = new Angle(180); + public static final Angle TWO_PI = new Angle(360); + + /** Keeps Track of the amount of degrees that the angle is */ + private double degrees; /** - * AngleMeasure, is used for keeping track of what type of angle measure the angle is being created with + * AngleMeasure, is used for keeping track of what type of angle measure the angle is being + * created with */ - enum AngleMeasure{ - /** - * Radian Angle Measure - */ + enum AngleMeasure { + /** Radian Angle Measure */ RADIAN, - /** - * Degree Angle Measure - */ + /** Degree Angle Measure */ DEGREE } - /** - * Keeps Track of the degrees that the angle is - */ - private double degrees; - - // Zero Angle - public final Angle ZERO = new Angle(AngleMeasure.DEGREE, 0); - - /** * Creating a new angle with an angle measure unit and the measure of the angle itself * * @param angleMeasure What unit to be used for the angle measure - * @param angle The angle + * @param angle The angle */ - public Angle(AngleMeasure angleMeasure, double angle){ - // If angle is in degrees set degrees to the angle, no conversion is needed because they are the same unit - if(angleMeasure == AngleMeasure.DEGREE){ + public Angle(AngleMeasure angleMeasure, double angle) { + // If angle is in degrees set degrees to the angle, no conversion is needed because they are the + // same unit + if (angleMeasure == AngleMeasure.DEGREE) { degrees = angle; - }else{ + } else { // Convert the radian measure to degrees (radians to degrees: (angle * PI)/180) degrees = angle * (Math.PI / 180); } @@ -60,28 +78,25 @@ public Angle(AngleMeasure angleMeasure, double angle){ * * @param degrees Degree angle measure */ - public Angle(double degrees){ + public Angle(double degrees) { this(AngleMeasure.DEGREE, degrees); } - - - /** * Get the angle measure in degrees * - * @return the degree angle measure + * @return the degree angle measure */ - public double getDegrees(){ + public double getDegrees() { return degrees; } /** * Get the angle measure in radians * - * @return the radian angle measure + * @return the radian angle measure */ - public double getRadians(){ + public double getRadians() { return degrees * (Math.PI / 180); } @@ -90,7 +105,7 @@ public double getRadians(){ * * @param degrees the degree angle measure */ - public void setDegrees(double degrees){ + public void setDegrees(double degrees) { this.degrees = degrees; } @@ -99,8 +114,8 @@ public void setDegrees(double degrees){ * * @param radians the degree angle measure */ - public void setRadians(double radians){ - this.degrees = radians * (180/Math.PI); + public void setRadians(double radians) { + this.degrees = radians * (180 / Math.PI); } /** @@ -108,7 +123,7 @@ public void setRadians(double radians){ * * @return the sine of the angle */ - public double sin(){ + public double sin() { return Math.sin(getRadians()); } @@ -117,7 +132,7 @@ public double sin(){ * * @return the cosine of the angle */ - public double cos(){ + public double cos() { return Math.cos(getRadians()); } @@ -126,8 +141,27 @@ public double cos(){ * * @return the tangent of the angle */ - public double tan(){ + public double tan() { return Math.tan(getRadians()); } + /** + * Creates a new angle using degrees + * + * @param degrees the amount of degrees the new angle will be created with + * @return a new angle + */ + public static Angle createDegrees(double degrees) { + return new Angle(AngleMeasure.DEGREE, degrees); + } + + /** + * Creates a new angle using radians + * + * @param radians the amount of radians the new angle will be created with + * @return a new angle + */ + public static Angle createRadians(double radians) { + return new Angle(AngleMeasure.RADIAN, radians); + } } diff --git a/src/main/java/org/montclairrobotics/alloy/vector/Polar.java b/src/main/java/org/montclairrobotics/alloy/vector/Polar.java index 56f0a99..a3e3a6b 100644 --- a/src/main/java/org/montclairrobotics/alloy/vector/Polar.java +++ b/src/main/java/org/montclairrobotics/alloy/vector/Polar.java @@ -1,23 +1,45 @@ -package org.montclairrobotics.alloy.vector; +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ +package org.montclairrobotics.alloy.vector; /** * Created by MHS Robotics on 11/14/2017. * - * A vector can be defined in rectangular(XY), or polar form.
- * This class is implementation for vectors in Polar form
+ *

A vector can be defined in rectangular(XY), or polar form.
+ * This class is implementation for vectors in Polar form
* It controls the conversions from rectangular to polar and vice versa * - * https://en.wikipedia.org/wiki/Vector_notation - * @see Vector + *

https://en.wikipedia.org/wiki/Vector_notation * + * @see Vector * @author Garrett Burroughs * @version 0.1 * @since 0.1 */ public class Polar implements Vector { private double magnitude; - private Angle angle; + private Angle angle; public Polar(double magnitude, Angle angle) { this.magnitude = magnitude; @@ -108,25 +130,25 @@ public void setAngle(Angle angle) { /** * Adds two vectors together and returns the result + * *

+ * + *

The result of a vector addition will be another vector, One way of adding two vectors + * together is splitting it up into it's x and y components and adding them together and making + * a new vector out of those components
+ * EX:
+ * V1 = 3i + 4j
+ * V2 = 7i + 5j
+ *
+ * V1 + V2 = 3i + 7i + 4j + 5j = 10i + 9j
+ * Geometric Visualization:
+ * Vectors can also be added in a geometric way through the "Tip-To-Tail" method, In this method + * both the vectors are drawn using arrow vector notation + * https://en.wikipedia.org/wiki/Vector_notation one vector is then drawn at the + * edge of the first vector. The resultant vector is then drawn from the start of the first + * vector to the tip of the second vector This is where the name tip to tail comes from + * *

- * The result of a vector addition will be another vector, - * One way of adding two vectors together is splitting it up into it's x and y components and adding them - * together and making a new vector out of those components
- * EX:
- * V1 = 3i + 4j
- * V2 = 7i + 5j
- *
- * V1 + V2 = 3i + 7i + 4j + 5j = 10i + 9j - *
- * Geometric Visualization:
- * Vectors can also be added in a geometric way through the "Tip-To-Tail" method, - * In this method both the vectors are drawn using arrow vector notation https://en.wikipedia.org/wiki/Vector_notation - * one vector is then drawn at the edge of the first vector. - * The resultant vector is then drawn from the start of the first vector to the tip of the second vector - * This is where the name tip to tail comes from - *

- *

* * @param vector The vector to be added * @return The result of the two vectors being added @@ -138,17 +160,17 @@ public Vector add(Vector vector) { /** * Subtracts a vector and returns the result + * *

- *

- * vector subtraction is similar to vector addition but the direction of the vector being subtracted - * is simply reversed
- * EX:
- * V1 = 3i + 4j
- * V2 = 7i + 5j
- *
- * V1 + V2 = 3i + 7i + 4j + 5j = 10i + 9j
- * V1 - V2 = 3i + (-7i) + 4j + (-5j) = -4i + -j
- *

+ * + *

vector subtraction is similar to vector addition but the direction of the vector being + * subtracted is simply reversed
+ * EX:
+ * V1 = 3i + 4j
+ * V2 = 7i + 5j
+ *
+ * V1 + V2 = 3i + 7i + 4j + 5j = 10i + 9j
+ * V1 - V2 = 3i + (-7i) + 4j + (-5j) = -4i + -j
* * @param vector The vector to be subtracted * @return The result of the passed in vector being subtracted from the vector object @@ -171,16 +193,15 @@ public Vector scale(double scalar) { /** * Returns the product of two vectors that have been crossed + * *

- *

- * The result of the cross product is a vector, - * The cross product of a vector is the vector that is perpendicular to both vectors - * When crossing two 2dimensional vectors the result will be a 3dimensional vector - * Because of this this method only returns the magnitude (Z component) of the cross product - * The magnitude of the cross product is same as the area of the parallelogram that the two - * vectors make in the X/Y plane.
+ * + *

The result of the cross product is a vector, The cross product of a vector is the vector + * that is perpendicular to both vectors When crossing two 2dimensional vectors the result will + * be a 3dimensional vector Because of this this method only returns the magnitude (Z component) + * of the cross product The magnitude of the cross product is same as the area of the + * parallelogram that the two vectors make in the X/Y plane.
* https://en.wikipedia.org/wiki/Cross_product - *

* * @param vector the vector to be multiplied using the cross product * @return the magnitude of the cross product of the two vectors @@ -192,18 +213,17 @@ public double cross(Vector vector) { /** * Returns the dot product of two vectors + * *

- *

- * The result of the dot product is a scalar value (number), - * The dot product can be viewed as the projection of one vector on to another times the magnitude of the - * original vector
- * This can be written mathematically as |A||B|cos(theta), where theta is the angle between A and B - * Another mathematical representation of the dot product using its components is:
- * A = {@literal }
- * B = {@literal }
- * A . B = a1*b1 + a2*b2
+ * + *

The result of the dot product is a scalar value (number), The dot product can be viewed as + * the projection of one vector on to another times the magnitude of the original vector
+ * This can be written mathematically as |A||B|cos(theta), where theta is the angle between A + * and B Another mathematical representation of the dot product using its components is:
+ * A = {@literal }
+ * B = {@literal }
+ * A . B = a1*b1 + a2*b2
* https://en.wikipedia.org/wiki/Dot_product - *

* * @param vector The vector to be multiplied using the dot product * @return the scalar result of the dot of the two vectors @@ -237,15 +257,15 @@ public Angle angleBetween(Vector vector) { /** * Normalizes a vector and returns the result + * *

- *

- * A normalized vector is a vector with magnitude 1. - * Normalized vectors are also called unit vectors. - * A normalized vector keeps it's direction as well as the same proportions of its components. - * When a vector is defined by its components it can be normalized it can be expressed as
- * A = {@literal }
- * A' = {@literal }
- *

+ * + *

A normalized vector is a vector with magnitude 1. Normalized vectors are also called unit + * vectors. A normalized vector keeps it's direction as well as the same proportions of its + * components. When a vector is defined by its components it can be normalized it can be + * expressed as
+ * A = {@literal }
+ * A' = {@literal }
* * @return the normalized vector */ diff --git a/src/main/java/org/montclairrobotics/alloy/vector/Vector.java b/src/main/java/org/montclairrobotics/alloy/vector/Vector.java index 0fabfad..de00a6a 100644 --- a/src/main/java/org/montclairrobotics/alloy/vector/Vector.java +++ b/src/main/java/org/montclairrobotics/alloy/vector/Vector.java @@ -1,29 +1,57 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.vector; /** - * Created by MHS Robotics on 11/14/2017.
- *
- * Interface for creating vector classes, implemented in vector.XY and vector.Polar
- *
- * Since a 2D vector can be made up of an angle and a Magnitude or it's vector components (XY) - * The vector interface contains all functionality that a vector should have and it is then implemented - * in each vector subclass
- *
- * NOTE: No mathematical operations are performed on the vector but return a new vector that is the result of the operation
- *
- * To read more about vectors see here https://en.wikipedia.org/wiki/Euclidean_vector
- * To read more about dot products see here https://en.wikipedia.org/wiki/Dot_product
- * To read more about cross products see here https://en.wikipedia.org/wiki/Cross_product
+ * Created by MHS Robotics on 11/14/2017.
+ *
+ * Interface for creating vector classes, implemented in vector.XY and vector.Polar
+ *
+ * Since a 2D vector can be made up of an angle and a Magnitude or it's vector components (XY) The + * vector interface contains all functionality that a vector should have and it is then implemented + * in each vector subclass
+ *
+ * NOTE: No mathematical operations are performed on the vector but return a new vector that is the + * result of the operation
+ *
+ * To read more about vectors see here https://en.wikipedia.org/wiki/Euclidean_vector + *
+ * To read more about dot products see here https://en.wikipedia.org/wiki/Dot_product + *
+ * To read more about cross products see here + * https://en.wikipedia.org/wiki/Cross_product
+ * * @see Polar * @see XY - * - * - * * @author Garrett Burroughs * @version 0.1 * @since 0.1 */ public interface Vector { + + Vector ZERO = new XY(0, 0); + /** * Gets the X component of the vector * @@ -83,24 +111,20 @@ public interface Vector { /** * Adds two vectors together and returns the result * - *

- * The result of a vector addition will be another vector, - * One way of adding two vectors together is splitting it up into it's x and y components and adding them - * together and making a new vector out of those components
- * EX:
- * V1 = 3i + 4j
- * V2 = 7i + 5j
- *
- * V1 + V2 = 3i + 7i + 4j + 5j = 10i + 9j - *
- * Geometric Visualization:
- * Vectors can also be added in a geometric way through the "Tip-To-Tail" method, - * In this method both the vectors are drawn using arrow vector notation https://en.wikipedia.org/wiki/Vector_notation - * one vector is then drawn at the edge of the first vector. - * The resultant vector is then drawn from the start of the first vector to the tip of the second vector - * This is where the name tip to tail comes from - * - *

+ *

The result of a vector addition will be another vector, One way of adding two vectors + * together is splitting it up into it's x and y components and adding them together and making + * a new vector out of those components
+ * EX:
+ * V1 = 3i + 4j
+ * V2 = 7i + 5j
+ *
+ * V1 + V2 = 3i + 7i + 4j + 5j = 10i + 9j
+ * Geometric Visualization:
+ * Vectors can also be added in a geometric way through the "Tip-To-Tail" method, In this method + * both the vectors are drawn using arrow vector notation + * https://en.wikipedia.org/wiki/Vector_notation one vector is then drawn at the + * edge of the first vector. The resultant vector is then drawn from the start of the first + * vector to the tip of the second vector This is where the name tip to tail comes from * * @param vector The vector to be added * @return The result of the two vectors being added @@ -110,17 +134,14 @@ public interface Vector { /** * Subtracts a vector and returns the result * - *

- * vector subtraction is similar to vector addition but the direction of the vector being subtracted - * is simply reversed
- * EX:
- * V1 = 3i + 4j
- * V2 = 7i + 5j
- *
- * V1 + V2 = 3i + 7i + 4j + 5j = 10i + 9j
- * V1 - V2 = 3i + (-7i) + 4j + (-5j) = -4i + -j
- *

- * + *

vector subtraction is similar to vector addition but the direction of the vector being + * subtracted is simply reversed
+ * EX:
+ * V1 = 3i + 4j
+ * V2 = 7i + 5j
+ *
+ * V1 + V2 = 3i + 7i + 4j + 5j = 10i + 9j
+ * V1 - V2 = 3i + (-7i) + 4j + (-5j) = -4i + -j
* * @param vector The vector to be subtracted * @return The result of the passed in vector being subtracted from the vector object @@ -138,15 +159,12 @@ public interface Vector { /** * Returns the product of two vectors that have been crossed * - *

- * The result of the cross product is a vector, - * The cross product of a vector is the vector that is perpendicular to both vectors - * When crossing two 2dimensional vectors the result will be a 3dimensional vector - * Because of this this method only returns the magnitude (Z component) of the cross product - * The magnitude of the cross product is same as the area of the parallelogram that the two - * vectors make in the X/Y plane.
- * https://en.wikipedia.org/wiki/Cross_product - *

+ *

The result of the cross product is a vector, The cross product of a vector is the vector + * that is perpendicular to both vectors When crossing two 2dimensional vectors the result will + * be a 3dimensional vector Because of this this method only returns the magnitude (Z component) + * of the cross product The magnitude of the cross product is same as the area of the + * parallelogram that the two vectors make in the X/Y plane.
+ * https://en.wikipedia.org/wiki/Cross_product * * @param vector the vector to be multiplied using the cross product * @return the magnitude of the cross product of the two vectors @@ -156,17 +174,14 @@ public interface Vector { /** * Returns the dot product of two vectors * - *

- * The result of the dot product is a scalar value (number), - * The dot product can be viewed as the projection of one vector on to another times the magnitude of the - * original vector
- * This can be written mathematically as |A||B|cos(theta), where theta is the angle between A and B - * Another mathematical representation of the dot product using its components is:
- * A = {@literal }
- * B = {@literal }
- * A . B = {@literal }
- * https://en.wikipedia.org/wiki/Dot_product - *

+ *

The result of the dot product is a scalar value (number), The dot product can be viewed as + * the projection of one vector on to another times the magnitude of the original vector
+ * This can be written mathematically as |A||B|cos(theta), where theta is the angle between A + * and B Another mathematical representation of the dot product using its components is:
+ * A = {@literal }
+ * B = {@literal }
+ * A . B = {@literal }
+ * https://en.wikipedia.org/wiki/Dot_product * * @param vector The vector to be multiplied using the dot product * @return the scalar result of the dot of the two vectors @@ -192,14 +207,12 @@ public interface Vector { /** * Normalizes a vector and returns the result * - *

- * A normalized vector is a vector with magnitude 1. - * Normalized vectors are also called unit vectors. - * A normalized vector keeps it's direction as well as the same proportions of its components. - * When a vector is defined by its components it can be normalized it can be expressed as
- * A = {@literal }
- * A' = {@literal }
- *

+ *

A normalized vector is a vector with magnitude 1. Normalized vectors are also called unit + * vectors. A normalized vector keeps it's direction as well as the same proportions of its + * components. When a vector is defined by its components it can be normalized it can be + * expressed as
+ * A = {@literal }
+ * A' = {@literal }
* * @return the normalized vector */ @@ -211,5 +224,4 @@ public interface Vector { * @return a copy of the vector */ public Vector copy(); - } diff --git a/src/main/java/org/montclairrobotics/alloy/vector/XY.java b/src/main/java/org/montclairrobotics/alloy/vector/XY.java index f25b117..765598c 100644 --- a/src/main/java/org/montclairrobotics/alloy/vector/XY.java +++ b/src/main/java/org/montclairrobotics/alloy/vector/XY.java @@ -1,29 +1,52 @@ +/* +MIT License + +Copyright (c) 2018 Garrett Burroughs + +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. +*/ package org.montclairrobotics.alloy.vector; /** * Created by MHS Robotics on 11/14/2017. * - * A vector can be defined in rectangular(XY), or polar form.
- * This class is implementation for vectors in XY form
+ *

A vector can be defined in rectangular(XY), or polar form.
+ * This class is implementation for vectors in XY form
* It controls the conversions from rectangular to polar and vice versa * - * https://en.wikipedia.org/wiki/Vector_notation - * @see Vector + *

https://en.wikipedia.org/wiki/Vector_notation * + * @see Vector * @author Garrett Burroughs * @version 0.1 * @since 0.1 */ -public class XY implements Vector{ +public class XY implements Vector { private double x; private double y; - public XY(double x, double y){ + public XY(double x, double y) { this.x = x; this.y = y; } - public XY(XY vector){ + public XY(XY vector) { x = vector.getY(); y = vector.getY(); } @@ -112,25 +135,25 @@ public void setAngle(Angle angle) { /** * Adds two vectors together and returns the result + * *

+ * + *

The result of a vector addition will be another vector, One way of adding two vectors + * together is splitting it up into it's x and y components and adding them together and making + * a new vector out of those components
+ * EX:
+ * V1 = 3i + 4j
+ * V2 = 7i + 5j
+ *
+ * V1 + V2 = 3i + 7i + 4j + 5j = 10i + 9j
+ * Geometric Visualization:
+ * Vectors can also be added in a geometric way through the "Tip-To-Tail" method, In this method + * both the vectors are drawn using arrow vector notation + * https://en.wikipedia.org/wiki/Vector_notation one vector is then drawn at the + * edge of the first vector. The resultant vector is then drawn from the start of the first + * vector to the tip of the second vector This is where the name tip to tail comes from + * *

- * The result of a vector addition will be another vector, - * One way of adding two vectors together is splitting it up into it's x and y components and adding them - * together and making a new vector out of those components
- * EX:
- * V1 = 3i + 4j
- * V2 = 7i + 5j
- *
- * V1 + V2 = 3i + 7i + 4j + 5j = 10i + 9j - *
- * Geometric Visualization:
- * Vectors can also be added in a geometric way through the "Tip-To-Tail" method, - * In this method both the vectors are drawn using arrow vector notation https://en.wikipedia.org/wiki/Vector_notation - * one vector is then drawn at the edge of the first vector. - * The resultant vector is then drawn from the start of the first vector to the tip of the second vector - * This is where the name tip to tail comes from - *

- *

* * @param vector The vector to be added * @return The result of the two vectors being added @@ -142,17 +165,17 @@ public Vector add(Vector vector) { /** * Subtracts a vector and returns the result + * *

- *

- * vector subtraction is similar to vector addition but the direction of the vector being subtracted - * is simply reversed
- * EX:
- * V1 = 3i + 4j
- * V2 = 7i + 5j
- *
- * V1 + V2 = 3i + 7i + 4j + 5j = 10i + 9j
- * V1 - V2 = 3i + (-7i) + 4j + (-5j) = -4i + -j
- *

+ * + *

vector subtraction is similar to vector addition but the direction of the vector being + * subtracted is simply reversed
+ * EX:
+ * V1 = 3i + 4j
+ * V2 = 7i + 5j
+ *
+ * V1 + V2 = 3i + 7i + 4j + 5j = 10i + 9j
+ * V1 - V2 = 3i + (-7i) + 4j + (-5j) = -4i + -j
* * @param vector The vector to be subtracted * @return The result of the passed in vector being subtracted from the vector object @@ -175,16 +198,15 @@ public Vector scale(double scalar) { /** * Returns the product of two vectors that have been crossed + * *

- *

- * The result of the cross product is a vector, - * The cross product of a vector is the vector that is perpendicular to both vectors - * When crossing two 2dimensional vectors the result will be a 3dimensional vector - * Because of this this method only returns the magnitude (Z component) of the cross product - * The magnitude of the cross product is same as the area of the parallelogram that the two - * vectors make in the X/Y plane.
+ * + *

The result of the cross product is a vector, The cross product of a vector is the vector + * that is perpendicular to both vectors When crossing two 2dimensional vectors the result will + * be a 3dimensional vector Because of this this method only returns the magnitude (Z component) + * of the cross product The magnitude of the cross product is same as the area of the + * parallelogram that the two vectors make in the X/Y plane.
* https://en.wikipedia.org/wiki/Cross_product - *

* * @param vector the vector to be multiplied using the cross product * @return the magnitude of the cross product of the two vectors @@ -196,18 +218,17 @@ public double cross(Vector vector) { /** * Returns the dot product of two vectors + * *

- *

- * The result of the dot product is a scalar value (number), - * The dot product can be viewed as the projection of one vector on to another times the magnitude of the - * original vector
- * This can be written mathematically as |A||B|cos(theta), where theta is the angle between A and B - * Another mathematical representation of the dot product using its components is:
- * A = {@literal }
- * B = {@literal }
- * A . B = {@literal }
+ * + *

The result of the dot product is a scalar value (number), The dot product can be viewed as + * the projection of one vector on to another times the magnitude of the original vector
+ * This can be written mathematically as |A||B|cos(theta), where theta is the angle between A + * and B Another mathematical representation of the dot product using its components is:
+ * A = {@literal }
+ * B = {@literal }
+ * A . B = {@literal }
* https://en.wikipedia.org/wiki/Dot_product - *

* * @param vector The vector to be multiplied using the dot product * @return the scalar result of the dot of the two vectors @@ -241,21 +262,21 @@ public Angle angleBetween(Vector vector) { /** * Normalizes a vector and returns the result + * *

- *

- * A normalized vector is a vector with magnitude 1. - * Normalized vectors are also called unit vectors. - * A normalized vector keeps it's direction as well as the same proportions of its components. - * When a vector is defined by its components it can be normalized it can be expressed as
- * A = {@literal }
- * A' = {@literal }
- *

+ * + *

A normalized vector is a vector with magnitude 1. Normalized vectors are also called unit + * vectors. A normalized vector keeps it's direction as well as the same proportions of its + * components. When a vector is defined by its components it can be normalized it can be + * expressed as
+ * A = {@literal }
+ * A' = {@literal }
* * @return the normalized vector */ @Override public Vector normalize() { - return new XY(x/getManitude(), y/getManitude()); + return new XY(x / getManitude(), y / getManitude()); } /** diff --git a/src/main/main.iml b/src/main/main.iml deleted file mode 100644 index a6a5fea..0000000 --- a/src/main/main.iml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file