Skip to content

Commit

Permalink
Added @experimental tag to TalonSRX and TalonController
Browse files Browse the repository at this point in the history
  • Loading branch information
rhauch committed Nov 17, 2015
1 parent b103b3b commit 2627183
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
13 changes: 11 additions & 2 deletions strongback/src/org/strongback/components/TalonSRX.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@

package org.strongback.components;

import org.strongback.annotation.Experimental;

/**
* A motor controlled by a Talon SRX with built-in current sensor, position (angle) sensor, and optional external limit switches
* wired into the SRX so that it can automatically stop the forward and reverse directions when the limit switches are
* triggered.
* <p>
* This class is currently experimental. It certainly works as a simple motor, but most of this interface exposes functionality
* of the Talon SRX motor controller, including various input sensors. Little beyond setting and reading the speed has been
* tested.
*/
@Experimental
public interface TalonSRX extends LimitedMotor {

@Override
Expand Down Expand Up @@ -315,8 +322,10 @@ public enum FeedbackDevice {
ENCODER_RISING(4),

/**
* Encoder that increments position per falling edge (and never decrements) on Quadrature-A.
* Note: Was not supported in 2015 firmware, per the <a href="https://www.ctr-electronics.com/Talon%20SRX%20Software%20Reference%20Manual.pdf">Talon SRX Software Reference Manual</a>, section 21.3
* Encoder that increments position per falling edge (and never decrements) on Quadrature-A. Note: Was not supported in
* 2015 firmware, per the
* <a href="https://www.ctr-electronics.com/Talon%20SRX%20Software%20Reference%20Manual.pdf">Talon SRX Software
* Reference Manual</a>, section 21.3
*/
ENCODER_FALLING(5);

Expand Down
6 changes: 6 additions & 0 deletions strongback/src/org/strongback/control/TalonController.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.strongback.control;

import org.strongback.annotation.Experimental;
import org.strongback.components.TalonSRX;

/**
Expand Down Expand Up @@ -85,7 +86,12 @@
*
* The {@link #reverseOutput(boolean)} method can be used to invert the output of a follower Talon. This may be useful if a
* follower and leader Talon are wired out of phase with each other.
* <p>
* This class is currently experimental. It certainly works as a simple motor, but most of this interface exposes functionality
* of the Talon SRX motor controller, including various input sensors. Little beyond setting and reading the speed has been
* tested.
*/
@Experimental
public interface TalonController extends PIDController, TalonSRX {

/**
Expand Down
20 changes: 20 additions & 0 deletions strongback/src/org/strongback/hardware/Hardware.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.strongback.hardware;

import org.strongback.annotation.Experimental;
import org.strongback.components.Accelerometer;
import org.strongback.components.AngleSensor;
import org.strongback.components.DistanceSensor;
Expand Down Expand Up @@ -547,6 +548,7 @@ public static TalonSRX talonSRX(int deviceNumber) {
* @param pulsesPerDegree the number of encoder pulses per degree of revolution of the final shaft; may be 0 if unused
* @return a {@link TalonSRX} motor; never null
*/
@Experimental
public static TalonSRX talonSRX(int deviceNumber, double pulsesPerDegree) {
return talonSRX(deviceNumber, pulsesPerDegree, 0.0d);
}
Expand All @@ -565,11 +567,26 @@ public static TalonSRX talonSRX(int deviceNumber, double pulsesPerDegree) {
* be 0 if unused
* @return a {@link TalonSRX} motor; never null
*/
@Experimental
public static TalonSRX talonSRX(int deviceNumber, double pulsesPerDegree, double analogTurnsOverVoltageRange) {
CANTalon talon = new CANTalon(deviceNumber);
return talonSRX(talon, pulsesPerDegree, analogTurnsOverVoltageRange);
}

/**
* Creates a {@link TalonSRX} motor controlled by a Talon SRX. The {@link CANTalon} object passed into this method
* should be already configured by the calling code.
* <p>
* The resulting {@link TalonSRX} will have a null {@link TalonSRX#getEncoderInput()} and a null
* {@link TalonSRX#getAnalogInput()}, and the {@link TalonSRX#getSelectedSensor()} will always return 0.
*
* @param talon the already configured {@link CANTalon} instance; may not be null
* @return a {@link TalonSRX} motor; never null
*/
public static TalonSRX talonSRX(CANTalon talon) {
return talonSRX(talon, 0.0, 0.0d);
}

/**
* Creates a {@link TalonSRX} motor controlled by a Talon SRX with an optional (angle) sensor. The {@link CANTalon}
* object passed into this method should be already configured by the calling code.
Expand All @@ -582,6 +599,7 @@ public static TalonSRX talonSRX(int deviceNumber, double pulsesPerDegree, double
* @param pulsesPerDegree the number of encoder pulses per degree of revolution of the final shaft
* @return a {@link TalonSRX} motor; never null
*/
@Experimental
public static TalonSRX talonSRX(CANTalon talon, double pulsesPerDegree) {
return talonSRX(talon, pulsesPerDegree, 0.0d);
}
Expand All @@ -601,6 +619,7 @@ public static TalonSRX talonSRX(CANTalon talon, double pulsesPerDegree) {
* be 0 if unused
* @return a {@link TalonSRX} motor; never null
*/
@Experimental
public static TalonSRX talonSRX(CANTalon talon, double pulsesPerDegree, double analogTurnsOverVoltageRange) {
if (talon == null) throw new IllegalArgumentException("The CANTalon reference may not be null");
return new HardwareTalonSRX(talon, pulsesPerDegree, analogTurnsOverVoltageRange);
Expand Down Expand Up @@ -644,6 +663,7 @@ public static final class Controllers {
* be 0 if unused
* @return the interface for managing and using the Talon SRX hardware-based PID controller; never null
*/
@Experimental
public static TalonController talonController(int deviceNumber, double pulsesPerDegree,
double analogTurnsOverVoltageRange) {
CANTalon talon = new CANTalon(deviceNumber);
Expand Down

0 comments on commit 2627183

Please sign in to comment.