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 @@
-
-
The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.
+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+Each annotation type has its own separate page with the following sections:
+Each enum has its own separate page with the following sections:
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+These links take you to the next or previous class, interface, package, or related page.
+These links show and hide the HTML frames. All pages are available with or without frames.
+The All Classes link shows all classes and interfaces except non-static nested types.
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+The Constant Field Values page lists the static final fields and their values.
+public abstract class AlloyAutonomous
+extends com.qualcomm.robotcore.eventloop.opmode.OpMode
+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| Modifier and Type | +Field and Description | +
|---|---|
StateMachine |
+auto
+The actual auto mode that should be instantiated in setup
+ |
+
com.qualcomm.robotcore.util.ElapsedTime |
+timer
+A timer to keep track of time in the autoMode
+ |
+
gamepad1, gamepad2, hardwareMap, internalOpModeServices, msStuckDetectInit, msStuckDetectInitLoop, msStuckDetectLoop, msStuckDetectStart, msStuckDetectStop, telemetry, time| Constructor and Description | +
|---|
AlloyAutonomous() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+init()
+Init is called when the INIT button is pressed on the drivers station.
+ |
+
void |
+loop()
+the Loop method takes care of running the state machine
+ |
+
void |
+newState(State state)
+A wrapper around the add state method to allow the user to add states to the auto mode
+ |
+
abstract void |
+setup()
+This is where the user should define all their code and where "Auto", should be instantiated
+ |
+
void |
+start()
+Runs when the play button is pressed Start will set up everything that the auto mode needs to
+ run
+ |
+
void |
+userLoop()
+The user loop can be overridden in the auto mode and is called every loop before the state is
+ run.
+ |
+
getRuntime, init_loop, internalPostInitLoop, internalPostLoop, internalPreInit, internalUpdateTelemetryNow, requestOpModeStop, resetStartTime, stop, updateTelemetryclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic StateMachine auto+
public com.qualcomm.robotcore.util.ElapsedTime timer+
public abstract void setup()+
public void start()+
start in class com.qualcomm.robotcore.eventloop.opmode.OpModepublic void init()+
init in class com.qualcomm.robotcore.eventloop.opmode.OpModepublic void userLoop()+
public void loop()+
loop in class com.qualcomm.robotcore.eventloop.opmode.OpModepublic void newState(State state)+
state - the state to be addedpublic class SimpleAutonomous +extends AlloyAutonomous+
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
auto, timergamepad1, gamepad2, hardwareMap, internalOpModeServices, msStuckDetectInit, msStuckDetectInitLoop, msStuckDetectLoop, msStuckDetectStart, msStuckDetectStop, telemetry, time| Constructor and Description | +
|---|
SimpleAutonomous() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+addState(State state) |
+
void |
+contition(Input<java.lang.Boolean> condition,
+ State state) |
+
void |
+drive(double speed,
+ double distance) |
+
void |
+setup()
+This is where the user should define all their code and where "Auto", should be instantiated
+ |
+
void |
+turn(double speed,
+ Angle angle) |
+
init, loop, newState, start, userLoopgetRuntime, init_loop, internalPostInitLoop, internalPostLoop, internalPreInit, internalUpdateTelemetryNow, requestOpModeStop, resetStartTime, stop, updateTelemetryclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic void setup()+
AlloyAutonomoussetup in class AlloyAutonomouspublic void drive(double speed, + double distance)+
public void turn(double speed, + Angle angle)+
public void addState(State state)+
public abstract class State
+extends java.lang.Object
+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.
StateMachine,
+AlloyAutonomous| Modifier and Type | +Field and Description | +
|---|---|
protected java.lang.String |
+debug |
+
protected java.lang.String |
+description |
+
| Modifier and Type | +Method and Description | +
|---|---|
java.lang.String |
+debugInfo(int currentState)
+When a state machine is running, it will debug out information about the state it is running.
+ |
+
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.
+ |
+
abstract boolean |
+isDone()
+IsDone should return true when the state is finished
+ |
+
abstract void |
+run()
+The run method is called every loop while the state is running
+ |
+
abstract void |
+start()
+The start method is the first thing called when the state is run
+ |
+
abstract void |
+stop()
+The Stop method is the last thing called once the state is done
+ |
+
java.lang.String |
+verboseDebug() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprotected java.lang.String debug+
protected java.lang.String description+
public abstract void start()+
public abstract void run()+
public abstract void stop()+
public abstract boolean isDone()+
public int getNextState(int currentState)+
currentState - the state the state machine is currently runningpublic java.lang.String debugInfo(int currentState)+
currentState - the current state so that it can be used in the debugpublic java.lang.String verboseDebug()+
public class StateMachine +extends State+
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
debug, description| 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) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+addState(State state)
+Adds a state to the state machine.
+ |
+
double |
+getTimeInLastState()
+Gets the time in the most recently completed state
+ |
+
boolean |
+isDone()
+determine if the state machine is done
+ |
+
void |
+run()
+The run method takes care of actually running the states
+ |
+
void |
+setFinalState(java.lang.Integer finalState) |
+
void |
+setName(java.lang.String name) |
+
void |
+start()
+Read out that the state has started and reset the timer
+ |
+
void |
+stop()
+When the state machine is finished, read out it has finished
+ |
+
debugInfo, getNextState, verboseDebugclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic StateMachine(java.lang.String name, + int finalState, + State... states)+
public StateMachine(State... states)+
public StateMachine(java.lang.String name, + java.lang.String description, + int finalState, + State... states)+
public void setFinalState(java.lang.Integer finalState)+
public void setName(java.lang.String name)+
public void start()+
public void run()+
public void stop()+
public boolean isDone()+
public void addState(State state)+
state - state that will be added to the state machinepublic double getTimeInLastState()+
public class ConditionalState +extends State+
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.
debug, description| Constructor and Description | +
|---|
ConditionalState(Input<java.lang.Boolean> condition,
+ State state) |
+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+isDone()
+IsDone should return true when the state is finished
+ |
+
void |
+run()
+The run method is called every loop while the state is running
+ |
+
void |
+start()
+The start method is the first thing called when the state is run
+ |
+
void |
+stop()
+The Stop method is the last thing called once the state is done
+ |
+
debugInfo, getNextState, verboseDebugclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic void start()+
Statepublic void run()+
Statepublic void stop()+
Statepublic class Drive +extends State+
debug, description| Constructor and Description | +
|---|
Drive(double speed,
+ double distance) |
+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+isDone()
+IsDone should return true when the state is finished
+ |
+
void |
+run()
+The run method is called every loop while the state is running
+ |
+
Drive |
+setDriveTrain(DriveTrain driveTrain) |
+
static void |
+setTolerance(int tolerance) |
+
void |
+start()
+The start method is the first thing called when the state is run
+ |
+
void |
+stop()
+The Stop method is the last thing called once the state is done
+ |
+
debugInfo, getNextState, verboseDebugclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static void setTolerance(int tolerance)+
public Drive setDriveTrain(DriveTrain driveTrain)+
public void start()+
Statepublic void run()+
Statepublic void stop()+
Statepublic class Turn +extends State+
debug, description| Constructor and Description | +
|---|
Turn(double speed,
+ Angle angle) |
+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+isDone()
+IsDone should return true when the state is finished
+ |
+
void |
+run()
+The run method is called every loop while the state is running
+ |
+
static void |
+setTicksPerDegree(double ticksPerDegree) |
+
static void |
+setTolerance(double tolerance) |
+
void |
+start()
+The start method is the first thing called when the state is run
+ |
+
void |
+stop()
+The Stop method is the last thing called once the state is done
+ |
+
debugInfo, getNextState, verboseDebugclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static void setTicksPerDegree(double ticksPerDegree)+
public static void setTolerance(double tolerance)+
public void start()+
Statepublic void run()+
Statepublic void stop()+
State| Class | +Description | +
|---|---|
| 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.
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.auto | ++ |
| Modifier and Type | +Class and Description | +
|---|---|
class |
+StateMachine
+Created by MHS Robotics on 12/16/2017.
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+StateMachine.addState(State state) |
+
| Constructor and Description | +
|---|
StateMachine(State... states) |
+
| Class | +Description | +
|---|---|
| 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.
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.auto | ++ |
| Class and Description | +
|---|
| State
+ Created by MHS Robotics on 12/16/2017.
+ |
+
public interface Action
+| Modifier and Type | +Method and Description | +
|---|---|
void |
+disabled() |
+
void |
+enabled() |
+
void |
+start() |
+
void |
+stop() |
+
public abstract class Component +extends Toggleable+
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
InputComponentToggleable.Status| Modifier and Type | +Field and Description | +
|---|---|
static java.util.ArrayList<Component> |
+components
+a static reference of all the components that are made
+ |
+
static Debugger |
+debugger
+The object used for debugging information about all components
+ |
+
status| Modifier and Type | +Method and Description | +
|---|---|
void |
+addDebug(Debug debug)
+Adds a debug to the component, this will be debugged out every loop if debug mode is enabled
+ |
+
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
+ |
+
void |
+debug() |
+
void |
+disableAction()
+The action that is taken when the component is disabled, should be overridden by the user
+ |
+
void |
+disableDebug()
+Disabled debug mode, stopping all debugs
+ |
+
void |
+enableAction()
+The action that is taken when the component is enabled should be overridden bu the user
+ |
+
void |
+enableDebug()
+Enabled debug mode, causing any debugs added to the component to be debugged out
+ |
+
static java.util.ArrayList<Component> |
+getComponents() |
+
disable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static Debugger debugger+
public static java.util.ArrayList<Component> components+
public static java.util.ArrayList<Component> getComponents()+
public void addDebug(Debug debug)+
public void addDebugs(java.lang.Iterable<? extends Debug> debugs)+
public void enableDebug()+
public void disableDebug()+
public void debug()+
public void enableAction()+
enableAction in class Toggleablepublic void disableAction()+
disableAction in class ToggleableT - the type of the inputpublic abstract class InputComponent<T> +extends Component +implements Input+
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
Toggleable.Status| Modifier and Type | +Field and Description | +
|---|---|
Input<T> |
+input
+The initial input value
+ |
+
T |
+output
+The value after steps have been applied
+ |
+
java.util.ArrayList<Step<T>> |
+steps
+An arraylist to store all of the steps
+ |
+
components, debuggerstatus| Constructor and Description | +
|---|
InputComponent() |
+
| Modifier and Type | +Method and Description | +
|---|---|
InputComponent |
+addStep(Step s)
+A daisy-chainable method that adds a step to the input component
+ |
+
void |
+applySteps()
+Apply all of the steps, in order, taking the output of one step and passing it as the input
+ to the next
+ |
+
T |
+get() |
+
InputComponent<T> |
+setInput(Input<T> input)
+A daisy-chainable method that sets the initial input of the input component
+ |
+
addDebug, addDebugs, debug, disableAction, disableDebug, enableAction, enableDebug, getComponentsdisable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic T output+
public void applySteps()+
public InputComponent addStep(Step s)+
public InputComponent<T> setInput(Input<T> input)+
T - the type that the step will be manipulatingpublic interface Step<T>
+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.
| Modifier and Type | +Method and Description | +
|---|---|
T |
+getOutput(T input)
+The operation to be performed on the input, to get the output
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.components | ++ |
| org.montclairrobotics.alloy.core | ++ |
| org.montclairrobotics.alloy.drive | ++ |
| org.montclairrobotics.alloy.ftc | ++ |
| org.montclairrobotics.alloy.motor | ++ |
| org.montclairrobotics.alloy.utils | ++ |
| Modifier and Type | +Class and Description | +
|---|---|
class |
+InputComponent<T>
+An input component is an extension of a regular component, used for input and control systems
+ |
+
| Modifier and Type | +Field and Description | +
|---|---|
static java.util.ArrayList<Component> |
+Component.components
+a static reference of all the components that are made
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
static java.util.ArrayList<Component> |
+Component.getComponents() |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+Encoder
+A motor encoder that keeps track of kinematic information about the motor
+ |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+DriveModule |
+
class |
+DriveTrain
+Created by MHS Robotics on 12/16/2017.
+ |
+
class |
+TankDrive |
+
class |
+TankMapper |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+FTCJoystick
+Implementation of the Joystick class for FTC
+ |
+
class |
+FTCMotor
+Implementation of a basic motor for the FTC competition
+ |
+
class |
+FTCTargetMotor
+Implementation of a target motor for the FTC competition
+ |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+MotorGroup<T>
+A motor group is a group of motor modules that run together
+ |
+
class |
+MotorModule
+Highly Functional set of motors that run together
+ |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+BangBang
+Simple error correction, that returns one value if the error is high, and another if it is low
+ |
+
class |
+Differential
+A class to calculate how an input varies with time
+ |
+
class |
+GyroCorrection
+A correction based on a gyroscope, to keep a consistent heading
+ |
+
class |
+PID
+Created by Montclair robotics on 2/27/2018
+ |
+
class |
+TuneablePID
+A PID class that takes in tunable inputs to make PID tuning easier
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.components | ++ |
| org.montclairrobotics.alloy.core | ++ |
| org.montclairrobotics.alloy.drive | ++ |
| org.montclairrobotics.alloy.ftc | ++ |
| org.montclairrobotics.alloy.motor | ++ |
| org.montclairrobotics.alloy.utils | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
InputComponent |
+InputComponent.addStep(Step s)
+A daisy-chainable method that adds a step to the input component
+ |
+
InputComponent<T> |
+InputComponent.setInput(Input<T> input)
+A daisy-chainable method that sets the initial input of the input component
+ |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+Encoder
+A motor encoder that keeps track of kinematic information about the motor
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
DriveTrain |
+DriveTrain.setInput(InputComponent<DTInput> input) |
+
| Constructor and Description | +
|---|
DriveTrain(InputComponent<DTInput> input,
+ Mapper mapper,
+ MotorModule... modules) |
+
TankDrive(InputComponent<DTInput> input,
+ MotorModule... modules) |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+FTCJoystick
+Implementation of the Joystick class for FTC
+ |
+
| Modifier and Type | +Field and Description | +
|---|---|
InputComponent<T> |
+MotorGroup.input
+The control input for the motor group
+ |
+
InputComponent<java.lang.Double> |
+MotorModule.modifier |
+
| Modifier and Type | +Method and Description | +
|---|---|
InputComponent<java.lang.Double> |
+MotorModule.getModifier() |
+
| Modifier and Type | +Method and Description | +
|---|---|
MotorModule |
+MotorModule.setPowerModifier(InputComponent<java.lang.Double> modifier) |
+
| Constructor and Description | +
|---|
MotorGroup(InputComponent<java.lang.Double> input,
+ MotorModule... modules)
+Creates a motor group with a default mapper that simply
+ |
+
MotorGroup(InputComponent input,
+ Mapper mapper,
+ MotorModule... modules) |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+BangBang
+Simple error correction, that returns one value if the error is high, and another if it is low
+ |
+
class |
+Differential
+A class to calculate how an input varies with time
+ |
+
class |
+GyroCorrection
+A correction based on a gyroscope, to keep a consistent heading
+ |
+
class |
+PID
+Created by Montclair robotics on 2/27/2018
+ |
+
class |
+TuneablePID
+A PID class that takes in tunable inputs to make PID tuning easier
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.components | ++ |
| org.montclairrobotics.alloy.motor | ++ |
| org.montclairrobotics.alloy.steps | ++ |
| Modifier and Type | +Field and Description | +
|---|---|
java.util.ArrayList<Step<T>> |
+InputComponent.steps
+An arraylist to store all of the steps
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
InputComponent |
+InputComponent.addStep(Step s)
+A daisy-chainable method that adds a step to the input component
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
MotorModule |
+MotorModule.addStep(Step s) |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+Deadzone
+A step that returns 0 if the input is under a certain threshold
+ |
+
class |
+VectorDeadzone
+A step that returns 0 if the inputs magnitude is under a certain threshold
+ |
+
| Interface | +Description | +
|---|---|
| Step<T> | +
+ A step is a manipulation or calculation performed on an input
+ |
+
| Class | +Description | +
|---|---|
| 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
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.components | ++ |
| org.montclairrobotics.alloy.core | ++ |
| org.montclairrobotics.alloy.drive | ++ |
| org.montclairrobotics.alloy.ftc | ++ |
| org.montclairrobotics.alloy.motor | ++ |
| org.montclairrobotics.alloy.steps | ++ |
| org.montclairrobotics.alloy.utils | ++ |
| Class and Description | +
|---|
| Component
+ The main component class that all components of alloy should extend
+ |
+
| InputComponent
+ An input component is an extension of a regular component, used for input and control systems
+ |
+
| Step
+ A step is a manipulation or calculation performed on an input
+ |
+
| Class and Description | +
|---|
| Component
+ The main component class that all components of alloy should extend
+ |
+
| InputComponent
+ An input component is an extension of a regular component, used for input and control systems
+ |
+
| Class and Description | +
|---|
| Component
+ The main component class that all components of alloy should extend
+ |
+
| InputComponent
+ An input component is an extension of a regular component, used for input and control systems
+ |
+
| Class and Description | +
|---|
| Component
+ The main component class that all components of alloy should extend
+ |
+
| InputComponent
+ An input component is an extension of a regular component, used for input and control systems
+ |
+
| Class and Description | +
|---|
| Component
+ The main component class that all components of alloy should extend
+ |
+
| InputComponent
+ An input component is an extension of a regular component, used for input and control systems
+ |
+
| Step
+ A step is a manipulation or calculation performed on an input
+ |
+
| Class and Description | +
|---|
| Step
+ A step is a manipulation or calculation performed on an input
+ |
+
| Class and Description | +
|---|
| Component
+ The main component class that all components of alloy should extend
+ |
+
| InputComponent
+ An input component is an extension of a regular component, used for input and control systems
+ |
+
public abstract class ButtonAction
+extends java.lang.Object
+| Modifier and Type | +Field and Description | +
|---|---|
Button |
+button
+The button that controls the action
+ |
+
boolean |
+wasPressed
+Keeps track of if the button was pressed in the previous loop, used for telling when the
+ button is pressed/unpressed
+ |
+
| Constructor and Description | +
|---|
ButtonAction(Button button)
+Creates a button action tied to a button
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
abstract void |
+onPressed()
+On pressed is called once, when the button goes from being unpressed, to pressed
+ |
+
abstract void |
+onReleased()
+On released is called once, when the button goes from being pressed, to unpressed
+ |
+
void |
+update() |
+
abstract void |
+whilePressed()
+While pressed is called every loop while the button is pressed
+ |
+
abstract void |
+whileReleased()
+While released is called every loop while the button is unpressed
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic Button button+
public boolean wasPressed+
public ButtonAction(Button button)+
public abstract void onPressed()+
public abstract void onReleased()+
public abstract void whilePressed()+
public abstract void whileReleased()+
public void update()+
public class ToggleButton +extends ButtonAction+
Toggleable,
+ButtonActionbutton, wasPressed| Constructor and Description | +
|---|
ToggleButton(Button button,
+ Toggleable toggleable) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+onPressed()
+On pressed is called once, when the button goes from being unpressed, to pressed
+ |
+
void |
+onReleased()
+On released is called once, when the button goes from being pressed, to unpressed
+ |
+
void |
+whilePressed()
+While pressed is called every loop while the button is pressed
+ |
+
void |
+whileReleased()
+While released is called every loop while the button is unpressed
+ |
+
updateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic ToggleButton(Button button, + Toggleable toggleable)+
public void onPressed()+
onPressed in class ButtonActionpublic void onReleased()+
onReleased in class ButtonActionpublic void whilePressed()+
whilePressed in class ButtonActionpublic void whileReleased()+
whileReleased in class ButtonAction| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.control | ++ |
| Modifier and Type | +Class and Description | +
|---|---|
class |
+ToggleButton
+A ToggleButton is tied to a button and a toggleable, when the button is pressed the toggleable
+ will toggle between states
+ |
+
| Class | +Description | +
|---|---|
| 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
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.control | ++ |
| Class and Description | +
|---|
| ButtonAction
+ Every Button action is tied to a button, and controls what happens when the button is pressed,
+ held, unpressed, and released
+ |
+
public abstract class Alloy
+extends com.qualcomm.robotcore.eventloop.opmode.OpMode
+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
| Modifier and Type | +Field and Description | +
|---|---|
static java.util.ArrayList<Initializeable> |
+initObjects |
+
gamepad1, gamepad2, hardwareMap, internalOpModeServices, msStuckDetectInit, msStuckDetectInitLoop, msStuckDetectLoop, msStuckDetectStart, msStuckDetectStop, telemetry, time| Modifier and Type | +Method and Description | +
|---|---|
static DriveTrain |
+getDriveTrain() |
+
void |
+init() |
+
abstract void |
+initialization()
+The initialization method is were everything specific to the OpMode Should be set up.
+ |
+
void |
+loop() |
+
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.
+ |
+
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.
+ |
+
static void |
+setDriveTrain(DriveTrain driveTrain) |
+
getRuntime, init_loop, internalPostInitLoop, internalPostLoop, internalPreInit, internalUpdateTelemetryNow, requestOpModeStop, resetStartTime, start, stop, updateTelemetryclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static java.util.ArrayList<Initializeable> initObjects+
public abstract void robotSetup()+
public abstract void initialization()+
public abstract void periodic()+
public void init()+
init in class com.qualcomm.robotcore.eventloop.opmode.OpModepublic void loop()+
loop in class com.qualcomm.robotcore.eventloop.opmode.OpModepublic static void setDriveTrain(DriveTrain driveTrain)+
public static DriveTrain getDriveTrain()+
public interface 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
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+getValue()
+Gets the value of a button
+ |
+
public class Debug
+extends java.lang.Object
+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
Debugger| Modifier and Type | +Field and Description | +
|---|---|
java.lang.String |
+key
+The key, label, or name of the information
+ |
+
Input<java.lang.Object> |
+value
+The information, or object to be debugged
+ |
+
public static enum Debugger.Level +extends java.lang.Enum<Debugger.Level>+
| 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
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
int |
+getRank() |
+
static Debugger.Level |
+valueOf(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.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfgetClass, notify, notifyAll, wait, wait, waitpublic static final Debugger.Level OVERRIDE+
public static final Debugger.Level ERROR+
public static final Debugger.Level COMPETITION+
public static final Debugger.Level WARNING+
public static final Debugger.Level TEST+
public static final Debugger.Level DEBUG+
public static Debugger.Level[] values()+
+for (Debugger.Level c : Debugger.Level.values()) + System.out.println(c); +
public static Debugger.Level valueOf(java.lang.String name)+
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic int getRank()+
public abstract class Debugger
+extends java.lang.Object
+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
| Modifier and Type | +Class and Description | +
|---|---|
static class |
+Debugger.Level |
+
| Modifier and Type | +Field and Description | +
|---|---|
static Debugger.Level |
+debugLevel
+Current Debug Level
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+debug(Debug debug)
+Debugs out a debug object
+ |
+
void |
+debug(java.lang.String key,
+ java.lang.Object value)
+Debug out verbose information
+ |
+
void |
+driverInfo(java.lang.String key,
+ java.lang.Object value)
+Give a message intended for the driver during practice or competition operation
+ |
+
void |
+error(java.lang.String error)
+Gives an error message to the user
+ |
+
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
+ |
+
abstract void |
+out(java.lang.String key,
+ java.lang.Object value)
+The most basic debug that simply outputs information given a key and value
+ |
+
void |
+override(java.lang.String key,
+ java.lang.Object value)
+A message that overrides the debug level system
+ |
+
static void |
+setDebugLevel(Debugger.Level level)
+Set the debug level
+ |
+
void |
+test(java.lang.String key,
+ java.lang.Object value)
+Information to be displayed when testing a process or mechanism
+ |
+
void |
+warn(java.lang.String warning)
+Gives a warning to the user
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static Debugger.Level debugLevel+
public static void setDebugLevel(Debugger.Level level)+
level - The level to be setpublic abstract void out(java.lang.String key, + java.lang.Object value)+
key - Key of the value being debuggedvalue - Value to be debuggedpublic void log(java.lang.String key, + java.lang.Object value, + Debugger.Level level)+
key - Name of the valuevalue - Value to be debuggedlevel - the level this debug is, if the debug level is lower than the current level, this will not be degbuggedpublic void debug(Debug debug)+
debug - the object to be debuggedpublic void debug(java.lang.String key, + java.lang.Object value)+
key - Name of the valuevalue - Value to be displayedpublic void warn(java.lang.String warning)+
warning - the warningpublic void error(java.lang.String error)+
error - the error message to be displayedpublic void driverInfo(java.lang.String key, + java.lang.Object value)+
key - Name of the valuevalue - Value to be displayedpublic void test(java.lang.String key, + java.lang.Object value)+
key - Name of the valuevalue - Value to be displayedpublic void override(java.lang.String key, + java.lang.Object value)+
key - Name of the valuevalue - Value to be displayedpublic abstract class Encoder +extends InputComponent<java.lang.Integer>+
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
Toggleable.Statusinput, output, stepscomponents, debuggerstatus| Constructor and Description | +
|---|
Encoder()
+Create a new encoder with default values
+ |
+
Encoder(double distancePerTick,
+ double maxSpeed) |
+
| Modifier and Type | +Method and Description | +
|---|---|
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
+ |
+
Differential |
+getAccelerationDifferential() |
+
abstract int |
+getRawTicks()
+A method that should be overridden by the encoder
+ |
+
double |
+getRawVelocity()
+Get the velocity in Ticks per Second
+ |
+
double |
+getScaledVelocity()
+Get a scaled value (0 - 1) of how fast the motor is going
+ |
+
int |
+getTicks() |
+
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.
+ |
+
Differential |
+getVelocityDifferential() |
+
void |
+reset()
+soft reset the encoder, setting the current value as 0 ticks
+ |
+
Encoder |
+setDistancePerTick(double distancePerTick)
+Set the distance per tick
+ |
+
Encoder |
+setMaxSpeed(double maxSpeed)
+Set the max speed (In Ticks per Second) that the motor can run
+ |
+
addStep, applySteps, get, setInputaddDebug, addDebugs, debug, disableAction, disableDebug, enableAction, enableDebug, getComponentsdisable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic Encoder(double distancePerTick, + double maxSpeed)+
public Encoder()+
public abstract int getRawTicks()+
public int getTicks()+
public void reset()+
public Encoder setDistancePerTick(double distancePerTick)+
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
distancePerTick - how far the motor moves for 1 encoder tickpublic Encoder setMaxSpeed(double maxSpeed)+
maxSpeed - max speed that the motor can runpublic double getRawVelocity()+
public double getVelocity()+
public double getAcceleration()+
public double getScaledVelocity()+
public Differential getVelocityDifferential()+
public Differential getAccelerationDifferential()+
public interface Joystick
+Joysticks should return a vector made up of the X and Y values of their position
| Modifier and Type | +Method and Description | +
|---|---|
Vector |
+getValue()
+Gets the position of the joystick
+ |
+
| Enum Constant and Description | +
|---|
FTCAUTONOMOUS
+ftc autonomous mode
+ |
+
FTCTELEOP
+ftc Telemetry Operated Mode
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
static Mode |
+valueOf(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.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfgetClass, notify, notifyAll, wait, wait, waitpublic static final Mode FTCTELEOP+
public static final Mode FTCAUTONOMOUS+
public static Mode[] values()+
+for (Mode c : Mode.values()) + System.out.println(c); +
public static Mode valueOf(java.lang.String name)+
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic interface Motor
+The very basic functionality of any mechanical motor This includes setting power, and + inverting the motor
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+getInverted()
+Gets weather the motor is inverted
+ |
+
double |
+getMotorPower()
+Gets the motor power
+ |
+
void |
+setInverted(boolean inverted)
+Sets weather the motor runs the default way , or inverted
+ |
+
void |
+setMotorPower(double power)
+Sets the motor Power
+ |
+
void setMotorPower(double power)+
power - the power that the motor will be set to (0-1 inclusive )double getMotorPower()+
void setInverted(boolean inverted)+
inverted - true for inverted, false for normalboolean getInverted()+
public class RobotCore
+extends java.lang.Object
+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
OpMode,
+Alloy| Modifier and Type | +Field and Description | +
|---|---|
static com.qualcomm.robotcore.hardware.Gamepad |
+gamepad1
+The first gamepad, generated by pressing start + 'a' on the controller
+ |
+
static com.qualcomm.robotcore.hardware.Gamepad |
+gamepad2
+The second gamepad, generated by pressing start + 'b' on the controller
+ |
+
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
+ |
+
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
+ |
+
| 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) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static com.qualcomm.robotcore.hardware.Gamepad |
+getGamepad1()
+Gets the first gamepad
+ |
+
static com.qualcomm.robotcore.hardware.Gamepad |
+getGamepad2()
+Gets the second gamepad
+ |
+
static com.qualcomm.robotcore.hardware.HardwareMap |
+getHardwareMap()
+Gets the hardware map of the robot
+ |
+
static org.firstinspires.ftc.robotcore.external.Telemetry |
+getTelemetry()
+Gets the telemetry object of the robot
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static org.firstinspires.ftc.robotcore.external.Telemetry telemetry+
Debugpublic static com.qualcomm.robotcore.hardware.HardwareMap hardwareMap+
public static com.qualcomm.robotcore.hardware.Gamepad gamepad1+
public static com.qualcomm.robotcore.hardware.Gamepad gamepad2+
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)+
public static com.qualcomm.robotcore.hardware.HardwareMap getHardwareMap()+
public static org.firstinspires.ftc.robotcore.external.Telemetry getTelemetry() + throws java.lang.NullPointerException+
java.lang.NullPointerExceptionpublic static com.qualcomm.robotcore.hardware.Gamepad getGamepad1()+
public static com.qualcomm.robotcore.hardware.Gamepad getGamepad2()+
public interface TargetMotor +extends Motor+
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
| Modifier and Type | +Method and Description | +
|---|---|
int |
+getPosition()
+Gets the motors position
+ |
+
double |
+getTargetPower()
+Gets the motor power
+ |
+
void |
+setPosition(int position)
+Sets the motor position
+ |
+
void |
+setTargetPower(double power)
+Sets the motor Power
+ |
+
getInverted, getMotorPower, setInverted, setMotorPowervoid setTargetPower(double power)+
power - the power that the motor will be set to (0-1 inclusive )double getTargetPower()+
void setPosition(int position)+
position - the position the motor will be set to (in encoder ticks)int getPosition()+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.test | ++ |
| Modifier and Type | +Class and Description | +
|---|---|
class |
+TestRobot |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.control | ++ |
| org.montclairrobotics.alloy.ftc | ++ |
| Modifier and Type | +Field and Description | +
|---|---|
Button |
+ButtonAction.button
+The button that controls the action
+ |
+
| Constructor and Description | +
|---|
ButtonAction(Button button)
+Creates a button action tied to a button
+ |
+
ToggleButton(Button button,
+ Toggleable toggleable) |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+FTCButton
+An FTC button provides implementation for a button used in the FTC competition
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.components | ++ |
| org.montclairrobotics.alloy.core | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
void |
+Component.addDebug(Debug debug)
+Adds a debug to the component, this will be debugged out every loop if debug mode is enabled
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+Component.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
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+Debugger.debug(Debug debug)
+Debugs out a debug object
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.core | ++ |
| Modifier and Type | +Field and Description | +
|---|---|
static Debugger.Level |
+Debugger.debugLevel
+Current Debug Level
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
static Debugger.Level |
+Debugger.Level.valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static Debugger.Level[] |
+Debugger.Level.values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+Debugger.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
+ |
+
static void |
+Debugger.setDebugLevel(Debugger.Level level)
+Set the debug level
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.components | ++ |
| org.montclairrobotics.alloy.ftc | ++ |
| Modifier and Type | +Field and Description | +
|---|---|
static Debugger |
+Component.debugger
+The object used for debugging information about all components
+ |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+FTCDebugger
+implementation of the debugger for the FTC competition
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.core | ++ |
| org.montclairrobotics.alloy.drive | ++ |
| org.montclairrobotics.alloy.ftc | ++ |
| org.montclairrobotics.alloy.motor | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
Encoder |
+Encoder.setDistancePerTick(double distancePerTick)
+Set the distance per tick
+ |
+
Encoder |
+Encoder.setMaxSpeed(double maxSpeed)
+Set the max speed (In Ticks per Second) that the motor can run
+ |
+
| Constructor and Description | +
|---|
DriveModule(Vector direction,
+ Encoder encoder,
+ ErrorCorrection<java.lang.Double> powerControl,
+ Motor... motors)
+Create a fully functioning motor module
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
Encoder |
+FTCMotor.getEncoder() |
+
Encoder |
+FTCTargetMotor.getEncoder()
+Allows for the creation of an encoder object that is aware of the amount of ticks the motor
+ has gone
+ |
+
| Modifier and Type | +Field and Description | +
|---|---|
Encoder |
+MotorModule.encoder
+The encoder that keeps track of the position and controls the motors
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
Encoder |
+MotorModule.getEncoder() |
+
| Modifier and Type | +Method and Description | +
|---|---|
MotorModule |
+MotorModule.setEncoder(Encoder encoder)
+Set an encoder for the module
+ |
+
| Constructor and Description | +
|---|
MotorModule(Vector direction,
+ Encoder encoder,
+ ErrorCorrection<java.lang.Double> powerControl,
+ Motor... motors)
+Create a fully functioning motor module
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.ftc | ++ |
| Modifier and Type | +Class and Description | +
|---|---|
class |
+FTCJoystick
+Implementation of the Joystick class for FTC
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.core | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
static Mode |
+Mode.valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static Mode[] |
+Mode.values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.core | ++ |
| org.montclairrobotics.alloy.drive | ++ |
| org.montclairrobotics.alloy.ftc | ++ |
| org.montclairrobotics.alloy.motor | ++ |
| Modifier and Type | +Interface and Description | +
|---|---|
interface |
+TargetMotor
+Target motor is a motor interface for motors that have encoders.
+ |
+
| Constructor and Description | +
|---|
DriveModule(Vector direction,
+ Encoder encoder,
+ ErrorCorrection<java.lang.Double> powerControl,
+ Motor... motors)
+Create a fully functioning motor module
+ |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+FTCMotor
+Implementation of a basic motor for the FTC competition
+ |
+
class |
+FTCTargetMotor
+Implementation of a target motor for the FTC competition
+ |
+
| Modifier and Type | +Field and Description | +
|---|---|
java.util.ArrayList<Motor> |
+MotorModule.motors
+The motors that the module will control
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
java.util.ArrayList<Motor> |
+MotorModule.getMotors() |
+
| Constructor and Description | +
|---|
MotorModule(Vector direction,
+ Encoder encoder,
+ ErrorCorrection<java.lang.Double> powerControl,
+ Motor... motors)
+Create a fully functioning motor module
+ |
+
MotorModule(Vector direction,
+ Motor... motors)
+Create motor module without the use of an encoder
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.ftc | ++ |
| Modifier and Type | +Class and Description | +
|---|---|
class |
+FTCTargetMotor
+Implementation of a target motor for the FTC competition
+ |
+
| Interface | +Description | +
|---|---|
| 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 | +Description | +
|---|---|
| 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 | +Description | +
|---|---|
| Debugger.Level | ++ |
| Mode | +
+ All of the different running states that the robot can be in
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.components | ++ |
| org.montclairrobotics.alloy.control | ++ |
| org.montclairrobotics.alloy.core | ++ |
| org.montclairrobotics.alloy.drive | ++ |
| org.montclairrobotics.alloy.ftc | ++ |
| org.montclairrobotics.alloy.motor | ++ |
| org.montclairrobotics.alloy.test | ++ |
| Class and Description | +
|---|
| Debug
+ Contains the necessary information for a debug
+ |
+
| Debugger
+ Controls the flow of how debug information is read out
+ |
+
| Class and Description | +
|---|
| Button
+ An outline for the fundamental behavior of a button
+ |
+
| Class and Description | +
|---|
| Debug
+ Contains the necessary information for a debug
+ |
+
| Debugger.Level | +
| Encoder
+ A motor encoder that keeps track of kinematic information about the motor
+ |
+
| Mode
+ All of the different running states that the robot can be in
+ |
+
| Motor
+ An outline for all of the basic motor behavior
+ |
+
| Class and Description | +
|---|
| Encoder
+ A motor encoder that keeps track of kinematic information about the motor
+ |
+
| Motor
+ An outline for all of the basic motor behavior
+ |
+
| Class and Description | +
|---|
| Button
+ An outline for the fundamental behavior of a button
+ |
+
| Debugger
+ Controls the flow of how debug information is read out
+ |
+
| Encoder
+ A motor encoder that keeps track of kinematic information about the motor
+ |
+
| 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 and Description | +
|---|
| Encoder
+ A motor encoder that keeps track of kinematic information about the motor
+ |
+
| Motor
+ An outline for all of the basic motor behavior
+ |
+
| Class and Description | +
|---|
| Alloy
+ The main class that takes care of setting up the environment, and running all of the main methods
+ |
+
public class DTInput
+extends java.lang.Object
+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
| Constructor and Description | +
|---|
DTInput(Vector translation,
+ Angle rotation) |
+
| Modifier and Type | +Method and Description | +
|---|---|
Angle |
+getRotation() |
+
Vector |
+getTranslation() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic interface DTMapper +extends Mapper<DTInput>+
public class DriveModule +extends MotorModule+
Toggleable.Statuscomponents, debuggerstatus| Constructor and Description | +
|---|
DriveModule(Vector direction,
+ Encoder encoder,
+ ErrorCorrection<java.lang.Double> powerControl,
+ Motor... motors)
+Create a fully functioning motor module
+ |
+
addStep, atTargetPosition, disableAction, getDirection, getEncoder, getModifier, getMotors, getOffset, getPowerControl, getTargetPower, powerCorrection, setEncoder, setErrorCorrection, setMovementSpeed, setPositionCorrection, setPower, setPowerModifier, setTargetPosition, toPosition, usingPoweraddDebug, addDebugs, debug, disableDebug, enableAction, enableDebug, getComponentsdisable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic DriveModule(Vector direction, + Encoder encoder, + ErrorCorrection<java.lang.Double> powerControl, + Motor... motors)+
Modules created like this will be able to adjust their speed based on an error correction + to maintain a more accurate speed.
direction - the direction that the module runs (for use in motor groups)encoder - the encoder that keeps track of the motors positionpowerControl - an error correction to adjust the speed of the modulemotors - the motors that the module controlspublic class DriveTrain +extends MotorGroup<DTInput>+
Toggleable.Statuscomponents, debuggerstatus| Constructor and Description | +
|---|
DriveTrain(Input<DTInput> input,
+ Mapper mapper,
+ MotorModule... modules) |
+
| Modifier and Type | +Method and Description | +
|---|---|
int[] |
+getEncoderValues() |
+
int[] |
+getLeftEncoderValues() |
+
int[] |
+getRightEncoderValues() |
+
void |
+setDefaultInput() |
+
controlPower, getInput, getMapper, getModules, setInput, setMapperaddDebug, addDebugs, debug, disableAction, disableDebug, enableAction, enableDebug, getComponentsdisable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic class TankDrive +extends DriveTrain+
Toggleable.Statuscomponents, debuggerstatus| Constructor and Description | +
|---|
TankDrive(InputComponent<DTInput> input,
+ MotorModule... modules) |
+
TankDrive(MotorModule... modules) |
+
getEncoderValues, getLeftEncoderValues, getRightEncoderValues, setDefaultInputcontrolPower, getInput, getMapper, getModules, setInput, setMapperaddDebug, addDebugs, debug, disableAction, disableDebug, enableAction, enableDebug, getComponentsdisable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic TankDrive(InputComponent<DTInput> input, + MotorModule... modules)+
public TankDrive(MotorModule... modules)+
Toggleable.Statuscomponents, debuggerstatus| Constructor and Description | +
|---|
TankMapper() |
+
TankMapper(double maxSpeed,
+ double maxRotation) |
+
TankMapper(Vector maxSpeed,
+ Angle maxRotation) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+map(DTInput input,
+ MotorModule... modules)
+map the input to the modules
+ |
+
addDebug, addDebugs, debug, disableAction, disableDebug, enableAction, enableDebug, getComponentsdisable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.drive | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
void |
+TankMapper.map(DTInput input,
+ MotorModule... modules) |
+
| Modifier and Type | +Method and Description | +
|---|---|
DriveTrain |
+DriveTrain.setInput(InputComponent<DTInput> input) |
+
| Constructor and Description | +
|---|
DriveTrain(InputComponent<DTInput> input,
+ Mapper mapper,
+ MotorModule... modules) |
+
TankDrive(InputComponent<DTInput> input,
+ MotorModule... modules) |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.drive | ++ |
| Modifier and Type | +Class and Description | +
|---|---|
class |
+TankMapper |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.core | ++ |
| org.montclairrobotics.alloy.drive | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
static DriveTrain |
+Alloy.getDriveTrain() |
+
| Modifier and Type | +Method and Description | +
|---|---|
static void |
+Alloy.setDriveTrain(DriveTrain driveTrain) |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+TankDrive |
+
| Modifier and Type | +Method and Description | +
|---|---|
DriveTrain |
+DriveTrain.setInput(InputComponent<DTInput> input) |
+
DriveTrain |
+DriveTrain.setMapper(Mapper mapper) |
+
| Interface | +Description | +
|---|---|
| DTMapper | +
+ A mapper that specifically takes in DTInputs
+ |
+
| Class | +Description | +
|---|---|
| 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 | ++ |
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.core | ++ |
| org.montclairrobotics.alloy.drive | ++ |
| Class and Description | +
|---|
| DriveTrain
+ Created by MHS Robotics on 12/16/2017.
+ |
+
| Class and Description | +
|---|
| DriveTrain
+ Created by MHS Robotics on 12/16/2017.
+ |
+
| DTInput
+ An input for a drivetrain that takes a rate of translation, and rotation
+ |
+
| DTMapper
+ A mapper that specifically takes in DTInputs
+ |
+
public class InvalidConfigurationException
+extends java.lang.RuntimeException
+| Constructor and Description | +
|---|
InvalidConfigurationException(java.lang.String message) |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic class UpdateException
+extends java.lang.RuntimeException
+| Constructor and Description | +
|---|
UpdateException(java.lang.String message) |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait| Exception | +Description | +
|---|---|
| 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
+ |
+
| 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
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
static FTCButton |
+getAButton(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+getBButton(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+getDPADDown(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+getDPADLeft(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+getDPADUp(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+getLeftBumper(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+getLeftTrigger(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+getRightBumper(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+getRightTrigger(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
boolean |
+getValue()
+Gets the values for a button
+ |
+
static FTCButton |
+getXButton(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+getYButton(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+getYDPADRight(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic FTCButton(Input<java.lang.Boolean> buttonInput)+
buttonInput - an input that returns true if the button is being pressed, and false if
+ unpressedpublic FTCButton(Input<java.lang.Boolean> buttonInput, + boolean invert)+
buttonInput - an input that returns true if the button is being pressed, and false if
+ unpressedinvert - if true inverts the value of buttonInputpublic boolean getValue()+
public static FTCButton getAButton(com.qualcomm.robotcore.hardware.Gamepad gamepad)+
public static FTCButton getBButton(com.qualcomm.robotcore.hardware.Gamepad gamepad)+
public static FTCButton getXButton(com.qualcomm.robotcore.hardware.Gamepad gamepad)+
public static FTCButton getYButton(com.qualcomm.robotcore.hardware.Gamepad gamepad)+
public static FTCButton getDPADUp(com.qualcomm.robotcore.hardware.Gamepad gamepad)+
public static FTCButton getDPADDown(com.qualcomm.robotcore.hardware.Gamepad gamepad)+
public static FTCButton getYDPADRight(com.qualcomm.robotcore.hardware.Gamepad gamepad)+
public static FTCButton getDPADLeft(com.qualcomm.robotcore.hardware.Gamepad gamepad)+
public static FTCButton getRightBumper(com.qualcomm.robotcore.hardware.Gamepad gamepad)+
public static FTCButton getLeftBumper(com.qualcomm.robotcore.hardware.Gamepad gamepad)+
public static FTCButton getRightTrigger(com.qualcomm.robotcore.hardware.Gamepad gamepad)+
public static FTCButton getLeftTrigger(com.qualcomm.robotcore.hardware.Gamepad gamepad)+
public class FTCDebug +extends java.lang.Object +implements Debug+
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
| Modifier and Type | +Method and Description | +
|---|---|
void |
+log(java.lang.String key,
+ java.lang.Object value)
+Debugs a value with a Key(Identifier)
+ |
+
void |
+msg(java.lang.Object value)
+Debugs any value or message(note) to the user with a default key
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic class FTCDebugger +extends Debugger+
Debugger.LeveldebugLevel| Constructor and Description | +
|---|
FTCDebugger()
+Create a new FTCDebugger, and throw an exception if it has not been initialized
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
org.firstinspires.ftc.robotcore.external.Telemetry |
+getTelemetry() |
+
void |
+out(java.lang.String key,
+ java.lang.Object value)
+The most basic debug that simply outputs information given a key and value
+ |
+
debug, debug, driverInfo, error, log, override, setDebugLevel, test, warnclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic FTCDebugger()+
public static enum FTCJoystick.Side +extends java.lang.Enum<FTCJoystick.Side>+
| Enum Constant and Description | +
|---|
LEFT |
+
RIGHT |
+
| Modifier and Type | +Method and Description | +
|---|---|
static FTCJoystick.Side |
+valueOf(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.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfgetClass, notify, notifyAll, wait, wait, waitpublic static final FTCJoystick.Side RIGHT+
public static final FTCJoystick.Side LEFT+
public static FTCJoystick.Side[] values()+
+for (FTCJoystick.Side c : FTCJoystick.Side.values()) + System.out.println(c); +
public static FTCJoystick.Side valueOf(java.lang.String name)+
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic class FTCJoystick +extends InputComponent<Vector> +implements Joystick+
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
| Modifier and Type | +Class and Description | +
|---|---|
static class |
+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
+ |
+
Toggleable.Statusinput, output, stepscomponents, debuggerstatus| Constructor and Description | +
|---|
FTCJoystick(com.qualcomm.robotcore.hardware.Gamepad gamepad,
+ FTCJoystick.Side side)
+Create a new Joystick using the gamepad and side
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
Vector |
+getValue()
+Gets the position of the joystick as a vector
+ |
+
void |
+updateControls() |
+
addStep, applySteps, get, setInputaddDebug, addDebugs, debug, disableAction, disableDebug, enableAction, enableDebug, getComponentsdisable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic FTCJoystick(com.qualcomm.robotcore.hardware.Gamepad gamepad, + FTCJoystick.Side side)+
gamepad - The gamepad the joystick is onside - The side the joystick is on (Right/Left)public class FTCMotor +extends Component +implements Motor+
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
FTCTargetMotorToggleable.Status| Modifier and Type | +Field and Description | +
|---|---|
com.qualcomm.robotcore.hardware.DcMotor |
+motor
+The physical hardware motor reference to the motor being controlled
+ |
+
double |
+power
+The power that the motor should be running at
+ |
+
components, debuggerstatus| Constructor and Description | +
|---|
FTCMotor(java.lang.String motorConfiguration) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+disableAction()
+The action that is taken when the component is disabled, should be overridden by the user
+ |
+
Encoder |
+getEncoder() |
+
boolean |
+getInverted()
+Gets weather the motor is inverted
+ |
+
double |
+getMotorPower()
+Gets the motor power
+ |
+
void |
+setInverted(boolean inverted)
+Sets whether the motor runs the default way , or inverted
+ |
+
void |
+setMotorPower(double power)
+Sets the motor Power
+ |
+
void |
+updateMotor() |
+
addDebug, addDebugs, debug, disableDebug, enableAction, enableDebug, getComponentsdisable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic com.qualcomm.robotcore.hardware.DcMotor motor+
public double power+
public FTCMotor(java.lang.String motorConfiguration)+
public void setMotorPower(double power)+
setMotorPower in interface Motorpower - the power that the motor will be set to (0-1 inclusive )public double getMotorPower()+
getMotorPower in interface Motorpublic void setInverted(boolean inverted)+
setInverted in interface Motorinverted - true for inverted, false for normalpublic boolean getInverted()+
getInverted in interface Motorpublic Encoder getEncoder()+
public void updateMotor()+
public void disableAction()+
ComponentdisableAction in class Componentpublic class FTCTargetMotor +extends FTCMotor +implements TargetMotor+
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
Toggleable.Statuscomponents, debuggerstatus| Constructor and Description | +
|---|
FTCTargetMotor(java.lang.String motorConfiguration)
+Creates a new FTC Target motor, using the motor id from the FTC configuration
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+disableErrorCorrection()
+Stop using the custom Error Correction and return to using the default mode
+ |
+
Encoder |
+getEncoder()
+Allows for the creation of an encoder object that is aware of the amount of ticks the motor
+ has gone
+ |
+
ErrorCorrection<java.lang.Double> |
+getErrorCorrection() |
+
com.qualcomm.robotcore.hardware.DcMotor |
+getMotor() |
+
int |
+getPosition()
+Gets the motors position
+ |
+
org.montclairrobotics.alloy.ftc.FTCTargetMotor.Mode |
+getRunmode()
+NOTE: this is not the same as the DCMotor runmode
+ |
+
double |
+getTargetPower()
+Gets the motor power
+ |
+
void |
+setErrorCorrection(ErrorCorrection correction)
+Set the motor to run using a custom Error Correction
+ |
+
void |
+setPosition(int position)
+Sets the motor position
+ |
+
void |
+setTargetPower(double power)
+Sets the motor Power
+ |
+
void |
+update()
+If the mode is custom, then the update method will set the motor power using the custom PID
+ |
+
disableAction, getInverted, getMotorPower, setInverted, setMotorPower, updateMotoraddDebug, addDebugs, debug, disableDebug, enableAction, enableDebug, getComponentsdisable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetInverted, getMotorPower, setInverted, setMotorPowerpublic FTCTargetMotor(java.lang.String motorConfiguration)+
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
motorConfiguration - the name of the motorErrorCorrectionpublic void setPosition(int position)+
setPosition in interface TargetMotorposition - the position the motor will be set to (in encoder ticks)public int getPosition()+
getPosition in interface TargetMotorpublic void setTargetPower(double power)+
setTargetPower in interface TargetMotorpower - the power that the motor will be set to (0-1 inclusive )public double getTargetPower()+
getTargetPower in interface TargetMotorpublic void setErrorCorrection(ErrorCorrection correction)+
correction - the correction that the motor will be controlled withpublic void disableErrorCorrection()+
public void update()+
public ErrorCorrection<java.lang.Double> getErrorCorrection()+
public com.qualcomm.robotcore.hardware.DcMotor getMotor()+
public org.montclairrobotics.alloy.ftc.FTCTargetMotor.Mode getRunmode()+
public Encoder getEncoder()+
getEncoder in class FTCMotor| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.ftc | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
static FTCButton |
+FTCButton.getAButton(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+FTCButton.getBButton(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+FTCButton.getDPADDown(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+FTCButton.getDPADLeft(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+FTCButton.getDPADUp(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+FTCButton.getLeftBumper(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+FTCButton.getLeftTrigger(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+FTCButton.getRightBumper(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+FTCButton.getRightTrigger(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+FTCButton.getXButton(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+FTCButton.getYButton(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
static FTCButton |
+FTCButton.getYDPADRight(com.qualcomm.robotcore.hardware.Gamepad gamepad) |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.ftc | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
static FTCJoystick.Side |
+FTCJoystick.Side.valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static FTCJoystick.Side[] |
+FTCJoystick.Side.values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
| Constructor and Description | +
|---|
FTCJoystick(com.qualcomm.robotcore.hardware.Gamepad gamepad,
+ FTCJoystick.Side side)
+Create a new Joystick using the gamepad and side
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.ftc | ++ |
| Modifier and Type | +Class and Description | +
|---|---|
class |
+FTCTargetMotor
+Implementation of a target motor for the FTC competition
+ |
+
| Class | +Description | +
|---|---|
| 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 | +Description | +
|---|---|
| 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
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.ftc | ++ |
| Class and Description | +
|---|
| FTCButton
+ An FTC button provides implementation for a button used in the FTC competition
+ |
+
| 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
+ |
+
| FTCMotor
+ Implementation of a basic motor for the FTC competition
+ |
+
| Constructor and Description | +
|---|
DefaultMapper() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+map(Input<java.lang.Double> input,
+ MotorModule... modules)
+map the input to the modules
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitT - the type of input the mapper takes inpublic interface Mapper<T>
+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
| Modifier and Type | +Method and Description | +
|---|---|
void |
+map(T input,
+ MotorModule... modules)
+map the input to the modules
+ |
+
void map(T input, + MotorModule... modules)+
public class MotorGroup<T> +extends Component+
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
Toggleable.Statuscomponents, debuggerstatus| Constructor and Description | +
|---|
MotorGroup(Input<java.lang.Double> input,
+ MotorModule... modules)
+Creates a motor group with a default mapper that simply
+ |
+
MotorGroup(Input input,
+ Mapper mapper,
+ MotorModule... modules) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+controlPower() |
+
Input<T> |
+getInput() |
+
Mapper |
+getMapper() |
+
java.util.ArrayList<MotorModule> |
+getModules() |
+
void |
+setInput(Input<T> input) |
+
void |
+setMapper(Mapper mapper) |
+
addDebug, addDebugs, debug, disableAction, disableDebug, enableAction, enableDebug, getComponentsdisable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic MotorGroup(Input input, + Mapper mapper, + MotorModule... modules)+
public MotorGroup(Input<java.lang.Double> input, + MotorModule... modules)+
input - modules - public class MotorModule +extends Component+
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.
Toggleable.Statuscomponents, debuggerstatus| Constructor and Description | +
|---|
MotorModule(Vector direction,
+ Encoder encoder,
+ ErrorCorrection<java.lang.Double> powerControl,
+ Motor... motors)
+Create a fully functioning motor module
+ |
+
MotorModule(Vector direction,
+ Motor... motors)
+Create motor module without the use of an encoder
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
MotorModule |
+addStep(Step s) |
+
boolean |
+atTargetPosition(double tolerance) |
+
void |
+disableAction()
+Method to be called when the toggleable is disabled
+ |
+
Vector |
+getDirection() |
+
Encoder |
+getEncoder() |
+
InputComponent<java.lang.Double> |
+getModifier() |
+
java.util.ArrayList<Motor> |
+getMotors() |
+
Vector |
+getOffset() |
+
ErrorCorrection<java.lang.Double> |
+getPowerControl() |
+
double |
+getTargetPower() |
+
void |
+powerCorrection() |
+
MotorModule |
+setEncoder(Encoder encoder)
+Set an encoder for the module
+ |
+
MotorModule |
+setErrorCorrection(ErrorCorrection powerControl)
+set the power control for the module
+ |
+
void |
+setMovementSpeed(double speed) |
+
MotorModule |
+setPositionCorrection(ErrorCorrection positionCorrection) |
+
void |
+setPower(double power)
+Set the target power of the module
+ |
+
MotorModule |
+setPowerModifier(InputComponent<java.lang.Double> modifier) |
+
void |
+setTargetPosition(double targetPosition) |
+
void |
+toPosition() |
+
void |
+usingPower() |
+
addDebug, addDebugs, debug, disableDebug, enableAction, enableDebug, getComponentsdisable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic MotorModule(Vector direction, + Encoder encoder, + ErrorCorrection<java.lang.Double> powerControl, + Motor... motors)+
Modules created like this will be able to adjust their speed based on an error correction + to maintain a more accurate speed.
direction - the direction that the module runs (for use in motor groups)encoder - the encoder that keeps track of the motors positionpowerControl - an error correction to adjust the speed of the modulemotors - the motors that the module controlspublic MotorModule(Vector direction, + Motor... motors)+
Modules created like this will not be abe to monitor or adjust their speed to maintain a + constant and more exact speed.
direction - what direction the module runsmotors - the motors the module controlspublic MotorModule setEncoder(Encoder encoder)+
encoder - the encoder that keeps track of the position of the modulepublic MotorModule setErrorCorrection(ErrorCorrection powerControl)+
powerControl - an error correction to adjust the speed of the modulepublic MotorModule setPositionCorrection(ErrorCorrection positionCorrection)+
public void powerCorrection()+
public void setPower(double power)+
power - how fast the module will go (-1 to 1)public void setMovementSpeed(double speed)+
public void setTargetPosition(double targetPosition)+
public MotorModule setPowerModifier(InputComponent<java.lang.Double> modifier)+
public MotorModule addStep(Step s)+
public void disableAction()+
disableAction in class Componentpublic java.util.ArrayList<Motor> getMotors()+
public Vector getDirection()+
public ErrorCorrection<java.lang.Double> getPowerControl()+
public Encoder getEncoder()+
public double getTargetPower()+
public InputComponent<java.lang.Double> getModifier()+
public Vector getOffset()+
public boolean atTargetPosition(double tolerance)+
public void toPosition()+
public void usingPower()+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.drive | ++ |
| org.montclairrobotics.alloy.motor | ++ |
| org.montclairrobotics.alloy.test | ++ |
| Modifier and Type | +Interface and Description | +
|---|---|
interface |
+DTMapper
+A mapper that specifically takes in DTInputs
+ |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+TankMapper |
+
| Modifier and Type | +Method and Description | +
|---|---|
DriveTrain |
+DriveTrain.setMapper(Mapper mapper) |
+
| Constructor and Description | +
|---|
DriveTrain(InputComponent<DTInput> input,
+ Mapper mapper,
+ MotorModule... modules) |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+DefaultMapper
+A simple default mapper
+ |
+
| Modifier and Type | +Field and Description | +
|---|---|
Mapper |
+MotorGroup.mapper
+The mapper that will be used for power assignment and calculation
+ |
+
| Constructor and Description | +
|---|
MotorGroup(InputComponent input,
+ Mapper mapper,
+ MotorModule... modules) |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+IntakeMapper |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.drive | ++ |
| Modifier and Type | +Class and Description | +
|---|---|
class |
+DriveTrain
+Created by MHS Robotics on 12/16/2017.
+ |
+
class |
+TankDrive |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.drive | ++ |
| org.montclairrobotics.alloy.motor | ++ |
| org.montclairrobotics.alloy.test | ++ |
| Modifier and Type | +Class and Description | +
|---|---|
class |
+DriveModule |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+TankMapper.map(DTInput input,
+ MotorModule... modules) |
+
| Constructor and Description | +
|---|
DriveTrain(InputComponent<DTInput> input,
+ Mapper mapper,
+ MotorModule... modules) |
+
TankDrive(InputComponent<DTInput> input,
+ MotorModule... modules) |
+
| Modifier and Type | +Field and Description | +
|---|---|
java.util.ArrayList<MotorModule> |
+MotorGroup.modules
+The modules contained in the motor group
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
MotorModule |
+MotorModule.addStep(Step s) |
+
MotorModule |
+MotorModule.setEncoder(Encoder encoder)
+Set an encoder for the module
+ |
+
MotorModule |
+MotorModule.setErrorCorrection(ErrorCorrection powerControl)
+set the power control for the module
+ |
+
MotorModule |
+MotorModule.setPowerModifier(InputComponent<java.lang.Double> modifier) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+DefaultMapper.map(Input<java.lang.Double> input,
+ MotorModule... modules) |
+
void |
+Mapper.map(T input,
+ MotorModule... modules)
+map the input to the modules
+ |
+
| Constructor and Description | +
|---|
MotorGroup(InputComponent<java.lang.Double> input,
+ MotorModule... modules)
+Creates a motor group with a default mapper that simply
+ |
+
MotorGroup(InputComponent input,
+ Mapper mapper,
+ MotorModule... modules) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+IntakeMapper.map(Vector input,
+ MotorModule... modules) |
+
| Interface | +Description | +
|---|---|
| Mapper<T> | +
+ A mapper takes an input, and maps it to the set of motor modules
+ |
+
| Class | +Description | +
|---|---|
| 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
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.drive | ++ |
| org.montclairrobotics.alloy.motor | ++ |
| org.montclairrobotics.alloy.test | ++ |
| Class and Description | +
|---|
| Mapper
+ A mapper takes an input, and maps it to the set of motor modules
+ |
+
| MotorGroup
+ A motor group is a group of motor modules that run together
+ |
+
| MotorModule
+ Highly Functional set of motors that run together
+ |
+
| Class and Description | +
|---|
| Mapper
+ A mapper takes an input, and maps it to the set of motor modules
+ |
+
| MotorModule
+ Highly Functional set of motors that run together
+ |
+
| Class and Description | +
|---|
| Mapper
+ A mapper takes an input, and maps it to the set of motor modules
+ |
+
| MotorModule
+ Highly Functional set of motors that run together
+ |
+
| Constructor and Description | +
|---|
Deadzone() |
+
Deadzone(double tolerance) |
+
| Modifier and Type | +Method and Description | +
|---|---|
java.lang.Double |
+getOutput(java.lang.Double input) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait| Constructor and Description | +
|---|
VectorDeadzone(double tolerance) |
+
| Modifier and Type | +Method and Description | +
|---|---|
Vector |
+getOutput(Vector input) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait| Class | +Description | +
|---|---|
| Deadzone | ++ |
| VectorDeadzone | ++ |
public class Deadzone +extends Toggleable +implements Step<java.lang.Double>+
Toggleable.Statusstatus| Constructor and Description | +
|---|
Deadzone()
+Create a deadzone with a default tolerance of 0.05
+ |
+
Deadzone(double tolerance)
+Create a deadzone specifying the tolerance
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+disableAction()
+Method to be called when the toggleable is disabled
+ |
+
void |
+enableAction()
+Method to be called when the toggleable is enabled
+ |
+
java.lang.Double |
+getOutput(java.lang.Double input)
+The operation to be performed on the input, to get the output
+ |
+
double |
+getTolerance() |
+
void |
+setTolerance(int tolerance)
+set the threshold value
+ |
+
disable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic Deadzone(double tolerance)+
public Deadzone()+
public java.lang.Double getOutput(java.lang.Double input)+
Steppublic void enableAction()+
ToggleableenableAction in class Toggleablepublic void disableAction()+
ToggleabledisableAction in class Toggleablepublic double getTolerance()+
public void setTolerance(int tolerance)+
public class VectorDeadzone +extends Toggleable +implements Step<Vector>+
Toggleable.Statusstatus| Constructor and Description | +
|---|
VectorDeadzone()
+Create a VectorDeadzone with a default tolerance of 0.05
+ |
+
VectorDeadzone(double tolerance)
+Create a VectorDeadzone specifying the tolerance
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+disableAction()
+Method to be called when the toggleable is disabled
+ |
+
void |
+enableAction()
+Method to be called when the toggleable is enabled
+ |
+
Vector |
+getOutput(Vector input)
+The operation to be performed on the input, to get the output
+ |
+
double |
+getTolerance() |
+
void |
+setTolerance(double tolerance)
+set the threshold value
+ |
+
disable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic VectorDeadzone(double tolerance)+
public VectorDeadzone()+
public Vector getOutput(Vector input)+
Steppublic void enableAction()+
ToggleableenableAction in class Toggleablepublic void disableAction()+
ToggleabledisableAction in class Toggleablepublic double getTolerance()+
public void setTolerance(double tolerance)+
| Class | +Description | +
|---|---|
| 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
+ |
+
public class Control
+extends java.lang.Object
+public class Hardware +extends Initializeable+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+init()
+the method that is called at the beginning of the teleop mode
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic void init()+
Initializeableinit in class Initializeable| Constructor and Description | +
|---|
IntakeMapper() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+map(Vector input,
+ MotorModule... modules)
+map the input to the modules
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic class Shooter +extends Toggleable+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+disableAction()
+Method to be called when the toggleable is disabled
+ |
+
void |
+enableAction()
+Method to be called when the toggleable is enabled
+ |
+
disable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic void enableAction()+
ToggleableenableAction in class Toggleablepublic void disableAction()+
ToggleabledisableAction in class Toggleable| Constructor and Description | +
|---|
ShooterMapper() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+map(Vector input,
+ MotorModule... modules)
+map the input to the modules
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic class SquareAuto +extends SimpleAutonomous+
auto, timergamepad1, gamepad2, hardwareMap, internalOpModeServices, msStuckDetectInit, msStuckDetectInitLoop, msStuckDetectLoop, msStuckDetectStart, msStuckDetectStop, telemetry, time| Constructor and Description | +
|---|
SquareAuto() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+setup()
+This is where the user should define all their code and where "Auto", should be instantiated
+ |
+
addState, contition, drive, turninit, loop, newState, start, userLoopgetRuntime, init_loop, internalPostInitLoop, internalPostLoop, internalPreInit, internalUpdateTelemetryNow, requestOpModeStop, resetStartTime, stop, updateTelemetryclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic void setup()+
AlloyAutonomoussetup in class SimpleAutonomous@TeleOp +public class TestRobot +extends Alloy+
initObjectsgamepad1, gamepad2, hardwareMap, internalOpModeServices, msStuckDetectInit, msStuckDetectInitLoop, msStuckDetectLoop, msStuckDetectStart, msStuckDetectStop, telemetry, time| Modifier and Type | +Method and Description | +
|---|---|
void |
+initialization()
+The initialization method is were everything specific to the OpMode Should be set up.
+ |
+
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.
+ |
+
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.
+ |
+
getDriveTrain, init, loop, setDriveTraingetRuntime, init_loop, internalPostInitLoop, internalPostLoop, internalPreInit, internalUpdateTelemetryNow, requestOpModeStop, resetStartTime, start, stop, updateTelemetryclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic void robotSetup()+
AlloyrobotSetup in class Alloypublic void initialization()+
Alloyinitialization in class Alloypublic void periodic()+
Alloy| Class | +Description | +
|---|---|
| IntakeMapper | ++ |
| SquareAuto | ++ |
| TestRobot | ++ |
public class Updatable
+extends java.lang.Object
+| Modifier and Type | +Method and Description | +
|---|---|
int |
+getUpdateRate() |
+
void |
+run() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait@Retention(value=RUNTIME)
+ @Target(value=METHOD)
+public @interface Update
+All methods annotated with @Update, will be added to the updater, but can only be successfully
+ updated if the method exists within a Component
| Modifier and Type | +Optional Element and Description | +
|---|---|
int |
+priority |
+
int |
+updateRate |
+
public class Updateable
+extends java.lang.Object
+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
Updater| Modifier and Type | +Method and Description | +
|---|---|
void |
+getReferences()
+Gets references to all of the object that the update method should be called on
+ |
+
int |
+getUpdateRate() |
+
void |
+run() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic class Updater
+extends java.lang.Object
+| Modifier and Type | +Method and Description | +
|---|---|
static void |
+registerUpdatables() |
+
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
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static void registerUpdatables()+
public static void update()+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.components | ++ |
| org.montclairrobotics.alloy.control | ++ |
| org.montclairrobotics.alloy.ftc | ++ |
| org.montclairrobotics.alloy.motor | ++ |
| org.montclairrobotics.alloy.utils | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
void |
+Component.debug() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+ButtonAction.update() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+FTCTargetMotor.update()
+If the mode is custom, then the update method will set the motor power using the custom PID
+ |
+
void |
+FTCJoystick.updateControls() |
+
void |
+FTCMotor.updateMotor() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+MotorGroup.controlPower() |
+
void |
+MotorModule.powerCorrection() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+BangBang.calculateCorrection() |
+
void |
+GyroCorrection.calculateCorrection() |
+
void |
+Differential.calculateDifferential() |
+
void |
+PID.update() |
+
| Class | +Description | +
|---|---|
| Updateable | +
+ A class used for creating objects that can be updated by the Updater
+ |
+
| Updater | +
+ Created by MHS Robotics on 12/5/2017.
+ |
+
| Annotation Type | +Description | +
|---|---|
| Update | +
+ Indicates that the annotated method will be updated by the updater
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.components | ++ |
| org.montclairrobotics.alloy.control | ++ |
| org.montclairrobotics.alloy.ftc | ++ |
| org.montclairrobotics.alloy.motor | ++ |
| org.montclairrobotics.alloy.utils | ++ |
| Class and Description | +
|---|
| Update
+ Indicates that the annotated method will be updated by the updater
+ |
+
| Class and Description | +
|---|
| Update
+ Indicates that the annotated method will be updated by the updater
+ |
+
| Class and Description | +
|---|
| Update
+ Indicates that the annotated method will be updated by the updater
+ |
+
| Class and Description | +
|---|
| Update
+ Indicates that the annotated method will be updated by the updater
+ |
+
| Class and Description | +
|---|
| Update
+ Indicates that the annotated method will be updated by the updater
+ |
+
public class BangBang +extends InputComponent<java.lang.Double> +implements ErrorCorrection<java.lang.Double>+
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
Toggleable.Status| Modifier and Type | +Field and Description | +
|---|---|
double |
+highOut |
+
double |
+lowOut |
+
double |
+target |
+
input, output, stepscomponents, debuggerstatus| Constructor and Description | +
|---|
BangBang(double correction) |
+
BangBang(double lowOut,
+ double highOut) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+calculateCorrection() |
+
BangBang |
+copy() |
+
java.lang.Double |
+getCorrection()
+Get the value to apply the correction
+ |
+
BangBang |
+setInput(Input input)
+A daisy-chainable method that sets the initial input of the input component
+ |
+
BangBang |
+setTarget(java.lang.Double target)
+Set the target for the correction When the input is equal to the target the error is 0
+ |
+
addStep, applySteps, getaddDebug, addDebugs, debug, disableAction, disableDebug, enableAction, enableDebug, getComponentsdisable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic double target+
public double lowOut+
public double highOut+
public BangBang(double lowOut, + double highOut)+
public BangBang(double correction)+
public BangBang setTarget(java.lang.Double target)+
setTarget in interface ErrorCorrection<java.lang.Double>target - the goal of the error correctionpublic BangBang setInput(Input input)+
InputComponentsetInput in interface ErrorCorrection<java.lang.Double>setInput in class InputComponent<java.lang.Double>input - the input to the error correctionpublic java.lang.Double getCorrection()+
getCorrection in interface ErrorCorrection<java.lang.Double>public BangBang copy()+
copy in interface ErrorCorrection<java.lang.Double>public void calculateCorrection()+
public class BooleanToggle +extends Toggleable +implements Input<java.lang.Boolean>+
Toggleable.Statusstatus| Constructor and Description | +
|---|
BooleanToggle() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+disableAction()
+Method to be called when the toggleable is disabled
+ |
+
void |
+enableAction()
+Method to be called when the toggleable is enabled
+ |
+
java.lang.Boolean |
+get() |
+
disable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic java.lang.Boolean get()+ +
public void enableAction()+
ToggleableenableAction in class Toggleablepublic void disableAction()+
ToggleabledisableAction in class Toggleablepublic class ConstantInput<T> +extends java.lang.Object +implements Input<T>+
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
| Constructor and Description | +
|---|
ConstantInput(T constant) |
+
| Modifier and Type | +Method and Description | +
|---|---|
T |
+get() |
+
void |
+setConstantValue(T constant)
+Sets the value that the input will return
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic class Differential +extends InputComponent<java.lang.Double>+
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)
Toggleable.Status| Modifier and Type | +Field and Description | +
|---|---|
Input<java.lang.Double> |
+input
+The dependant variable in the situation
+ |
+
output, stepscomponents, debuggerstatus| Constructor and Description | +
|---|
Differential(Input in) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+calculateDifferential() |
+
java.lang.Double |
+getInput() |
+
addStep, applySteps, get, setInputaddDebug, addDebugs, debug, disableAction, disableDebug, enableAction, enableDebug, getComponentsdisable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitT - the type of error that will be correctedpublic interface ErrorCorrection<T>
+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
PID| Modifier and Type | +Method and Description | +
|---|---|
ErrorCorrection |
+copy() |
+
T |
+getCorrection()
+Get the value to apply the correction
+ |
+
ErrorCorrection<T> |
+setInput(Input<T> input)
+Set the input of the error correction the input should be the source of what correction is
+ correcting.
+ |
+
ErrorCorrection |
+setTarget(T target)
+Set the target for the correction When the input is equal to the target the error is 0
+ |
+
ErrorCorrection<T> setInput(Input<T> input)+
input - the input to the error correctionErrorCorrection setTarget(T target)+
target - the goal of the error correctionT getCorrection()+
ErrorCorrection copy()+
public class GyroCorrection +extends InputComponent+
Toggleable.Statusinput, output, stepscomponents, debuggerstatus| Constructor and Description | +
|---|
GyroCorrection() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+calculateCorrection() |
+
double |
+getCorrection() |
+
addStep, applySteps, get, setInputaddDebug, addDebugs, debug, disableAction, disableDebug, enableAction, enableDebug, getComponentsdisable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic abstract class Initializeable
+extends java.lang.Object
+| Constructor and Description | +
|---|
Initializeable() |
+
| Modifier and Type | +Method and Description | +
|---|---|
abstract void |
+init()
+the method that is called at the beginning of the teleop mode
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic interface Input<T>
+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
| Modifier and Type | +Method and Description | +
|---|---|
T |
+get() |
+
public class Monitor +extends java.lang.Object +implements Input<java.lang.Boolean>+
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.
| Modifier and Type | +Field and Description | +
|---|---|
Input<java.lang.Double> |
+input
+The input to be checked
+ |
+
Input<java.lang.Double> |
+target
+The desired target for the input
+ |
+
double |
+tolerance
+How far the input can be away from the target while still being true
+ |
+
| Constructor and Description | +
|---|
Monitor(Input<java.lang.Double> target,
+ Input<java.lang.Double> input,
+ double tolerance) |
+
| Modifier and Type | +Method and Description | +
|---|---|
java.lang.Boolean |
+get() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic Input<java.lang.Double> target+
public Input<java.lang.Double> input+
public double tolerance+
public class PID +extends InputComponent<java.lang.Double> +implements ErrorCorrection<java.lang.Double>+
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
Toggleable.Statusinput, output, stepscomponents, debuggerstatus| Constructor and Description | +
|---|
PID(double p,
+ double i,
+ double d)
+Create a new PID
+ |
+
PID(double p,
+ double i,
+ double d,
+ Input<java.lang.Double> input,
+ double target)
+Create a new PID with the input and target defined
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
ErrorCorrection |
+copy() |
+
java.lang.Double |
+getCorrection()
+Get the value to apply the correction
+ |
+
PID |
+setInput(Input<java.lang.Double> input)
+A daisy-chainable method that sets the initial input of the input component
+ |
+
PID |
+setTarget(java.lang.Double target)
+Set the target for the correction When the input is equal to the target the error is 0
+ |
+
void |
+update() |
+
addStep, applySteps, getaddDebug, addDebugs, debug, disableAction, disableDebug, enableAction, enableDebug, getComponentsdisable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic PID(double p, + double i, + double d)+
p - proportional constanti - integral constantd - derivative constantpublic PID(double p, + double i, + double d, + Input<java.lang.Double> input, + double target)+
p - proportional constani - integral constantd - derivative constantinput - the input of the component being controlled (current status)target - the desired target (status) of the component being controlledpublic PID setTarget(java.lang.Double target)+
ErrorCorrectionsetTarget in interface ErrorCorrection<java.lang.Double>target - the goal of the error correctionpublic PID setInput(Input<java.lang.Double> input)+
InputComponentsetInput in interface ErrorCorrection<java.lang.Double>setInput in class InputComponent<java.lang.Double>input - the input to the error correctionpublic void update()+
public java.lang.Double getCorrection()+
ErrorCorrectiongetCorrection in interface ErrorCorrection<java.lang.Double>public ErrorCorrection copy()+
copy in interface ErrorCorrection<java.lang.Double>public static enum Toggleable.Status +extends java.lang.Enum<Toggleable.Status>+
| Enum Constant and Description | +
|---|
DISABLED |
+
ENABLED |
+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+isEnabled() |
+
static Toggleable.Status |
+valueOf(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.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfgetClass, notify, notifyAll, wait, wait, waitpublic static final Toggleable.Status ENABLED+
public static final Toggleable.Status DISABLED+
public static Toggleable.Status[] values()+
+for (Toggleable.Status c : Toggleable.Status.values()) + System.out.println(c); +
public static Toggleable.Status valueOf(java.lang.String name)+
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic boolean isEnabled()+
public abstract class Toggleable
+extends java.lang.Object
+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
ToggleButton| Modifier and Type | +Class and Description | +
|---|---|
static class |
+Toggleable.Status |
+
| Modifier and Type | +Field and Description | +
|---|---|
Toggleable.Status |
+status
+The status of the toggleable, to keep track of weather it is enabled, or disabled
+ |
+
| Constructor and Description | +
|---|
Toggleable() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+disable()
+Disables the toggleable
+ |
+
abstract void |
+disableAction()
+Method to be called when the toggleable is disabled
+ |
+
void |
+enable()
+Enables the toggleable
+ |
+
abstract void |
+enableAction()
+Method to be called when the toggleable is enabled
+ |
+
void |
+toggle()
+Switches(Toggles), between the two states, If the toggleable is disabled, enable it If the
+ toggleable is enabled, disable it
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic Toggleable.Status status+
public abstract void enableAction()+
public abstract void disableAction()+
public void enable()+
public void disable()+
public void toggle()+
public class TuneablePID +extends InputComponent<java.lang.Double> +implements ErrorCorrection<java.lang.Double>+
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
Toggleable.Statusinput, output, stepscomponents, debuggerstatus| Constructor and Description | +
|---|
TuneablePID() |
+
| Modifier and Type | +Method and Description | +
|---|---|
ErrorCorrection |
+copy() |
+
java.lang.Double |
+getCorrection()
+Get the value to apply the correction
+ |
+
TuneablePID |
+setInput(Input input)
+Set the input of the error correction the input should be the source of what correction is
+ correcting.
+ |
+
TuneablePID |
+setTarget(java.lang.Double target)
+Set the target for the correction When the input is equal to the target the error is 0
+ |
+
addStep, applySteps, getaddDebug, addDebugs, debug, disableAction, disableDebug, enableAction, enableDebug, getComponentsdisable, enable, toggleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic TuneablePID setInput(Input input)+
setInput in interface ErrorCorrection<java.lang.Double>setInput in class InputComponent<java.lang.Double>input - the input to the error correctionpublic TuneablePID setTarget(java.lang.Double target)+
setTarget in interface ErrorCorrection<java.lang.Double>target - the goal of the error correctionpublic java.lang.Double getCorrection()+
getCorrection in interface ErrorCorrection<java.lang.Double>public ErrorCorrection copy()+
copy in interface ErrorCorrection<java.lang.Double>public class Utils
+extends java.lang.Object
+The Utils class contains static methods that can perform basic functions that can be useful
| Modifier and Type | +Method and Description | +
|---|---|
static double |
+constrain(double in,
+ double min,
+ double max)
+Makes sure that a value is between 2 different values
+ |
+
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
+ |
+
static double |
+pow2(double in,
+ int pow)
+A modified power function that conserves the sign
+ |
+
static int |
+sign(double in)
+Returns the sign of a number
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static double constrain(double in, + double min, + double max)+
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
in - the value being passed inmin - minimum the value can bemax - maximum the value can bepublic static double map(double in, + double inputMin, + double inputMax, + double outputMin, + double outputMax)+
in - the value being passed ininputMin - the minimum value the input can beinputMax - the maximum value the input can beoutputMin - the minimum value the output can beoutputMax - the maximum value the output can bepublic static int sign(double in)+
in - the number whose sign will be calculatedpublic static double pow2(double in, + int pow)+
in - the number to be raised to a powerpow - the power the number will be raised to| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.utils | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
BangBang |
+BangBang.copy() |
+
BangBang |
+BangBang.setInput(Input input) |
+
BangBang |
+BangBang.setTarget(java.lang.Double target)
+Set the target for the correction When the input is equal to the target the error is 0
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.core | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
Differential |
+Encoder.getAccelerationDifferential() |
+
Differential |
+Encoder.getVelocityDifferential() |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.drive | ++ |
| org.montclairrobotics.alloy.ftc | ++ |
| org.montclairrobotics.alloy.motor | ++ |
| org.montclairrobotics.alloy.utils | ++ |
| Constructor and Description | +
|---|
DriveModule(Vector direction,
+ Encoder encoder,
+ ErrorCorrection<java.lang.Double> powerControl,
+ Motor... motors)
+Create a fully functioning motor module
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
ErrorCorrection<java.lang.Double> |
+FTCTargetMotor.getErrorCorrection() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+FTCTargetMotor.setErrorCorrection(ErrorCorrection correction)
+Set the motor to run using a custom Error Correction
+ |
+
| Modifier and Type | +Field and Description | +
|---|---|
ErrorCorrection<java.lang.Double> |
+MotorModule.powerControl
+An error correction that will control the power
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
ErrorCorrection<java.lang.Double> |
+MotorModule.getPowerControl() |
+
| Modifier and Type | +Method and Description | +
|---|---|
MotorModule |
+MotorModule.setErrorCorrection(ErrorCorrection powerControl)
+set the power control for the module
+ |
+
| Constructor and Description | +
|---|
MotorModule(Vector direction,
+ Encoder encoder,
+ ErrorCorrection<java.lang.Double> powerControl,
+ Motor... motors)
+Create a fully functioning motor module
+ |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+BangBang
+Simple error correction, that returns one value if the error is high, and another if it is low
+ |
+
class |
+PID
+Created by Montclair robotics on 2/27/2018
+ |
+
class |
+TuneablePID
+A PID class that takes in tunable inputs to make PID tuning easier
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
ErrorCorrection |
+TuneablePID.copy() |
+
ErrorCorrection |
+PID.copy() |
+
ErrorCorrection |
+ErrorCorrection.copy() |
+
ErrorCorrection<T> |
+ErrorCorrection.setInput(Input<T> input)
+Set the input of the error correction the input should be the source of what correction is
+ correcting.
+ |
+
ErrorCorrection |
+ErrorCorrection.setTarget(T target)
+Set the target for the correction When the input is equal to the target the error is 0
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.core | ++ |
| Modifier and Type | +Field and Description | +
|---|---|
static java.util.ArrayList<Initializeable> |
+Alloy.initObjects |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.components | ++ |
| org.montclairrobotics.alloy.core | ++ |
| org.montclairrobotics.alloy.ftc | ++ |
| org.montclairrobotics.alloy.motor | ++ |
| org.montclairrobotics.alloy.utils | ++ |
| Modifier and Type | +Class and Description | +
|---|---|
class |
+InputComponent<T>
+An input component is an extension of a regular component, used for input and control systems
+ |
+
| Modifier and Type | +Field and Description | +
|---|---|
Input<T> |
+InputComponent.input
+The initial input value
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
InputComponent<T> |
+InputComponent.setInput(Input<T> input)
+A daisy-chainable method that sets the initial input of the input component
+ |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+Encoder
+A motor encoder that keeps track of kinematic information about the motor
+ |
+
| Modifier and Type | +Field and Description | +
|---|---|
Input<java.lang.Object> |
+Debug.value
+The information, or object to be debugged
+ |
+
| Constructor and Description | +
|---|
Debug(java.lang.String key,
+ Input<java.lang.Object> value)
+debug a changing value
+ |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+FTCJoystick
+Implementation of the Joystick class for FTC
+ |
+
| 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
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+DefaultMapper.map(Input<java.lang.Double> input,
+ MotorModule... modules) |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+BangBang
+Simple error correction, that returns one value if the error is high, and another if it is low
+ |
+
class |
+BooleanToggle
+An input that can be toggled between true and false
+ |
+
class |
+ConstantInput<T>
+Created by MHS Robotics on 3/30/2018.
+ |
+
class |
+Differential
+A class to calculate how an input varies with time
+ |
+
class |
+GyroCorrection
+A correction based on a gyroscope, to keep a consistent heading
+ |
+
class |
+Monitor
+Created by MHS Robotics on 3/12/2018.
+ |
+
class |
+PID
+Created by Montclair robotics on 2/27/2018
+ |
+
class |
+TuneablePID
+A PID class that takes in tunable inputs to make PID tuning easier
+ |
+
| Modifier and Type | +Field and Description | +
|---|---|
Input<java.lang.Double> |
+Monitor.input
+The input to be checked
+ |
+
Input<java.lang.Double> |
+Differential.input
+The dependant variable in the situation
+ |
+
Input<java.lang.Double> |
+Monitor.target
+The desired target for the input
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
TuneablePID |
+TuneablePID.setInput(Input input)
+Set the input of the error correction the input should be the source of what correction is
+ correcting.
+ |
+
BangBang |
+BangBang.setInput(Input input) |
+
PID |
+PID.setInput(Input<java.lang.Double> input) |
+
ErrorCorrection<T> |
+ErrorCorrection.setInput(Input<T> input)
+Set the input of the error correction the input should be the source of what correction is
+ correcting.
+ |
+
| Constructor and Description | +
|---|
Differential(Input in) |
+
Monitor(Input<java.lang.Double> target,
+ Input<java.lang.Double> input,
+ double tolerance) |
+
Monitor(Input<java.lang.Double> target,
+ Input<java.lang.Double> input,
+ double tolerance) |
+
PID(double p,
+ double i,
+ double d,
+ Input<java.lang.Double> input,
+ double target)
+Create a new PID with the input and target defined
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.utils | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
PID |
+PID.setInput(Input<java.lang.Double> input) |
+
PID |
+PID.setTarget(java.lang.Double target) |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.utils | ++ |
| Modifier and Type | +Field and Description | +
|---|---|
Toggleable.Status |
+Toggleable.status
+The status of the toggleable, to keep track of weather it is enabled, or disabled
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
static Toggleable.Status |
+Toggleable.Status.valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static Toggleable.Status[] |
+Toggleable.Status.values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.components | ++ |
| org.montclairrobotics.alloy.control | ++ |
| org.montclairrobotics.alloy.core | ++ |
| org.montclairrobotics.alloy.drive | ++ |
| org.montclairrobotics.alloy.ftc | ++ |
| org.montclairrobotics.alloy.motor | ++ |
| org.montclairrobotics.alloy.steps | ++ |
| org.montclairrobotics.alloy.utils | ++ |
| Modifier and Type | +Class and Description | +
|---|---|
class |
+Component
+The main component class that all components of alloy should extend
+ |
+
class |
+InputComponent<T>
+An input component is an extension of a regular component, used for input and control systems
+ |
+
| Constructor and Description | +
|---|
ToggleButton(Button button,
+ Toggleable toggleable) |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+Encoder
+A motor encoder that keeps track of kinematic information about the motor
+ |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+DriveModule |
+
class |
+DriveTrain
+Created by MHS Robotics on 12/16/2017.
+ |
+
class |
+TankDrive |
+
class |
+TankMapper |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+FTCJoystick
+Implementation of the Joystick class for FTC
+ |
+
class |
+FTCMotor
+Implementation of a basic motor for the FTC competition
+ |
+
class |
+FTCTargetMotor
+Implementation of a target motor for the FTC competition
+ |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+MotorGroup<T>
+A motor group is a group of motor modules that run together
+ |
+
class |
+MotorModule
+Highly Functional set of motors that run together
+ |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+Deadzone
+A step that returns 0 if the input is under a certain threshold
+ |
+
class |
+VectorDeadzone
+A step that returns 0 if the inputs magnitude is under a certain threshold
+ |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+BangBang
+Simple error correction, that returns one value if the error is high, and another if it is low
+ |
+
class |
+BooleanToggle
+An input that can be toggled between true and false
+ |
+
class |
+Differential
+A class to calculate how an input varies with time
+ |
+
class |
+GyroCorrection
+A correction based on a gyroscope, to keep a consistent heading
+ |
+
class |
+PID
+Created by Montclair robotics on 2/27/2018
+ |
+
class |
+TuneablePID
+A PID class that takes in tunable inputs to make PID tuning easier
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.utils | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
TuneablePID |
+TuneablePID.setInput(Input input)
+Set the input of the error correction the input should be the source of what correction is
+ correcting.
+ |
+
TuneablePID |
+TuneablePID.setTarget(java.lang.Double target)
+Set the target for the correction When the input is equal to the target the error is 0
+ |
+
| Interface | +Description | +
|---|---|
| ErrorCorrection<T> | +
+ A interface that defines the process of correcting an error
+ |
+
| Input<T> | +
+ A dynamically stored input
+ |
+
| Class | +Description | +
|---|---|
| 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 | +Description | +
|---|---|
| Toggleable.Status | ++ |
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.components | ++ |
| org.montclairrobotics.alloy.control | ++ |
| org.montclairrobotics.alloy.core | ++ |
| org.montclairrobotics.alloy.drive | ++ |
| org.montclairrobotics.alloy.ftc | ++ |
| org.montclairrobotics.alloy.motor | ++ |
| org.montclairrobotics.alloy.steps | ++ |
| org.montclairrobotics.alloy.utils | ++ |
| Class and Description | +
|---|
| Input
+ A dynamically stored input
+ |
+
| Toggleable
+ Created by MHS Robotics on 2/11/2018.
+ |
+
| Class and Description | +
|---|
| Toggleable
+ Created by MHS Robotics on 2/11/2018.
+ |
+
| Class and Description | +
|---|
| Differential
+ A class to calculate how an input varies with time
+ |
+
| Initializeable
+ An object that gets initialized once at the beginning of the teleop mode
+ |
+
| Input
+ A dynamically stored input
+ |
+
| Toggleable
+ Created by MHS Robotics on 2/11/2018.
+ |
+
| Class and Description | +
|---|
| ErrorCorrection
+ A interface that defines the process of correcting an error
+ |
+
| Toggleable
+ Created by MHS Robotics on 2/11/2018.
+ |
+
| Class and Description | +
|---|
| ErrorCorrection
+ A interface that defines the process of correcting an error
+ |
+
| Input
+ A dynamically stored input
+ |
+
| Toggleable
+ Created by MHS Robotics on 2/11/2018.
+ |
+
| Class and Description | +
|---|
| ErrorCorrection
+ A interface that defines the process of correcting an error
+ |
+
| Input
+ A dynamically stored input
+ |
+
| Toggleable
+ Created by MHS Robotics on 2/11/2018.
+ |
+
| Class and Description | +
|---|
| Toggleable
+ Created by MHS Robotics on 2/11/2018.
+ |
+
| Class and Description | +
|---|
| BangBang
+ Simple error correction, that returns one value if the error is high, and another if it is low
+ |
+
| ErrorCorrection
+ A interface that defines the process of correcting an error
+ |
+
| Input
+ A dynamically stored input
+ |
+
| PID
+ Created by Montclair robotics on 2/27/2018
+ |
+
| Toggleable
+ Created by MHS Robotics on 2/11/2018.
+ |
+
| Toggleable.Status | +
| TuneablePID
+ A PID class that takes in tunable inputs to make PID tuning easier
+ |
+
public class Angle
+extends java.lang.Object
+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
| Modifier and Type | +Field and Description | +
|---|---|
static Angle |
+HALF_PI |
+
static Angle |
+PI |
+
static Angle |
+TWO_PI |
+
static Angle |
+ZERO |
+
| 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
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
double |
+cos()
+get the cosine of the angle
+ |
+
static Angle |
+createDegrees(double degrees)
+Creates a new angle using degrees
+ |
+
static Angle |
+createRadians(double radians)
+Creates a new angle using radians
+ |
+
double |
+getDegrees()
+Get the angle measure in degrees
+ |
+
double |
+getRadians()
+Get the angle measure in radians
+ |
+
void |
+setDegrees(double degrees)
+set the angle in degrees
+ |
+
void |
+setRadians(double radians)
+set the angle in radians
+ |
+
double |
+sin()
+get the sine of the angle
+ |
+
double |
+tan()
+get the tangent of the angle
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static final Angle ZERO+
public static final Angle HALF_PI+
public static final Angle PI+
public static final Angle TWO_PI+
public Angle(org.montclairrobotics.alloy.vector.Angle.AngleMeasure angleMeasure, + double angle)+
angleMeasure - What unit to be used for the angle measureangle - The anglepublic Angle(double degrees)+
degrees - Degree angle measurepublic double getDegrees()+
public double getRadians()+
public void setDegrees(double degrees)+
degrees - the degree angle measurepublic void setRadians(double radians)+
radians - the degree angle measurepublic double sin()+
public double cos()+
public double tan()+
public static Angle createDegrees(double degrees)+
degrees - the amount of degrees the new angle will be created withpublic static Angle createRadians(double radians)+
radians - the amount of radians the new angle will be created withpublic class Polar +extends java.lang.Object +implements Vector+
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
Vector| Constructor and Description | +
|---|
Polar(double magnitude,
+ Angle angle) |
+
| Modifier and Type | +Method and Description | +
|---|---|
Vector |
+add(Vector vector)
+Adds two vectors together and returns the result
+ |
+
Angle |
+angleBetween(Vector vector)
+gets the angle between two vectors
+ |
+
Vector |
+copy()
+Creates a copy of the vector
+ |
+
double |
+cross(Vector vector)
+Returns the product of two vectors that have been crossed
+ |
+
double |
+dot(Vector vector)
+Returns the dot product of two vectors
+ |
+
Angle |
+getAngle()
+Gets the angle in standard position that the vector makes
+ |
+
double |
+getManitude()
+Gets the magnitude of the vector
+ |
+
double |
+getX()
+Gets the X component of the vector
+ |
+
double |
+getY()
+Gets the Y component of the vector
+ |
+
Vector |
+normalize()
+Normalizes a vector and returns the result
+ |
+
Vector |
+rotate(Angle angle)
+returns a vector rotated by a given angle
+ |
+
Vector |
+scale(double scalar)
+Scales the vectors magnitude by a scalar value
+ |
+
void |
+setAngle(Angle angle)
+Sets the angle in standard position of the vector
+ |
+
void |
+setMagnitude(double magnitude)
+Sets the magnitude of the vector
+ |
+
void |
+setX(double x)
+Sets the x component of the vector
+ |
+
void |
+setY(double y)
+Sets the y component of the vector
+ |
+
Vector |
+subtract(Vector vector)
+Subtracts a vector and returns the result
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic double getX()+
public void setX(double x)+
public double getY()+
public void setY(double y)+
public double getManitude()+
getManitude in interface Vectorpublic void setMagnitude(double magnitude)+
setMagnitude in interface Vectormagnitude - what the magnitude will be set topublic Angle getAngle()+
public void setAngle(Angle angle)+
public Vector add(Vector vector)+
+ +
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
+
+
public Vector subtract(Vector vector)+
+ +
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
public Vector scale(double scalar)+
public double cross(Vector vector)+
+ +
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
public double dot(Vector vector)+
+ +
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
public Angle angleBetween(Vector vector)+
angleBetween in interface Vectorvector - the vector that will be used to find the angle betweenpublic Vector normalize()+
+ +
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|>
public interface Vector
+| Modifier and Type | +Field and Description | +
|---|---|
static Vector |
+ZERO |
+
| Modifier and Type | +Method and Description | +
|---|---|
Vector |
+add(Vector vector)
+Adds two vectors together and returns the result
+ |
+
Angle |
+angleBetween(Vector vector)
+gets the angle between two vectors
+ |
+
Vector |
+copy()
+Creates a copy of the vector
+ |
+
double |
+cross(Vector vector)
+Returns the product of two vectors that have been crossed
+ |
+
double |
+dot(Vector vector)
+Returns the dot product of two vectors
+ |
+
Angle |
+getAngle()
+Gets the angle in standard position that the vector makes
+ |
+
double |
+getManitude()
+Gets the magnitude of the vector
+ |
+
double |
+getX()
+Gets the X component of the vector
+ |
+
double |
+getY()
+Gets the Y component of the vector
+ |
+
Vector |
+normalize()
+Normalizes a vector and returns the result
+ |
+
Vector |
+rotate(Angle angle)
+returns a vector rotated by a given angle
+ |
+
Vector |
+scale(double scalar)
+Scales the vectors magnitude by a scalar value
+ |
+
void |
+setAngle(Angle angle)
+Sets the angle in standard position of the vector
+ |
+
void |
+setMagnitude(double magnitude)
+Sets the magnitude of the vector
+ |
+
void |
+setX(double x)
+Sets the x component of the vector
+ |
+
void |
+setY(double y)
+Sets the y component of the vector
+ |
+
Vector |
+subtract(Vector vector)
+Subtracts a vector and returns the result
+ |
+
double getX()+
void setX(double x)+
x - what the x value will be set todouble getY()+
void setY(double y)+
y - what the y value will be set todouble getManitude()+
void setMagnitude(double magnitude)+
magnitude - what the magnitude will be set toAngle getAngle()+
void setAngle(Angle angle)+
angle - what the angle will be set toVector add(Vector vector)+
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
vector - The vector to be addedVector subtract(Vector vector)+
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 - The vector to be subtractedVector scale(double scalar)+
scalar - double to scale the vector bydouble cross(Vector vector)+
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
vector - the vector to be multiplied using the cross productdouble dot(Vector vector)+
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
vector - The vector to be multiplied using the dot productVector rotate(Angle angle)+
angle - the angle that the vector is to be rotated byAngle angleBetween(Vector vector)+
vector - the vector that will be used to find the angle betweenVector normalize()+
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|>
Vector copy()+
public class XY +extends java.lang.Object +implements Vector+
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
Vector| Constructor and Description | +
|---|
XY(double x,
+ double y) |
+
XY(XY vector) |
+
| Modifier and Type | +Method and Description | +
|---|---|
Vector |
+add(Vector vector)
+Adds two vectors together and returns the result
+ |
+
Angle |
+angleBetween(Vector vector)
+gets the angle between two vectors
+ |
+
Vector |
+copy()
+Creates a copy of the vector
+ |
+
double |
+cross(Vector vector)
+Returns the product of two vectors that have been crossed
+ |
+
double |
+dot(Vector vector)
+Returns the dot product of two vectors
+ |
+
Angle |
+getAngle()
+Gets the angle in standard position that the vector makes
+ |
+
double |
+getManitude()
+Gets the magnitude of the vector
+ |
+
double |
+getX()
+Gets the X component of the vector
+ |
+
double |
+getY()
+Gets the Y component of the vector
+ |
+
Vector |
+normalize()
+Normalizes a vector and returns the result
+ |
+
Vector |
+rotate(Angle angle)
+returns a vector rotated by a given angle
+ |
+
Vector |
+scale(double scalar)
+Scales the vectors magnitude by a scalar value
+ |
+
void |
+setAngle(Angle angle)
+Sets the angle in standard position of the vector
+ |
+
void |
+setMagnitude(double magnitude)
+Sets the magnitude of the vector
+ |
+
void |
+setX(double x)
+Sets the x component of the vector
+ |
+
void |
+setY(double y)
+Sets the y component of the vector
+ |
+
Vector |
+subtract(Vector vector)
+Subtracts a vector and returns the result
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic XY(double x, + double y)+
public XY(XY vector)+
public double getX()+
public void setX(double x)+
public double getY()+
public void setY(double y)+
public double getManitude()+
getManitude in interface Vectorpublic void setMagnitude(double magnitude)+
setMagnitude in interface Vectormagnitude - what the magnitude will be set topublic Angle getAngle()+
public void setAngle(Angle angle)+
public Vector add(Vector vector)+
+ +
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
+
+
public Vector subtract(Vector vector)+
+ +
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
public Vector scale(double scalar)+
public double cross(Vector vector)+
+ +
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
public double dot(Vector vector)+
+ +
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
public Angle angleBetween(Vector vector)+
angleBetween in interface Vectorvector - the vector that will be used to find the angle betweenpublic Vector normalize()+
+ +
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|>
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.drive | ++ |
| org.montclairrobotics.alloy.vector | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
Angle |
+DTInput.getRotation() |
+
| Constructor and Description | +
|---|
DTInput(Vector translation,
+ Angle rotation) |
+
TankMapper(Vector maxSpeed,
+ Angle maxRotation) |
+
| Modifier and Type | +Field and Description | +
|---|---|
static Angle |
+Angle.HALF_PI |
+
static Angle |
+Angle.PI |
+
static Angle |
+Angle.TWO_PI |
+
static Angle |
+Angle.ZERO |
+
| Modifier and Type | +Method and Description | +
|---|---|
Angle |
+XY.angleBetween(Vector vector)
+gets the angle between two vectors
+ |
+
Angle |
+Polar.angleBetween(Vector vector)
+gets the angle between two vectors
+ |
+
Angle |
+Vector.angleBetween(Vector vector)
+gets the angle between two vectors
+ |
+
static Angle |
+Angle.createDegrees(double degrees)
+Creates a new angle using degrees
+ |
+
static Angle |
+Angle.createRadians(double radians)
+Creates a new angle using radians
+ |
+
Angle |
+XY.getAngle()
+Gets the angle in standard position that the vector makes
+ |
+
Angle |
+Polar.getAngle()
+Gets the angle in standard position that the vector makes
+ |
+
Angle |
+Vector.getAngle()
+Gets the angle in standard position that the vector makes
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
Vector |
+XY.rotate(Angle angle)
+returns a vector rotated by a given angle
+ |
+
Vector |
+Polar.rotate(Angle angle)
+returns a vector rotated by a given angle
+ |
+
Vector |
+Vector.rotate(Angle angle)
+returns a vector rotated by a given angle
+ |
+
void |
+XY.setAngle(Angle angle)
+Sets the angle in standard position of the vector
+ |
+
void |
+Polar.setAngle(Angle angle)
+Sets the angle in standard position of the vector
+ |
+
void |
+Vector.setAngle(Angle angle)
+Sets the angle in standard position of the vector
+ |
+
| Constructor and Description | +
|---|
Polar(double magnitude,
+ Angle angle) |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.core | ++ |
| org.montclairrobotics.alloy.drive | ++ |
| org.montclairrobotics.alloy.ftc | ++ |
| org.montclairrobotics.alloy.motor | ++ |
| org.montclairrobotics.alloy.steps | ++ |
| org.montclairrobotics.alloy.test | ++ |
| org.montclairrobotics.alloy.vector | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
Vector |
+Joystick.getValue()
+Gets the position of the joystick
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
Vector |
+DTInput.getTranslation() |
+
| Constructor and Description | +
|---|
DriveModule(Vector direction,
+ Encoder encoder,
+ ErrorCorrection<java.lang.Double> powerControl,
+ Motor... motors)
+Create a fully functioning motor module
+ |
+
DTInput(Vector translation,
+ Angle rotation) |
+
TankMapper(Vector maxSpeed,
+ Angle maxRotation) |
+
| Modifier and Type | +Method and Description | +
|---|---|
Vector |
+FTCJoystick.getValue()
+Gets the position of the joystick as a vector
+ |
+
| Modifier and Type | +Field and Description | +
|---|---|
Vector |
+MotorModule.direction
+The direction that the modules run for use in a motor group
+ |
+
Vector |
+MotorModule.offset
+the position of the motor, relative to the center of the motor group
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
Vector |
+MotorModule.getDirection() |
+
Vector |
+MotorModule.getOffset() |
+
| Constructor and Description | +
|---|
MotorModule(Vector direction,
+ Encoder encoder,
+ ErrorCorrection<java.lang.Double> powerControl,
+ Motor... motors)
+Create a fully functioning motor module
+ |
+
MotorModule(Vector direction,
+ Motor... motors)
+Create motor module without the use of an encoder
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
Vector |
+VectorDeadzone.getOutput(Vector input) |
+
| Modifier and Type | +Method and Description | +
|---|---|
Vector |
+VectorDeadzone.getOutput(Vector input) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+IntakeMapper.map(Vector input,
+ MotorModule... modules) |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+Polar
+Created by MHS Robotics on 11/14/2017.
+ |
+
class |
+XY
+Created by MHS Robotics on 11/14/2017.
+ |
+
| Modifier and Type | +Field and Description | +
|---|---|
static Vector |
+Vector.ZERO |
+
| Modifier and Type | +Method and Description | +
|---|---|
Vector |
+XY.add(Vector vector)
+Adds two vectors together and returns the result
+ |
+
Vector |
+Polar.add(Vector vector)
+Adds two vectors together and returns the result
+ |
+
Vector |
+Vector.add(Vector vector)
+Adds two vectors together and returns the result
+ |
+
Vector |
+XY.copy()
+Creates a copy of the vector
+ |
+
Vector |
+Polar.copy()
+Creates a copy of the vector
+ |
+
Vector |
+Vector.copy()
+Creates a copy of the vector
+ |
+
Vector |
+XY.normalize()
+Normalizes a vector and returns the result
+ |
+
Vector |
+Polar.normalize()
+Normalizes a vector and returns the result
+ |
+
Vector |
+Vector.normalize()
+Normalizes a vector and returns the result
+ |
+
Vector |
+XY.rotate(Angle angle)
+returns a vector rotated by a given angle
+ |
+
Vector |
+Polar.rotate(Angle angle)
+returns a vector rotated by a given angle
+ |
+
Vector |
+Vector.rotate(Angle angle)
+returns a vector rotated by a given angle
+ |
+
Vector |
+XY.scale(double scalar)
+Scales the vectors magnitude by a scalar value
+ |
+
Vector |
+Polar.scale(double scalar)
+Scales the vectors magnitude by a scalar value
+ |
+
Vector |
+Vector.scale(double scalar)
+Scales the vectors magnitude by a scalar value
+ |
+
Vector |
+XY.subtract(Vector vector)
+Subtracts a vector and returns the result
+ |
+
Vector |
+Polar.subtract(Vector vector)
+Subtracts a vector and returns the result
+ |
+
Vector |
+Vector.subtract(Vector vector)
+Subtracts a vector and returns the result
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
Vector |
+XY.add(Vector vector)
+Adds two vectors together and returns the result
+ |
+
Vector |
+Polar.add(Vector vector)
+Adds two vectors together and returns the result
+ |
+
Vector |
+Vector.add(Vector vector)
+Adds two vectors together and returns the result
+ |
+
Angle |
+XY.angleBetween(Vector vector)
+gets the angle between two vectors
+ |
+
Angle |
+Polar.angleBetween(Vector vector)
+gets the angle between two vectors
+ |
+
Angle |
+Vector.angleBetween(Vector vector)
+gets the angle between two vectors
+ |
+
double |
+XY.cross(Vector vector)
+Returns the product of two vectors that have been crossed
+ |
+
double |
+Polar.cross(Vector vector)
+Returns the product of two vectors that have been crossed
+ |
+
double |
+Vector.cross(Vector vector)
+Returns the product of two vectors that have been crossed
+ |
+
double |
+XY.dot(Vector vector)
+Returns the dot product of two vectors
+ |
+
double |
+Polar.dot(Vector vector)
+Returns the dot product of two vectors
+ |
+
double |
+Vector.dot(Vector vector)
+Returns the dot product of two vectors
+ |
+
Vector |
+XY.subtract(Vector vector)
+Subtracts a vector and returns the result
+ |
+
Vector |
+Polar.subtract(Vector vector)
+Subtracts a vector and returns the result
+ |
+
Vector |
+Vector.subtract(Vector vector)
+Subtracts a vector and returns the result
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.vector | ++ |
| Constructor and Description | +
|---|
XY(XY vector) |
+
| Interface | +Description | +
|---|---|
| Vector | +
+ Created by MHS Robotics on 11/14/2017.
+ |
+
| Class | +Description | +
|---|---|
| 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.
+ |
+
| Package | +Description | +
|---|---|
| org.montclairrobotics.alloy.core | ++ |
| org.montclairrobotics.alloy.drive | ++ |
| org.montclairrobotics.alloy.ftc | ++ |
| org.montclairrobotics.alloy.motor | ++ |
| org.montclairrobotics.alloy.steps | ++ |
| org.montclairrobotics.alloy.test | ++ |
| org.montclairrobotics.alloy.vector | ++ |
| Class and Description | +
|---|
| Vector
+ Created by MHS Robotics on 11/14/2017.
+ |
+
| Class and Description | +
|---|
| Angle
+ A class to keep track of angles
+ |
+
| Vector
+ Created by MHS Robotics on 11/14/2017.
+ |
+
| Class and Description | +
|---|
| Vector
+ Created by MHS Robotics on 11/14/2017.
+ |
+
| Class and Description | +
|---|
| Vector
+ Created by MHS Robotics on 11/14/2017.
+ |
+
| Class and Description | +
|---|
| Vector
+ Created by MHS Robotics on 11/14/2017.
+ |
+
| Class and Description | +
|---|
| Vector
+ Created by MHS Robotics on 11/14/2017.
+ |
+
| Class and Description | +
|---|
| Angle
+ A class to keep track of angles
+ |
+
| Vector
+ Created by MHS Robotics on 11/14/2017.
+ |
+
| XY
+ Created by MHS Robotics on 11/14/2017.
+ |
+
+ + 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 @@ + + + + + +
| Package | +Description | +
|---|---|
| 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 | ++ |
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 extends Alloy> 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 extends Debug> 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 extends Debug> 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