### SparkLimitSwitch API Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/sparklimitswitch Provides methods to interact with the Spark Limit Switch, including getting an instance and checking its pressed state. ```APIDOC ## SparkLimitSwitch Class ### Description Represents a limit switch connected to a Rev Robotics Spark controller. You can obtain an instance of this class using `SparkBase.getForwardLimitSwitch()` or `SparkBase.getReverseLimitSwitch()`. ### Method Summary * `isPressed()`: Returns `true` if the limit switch is pressed. ### Methods inherited from class `java.lang.Object` `clone`, `equals`, `finalize`, `getClass`, `hashCode`, `notify`, `notifyAll`, `toString`, `wait`, `wait`, `wait` ## isPressed ### Description Returns `true` if the limit switch is pressed, based on the selected polarity. This method functions regardless of whether the limit switch is enabled for controller shutdown. ### Method `boolean isPressed()` ### Endpoint N/A (This is a class method, not a REST API endpoint) ### Parameters None ### Request Example ```java // Assuming you have obtained a SparkLimitSwitch instance SparkLimitSwitch limitSwitch = SparkBase.getForwardLimitSwitch(); boolean pressed = limitSwitch.isPressed(); ``` ### Response #### Success Response * **pressed** (boolean) - `true` if the limit switch is currently pressed, `false` otherwise. #### Response Example ```json true ``` ``` -------------------------------- ### SparkMax JNI: Data Port Configuration Source: https://codedocs.revrobotics.com/java/com/revrobotics/jni/cansparkjni Methods to get the configuration of the data port and check if it is configured. ```Java public static int c_Spark_GetDataPortConfig(long handle) public static boolean c_Spark_IsDataPortConfigured(long handle) ``` -------------------------------- ### StatusLogger Class Source: https://codedocs.revrobotics.com/java/com/revrobotics/util/statuslogger The StatusLogger class allows for manual control over data logging from REV devices. It provides methods to start, stop, and disable automatic logging. ```APIDOC # StatusLogger Class ### Description The StatusLogger class allows for manual control over data logging from REV devices. It provides methods to start, stop, and disable automatic logging. ### Constructors #### StatusLogger() Description: Constructs a StatusLogger object. ### Methods #### start() Method: static void Endpoint: N/A Description: Manually start capturing data from REV devices to a REV binary log (.revlog). Note: This method provides an explicit override for the default logging behavior. In most cases, this is not required, as logging begins automatically on the first call to any REVLib function. Use this method only for advanced cases where logging must begin at a precise moment, such as before the main robot loop or other subsystems are initialized. See Also: * `stop()` * `disableAutoLogging()` #### stop() Method: static void Endpoint: N/A Description: Stops the data logging session. While stopped, no new data from REV devices will be written to the REV binary log (.revlog). The logging session is not terminated and can be resumed at any time by calling `start()`. See Also: * `start()` * `disableAutoLogging()` #### disableAutoLogging() Method: static void Endpoint: N/A Description: Prevents the data logger from starting automatically. IMPORTANT: This method must be called before any other REVLib function is invoked. The recommended placement is as the first line in your `robotInit()` method. After calling this, logging will not occur until it is explicitly started with `start()`. See Also: * `start()` * `stop()` ``` -------------------------------- ### Get Feed-Forward Gain kCosRatio (Java) Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/feedforwardconfigaccessor Retrieves the cosine ratio gain (kCosRatio) coefficient. This method can be called with or without a specific ClosedLoopSlot to get the default or slot-specific value. ```java public double getkCosRatio() public double getkCosRatio(ClosedLoopSlot slot) ``` -------------------------------- ### SparkMax JNI: Encoder and Position Control Source: https://codedocs.revrobotics.com/java/com/revrobotics/jni/cansparkjni Methods for setting and getting the encoder position, and for setting the alternative encoder position. ```Java public static int c_Spark_SetEncoderPosition(long handle, float position) public static float c_Spark_GetEncoderPosition(long handle) public static int c_Spark_SetAltEncoderPosition(long handle, float position) ``` -------------------------------- ### Get Periodic Status 0 Voltage Source: https://codedocs.revrobotics.com/java/index-all Retrieves the voltage information from the ServoHub's Periodic Status 0. ```APIDOC ## GET /api/servohub/status/periodic0/voltage ### Description Retrieves the voltage value from the ServoHub's Periodic Status 0 register. ### Method GET ### Endpoint /api/servohub/status/periodic0/voltage ### Response #### Success Response (200) - **voltage** (double) - The voltage reading from the ServoHub. #### Response Example ```json { "voltage": 12.5 } ``` ``` -------------------------------- ### SparkMax JNI: Motor Temperature and Faults Source: https://codedocs.revrobotics.com/java/com/revrobotics/jni/cansparkjni Methods to get the motor temperature, clear any active faults, and retrieve fault and sticky fault status. ```Java public static float c_Spark_GetMotorTemperature(long handle) public static int c_Spark_ClearFaults(long handle) public static int c_Spark_GetFaults(long handle) public static int c_Spark_GetStickyFaults(long handle) ``` -------------------------------- ### SparkClosedLoopController.ArbFFUnits Enum Definition and Methods Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/sparkclosedloopcontroller Defines the ArbFFUnits enum with constants kPercentOut and kVoltage. Includes static methods to get all enum values, find an enum by its name, and convert an integer to its corresponding enum constant. ```java public static enum ArbFFUnits extends Enum { kPercentOut, kVoltage; public final int value; public static ArbFFUnits[] values() { return (ArbFFUnits[])$VALUES.clone(); } public static ArbFFUnits valueOf(String name) { return (ArbFFUnits)Enum.valueOf(com.revrobotics.spark.SparkClosedLoopController.ArbFFUnits.class, name); } public static ArbFFUnits fromInt(int value) { // Implementation not shown in provided text, but expected to map int to enum constant return null; } } ``` -------------------------------- ### CANServoHubJNI: Fault and Status Retrieval (Java) Source: https://codedocs.revrobotics.com/java/com/revrobotics/jni/canservohubjni This snippet provides methods for retrieving fault information and status details from the CAN servo hub. It includes functions to get general faults, sticky faults, warnings, and periodic status updates. The output includes integer codes for faults and warnings, and specific status objects for periodic data. ```java public class CANServoHubJNI extends RevJNIWrapper { // ... constructors and other methods ... /** * Gets the current faults of the servo hub. * @param handle A long handle representing the servo hub. * @return An integer representing the faults. */ static int c_ServoHub_GetFaults(long handle) { // JNI implementation return 0; } /** * Gets the sticky faults of the servo hub. * @param handle A long handle representing the servo hub. * @return An integer representing the sticky faults. */ static int c_ServoHub_GetStickyFaults(long handle) { // JNI implementation return 0; } /** * Gets the current warnings of the servo hub. * @param handle A long handle representing the servo hub. * @return An integer representing the warnings. */ static int c_ServoHub_GetWarnings(long handle) { // JNI implementation return 0; } /** * Gets the sticky warnings of the servo hub. * @param handle A long handle representing the servo hub. * @return An integer representing the sticky warnings. */ static int c_ServoHub_GetStickyWarnings(long handle) { // JNI implementation return 0; } /** * Clears all faults on the servo hub. * @param handle A long handle representing the servo hub. * @return An integer status code. */ static int c_ServoHub_ClearFaults(long handle) { // JNI implementation return 0; } /** * Retrieves periodic status 0 from the servo hub. * @param handle A long handle representing the servo hub. * @param status0 The object to populate with status 0 data. */ static void c_ServoHub_GetPeriodStatus0(long handle, ServoHubLowLevel.PeriodicStatus0 status0) { // JNI implementation } /** * Retrieves periodic status 1 from the servo hub. * @param handle A long handle representing the servo hub. * @param status1 The object to populate with status 1 data. */ static void c_ServoHub_GetPeriodStatus1(long handle, ServoHubLowLevel.PeriodicStatus1 status1) { // JNI implementation } /** * Retrieves periodic status 2 from the servo hub. * @param handle A long handle representing the servo hub. * @param status2 The object to populate with status 2 data. */ static void c_ServoHub_GetPeriodStatus2(long handle, ServoHubLowLevel.PeriodicStatus2 status2) { // JNI implementation } /** * Retrieves periodic status 3 from the servo hub. * @param handle A long handle representing the servo hub. * @param status3 The object to populate with status 3 data. */ static void c_ServoHub_GetPeriodStatus3(long handle, ServoHubLowLevel.PeriodicStatus3 status3) { // JNI implementation } /** * Retrieves periodic status 4 from the servo hub. * @param handle A long handle representing the servo hub. * @param status4 The object to populate with status 4 data. */ static void c_ServoHub_GetPeriodStatus4(long handle, ServoHubLowLevel.PeriodicStatus4 status4) { // JNI implementation } // ... other methods ... } ``` -------------------------------- ### Get Encoder Configuration Values in Java Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/encoderconfigaccessor Getter methods for retrieving various encoder configuration parameters including counts per revolution, conversion factors, inversion state, quadrature settings, and UVW measurement settings. These methods return configuration values that were previously set on the Spark motor controller. ```java public int getCountsPerRevolution() public boolean getInverted() public double getPositionConversionFactor() public double getVelocityConversionFactor() public int getQuadratureAverageDepth() public int getQuadratureMeasurementPeriod() public int getUvwAverageDepth() public int getUvwMeasurementPeriod() ``` -------------------------------- ### Retrieve Encoder Conversion Factors in Java Source: https://codedocs.revrobotics.com/java/com/revrobotics/sim/sparkflexexternalencodersim Get the position and velocity conversion factors for the simulated encoder. Both factors default to 1.0 and affect raw sensor value scaling. Useful for unit conversion in simulation scenarios. ```java public double getPositionConversionFactor() public double getVelocityConversionFactor() ``` -------------------------------- ### Get Feed-Forward Gain kG (Java) Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/feedforwardconfigaccessor Retrieves the gravity gain (kG) coefficient. This method can be called with or without a specific ClosedLoopSlot to get the default or slot-specific value. ```java public double getkG() public double getkG(ClosedLoopSlot slot) ``` -------------------------------- ### REVLibJNI Constructor Source: https://codedocs.revrobotics.com/java/com/revrobotics/jni/revlibjni Details the REVLibJNI constructor. ```APIDOC ## Constructor REVLibJNI ### Description Details the REVLibJNI constructor. ### Method Constructor ### Endpoint REVLibJNI() ### Parameters #### No parameters ### Request Example { "example": "N/A" } ### Response #### Success Response (N/A) - No response body. #### Response Example { "example": "N/A" } ``` -------------------------------- ### Get Feed-Forward Gain kA (Java) Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/feedforwardconfigaccessor Retrieves the acceleration gain (kA) coefficient. This method can be called with or without a specific ClosedLoopSlot to get the default or slot-specific value. ```java public double getkA() public double getkA(ClosedLoopSlot slot) ``` -------------------------------- ### SparkSim Constructor Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/sparksim Initializes a simulated CAN Spark Max or Flex device. It requires a SparkBase object to simulate and a DCMotor object for calculations. This class is essential for physics simulation and interaction with the sim GUI. ```java public SparkSim(SparkBase spark, DCMotor motor) ``` -------------------------------- ### Get Feed-Forward Gain kV (Java) Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/feedforwardconfigaccessor Retrieves the velocity gain (kV) coefficient. This method can be called with or without a specific ClosedLoopSlot to get the default or slot-specific value. ```java public double getkV() public double getkV(ClosedLoopSlot slot) ``` -------------------------------- ### Create MAXMotionConfig instance Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/maxmotionconfig Instantiates a new MAXMotionConfig object to begin configuring motion parameters. No inputs are required, and the method returns the newly created configuration object. This constructor is the entry point for building a configuration chain. ```Java public MAXMotionConfig() { // initialize configuration } ``` -------------------------------- ### CANServoHubJNI: Create and Configure Servo Hub (Java) Source: https://codedocs.revrobotics.com/java/com/revrobotics/jni/canservohubjni This snippet covers the creation and initial configuration of a CAN servo hub. It includes methods for creating a hub instance using a device ID and configuring its parameters via a flattened string. Dependencies include the RevJNIWrapper and ServoChannelConfig classes. ```java public class CANServoHubJNI extends RevJNIWrapper { // ... constructors and other methods ... /** * Creates a CAN servo hub instance. * @param deviceId The unique ID of the servo hub device. * @return A long handle representing the created servo hub. */ static long c_ServoHub_Create(int deviceId) { // JNI implementation return 0; } /** * Configures the servo hub with specified parameters. * @param handle A long handle representing the servo hub. * @param flattenedString A string containing the flattened configuration parameters. * @param resetSafeParameters If true, resets safe parameters. * @return An integer status code. */ static int c_ServoHub_Configure(long handle, String flattenedString, boolean resetSafeParameters) { // JNI implementation return 0; } /** * Asynchronously configures the servo hub. * @param handle A long handle representing the servo hub. * @param flattenedString A string containing the flattened configuration parameters. * @param resetSafeParameters If true, resets safe parameters. * @return An integer status code. */ static int c_ServoHub_ConfigureAsync(long handle, String flattenedString, boolean resetSafeParameters) { // JNI implementation return 0; } // ... other methods ... } ``` -------------------------------- ### Get Feed-Forward Gain kS (Java) Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/feedforwardconfigaccessor Retrieves the static gain (kS) coefficient. This method can be called with or without a specific ClosedLoopSlot to get the default or slot-specific value. ```java public double getkS() public double getkS(ClosedLoopSlot slot) ``` -------------------------------- ### SmartMotionConfig Source: https://codedocs.revrobotics.com/java/index-all Configuration options for Smart Motion, including minimum output velocity. ```APIDOC ## minOutputVelocity(double) ### Description Deprecated method for setting the minimum output velocity for Smart Motion. It is recommended to migrate to MAXMotion. ### Method `minOutputVelocity` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java // Example usage (deprecated) smartMotionConfig.minOutputVelocity(0.5); ``` ### Response #### Success Response (200) None #### Response Example None ## minOutputVelocity(double, ClosedLoopSlot) ### Description Deprecated method for setting the minimum output velocity for Smart Motion with a specific ClosedLoopSlot. It is recommended to migrate to MAXMotion. ### Method `minOutputVelocity` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java // Example usage (deprecated) smartMotionConfig.minOutputVelocity(0.5, closedLoopSlot1); ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Create ColorMatch object Source: https://codedocs.revrobotics.com/java/com/revrobotics/colormatch Instantiates a new ColorMatch object for color matching operations. No parameters are required for initialization. ```Java ColorMatch colorMatcher = new ColorMatch(); ``` -------------------------------- ### Get Feed-Forward Gain kCos (Java) Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/feedforwardconfigaccessor Retrieves the cosine term gain (kCos) coefficient. This method can be called with or without a specific ClosedLoopSlot to get the default or slot-specific value. ```java public double getkCos() public double getkCos(ClosedLoopSlot slot) ``` -------------------------------- ### Initialize SparkFlexExternalEncoderSim Simulation Object Source: https://codedocs.revrobotics.com/java/com/revrobotics/sim/sparkflexexternalencodersim Creates a Spark Flex external encoder simulation object. Requires a SparkFlex motor instance as a dependency. Enables interaction with simulated sensor data in the Sim GUI for testing and validation. ```java public SparkFlexExternalEncoderSim(SparkFlex motor) ``` -------------------------------- ### sg(double, double) - FeedForwardConfig Source: https://codedocs.revrobotics.com/java/index-all Sets the kS and kG gains for slot 0 in one call. ```APIDOC ## POST /feedforward/slot0/sg ### Description Sets the kS and kG gains for slot 0 in one call. ### Method POST ### Endpoint /feedforward/slot0/sg ### Parameters #### Path Parameters - **None** #### Query Parameters - **None** #### Request Body - **kS** (double) - Required - The kS gain value. - **kG** (double) - Required - The kG gain value. ### Request Example { "kS": 0.1, "kG": 0.05 } ### Response #### Success Response (200) - **None** #### Response Example { "status": "success" } ``` -------------------------------- ### SmartMotion Configuration Accessors Source: https://codedocs.revrobotics.com/java/index-all Methods for retrieving SmartMotion closed-loop error tolerance settings. ```APIDOC ## SmartMotionConfigAccessor Methods ### Description Accessors for SmartMotion PID motion control configuration. ### getAllowedClosedLoopError() ```java double getAllowedClosedLoopError() ``` Returns the allowed closed loop error. ### getAllowedClosedLoopError(ClosedLoopSlot) ```java double getAllowedClosedLoopError(ClosedLoopSlot slot) ``` Returns the allowed closed loop error for the specified slot. ### Parameters - **slot** (ClosedLoopSlot) - The closed loop slot to query ### Returns - **double** - The allowed error value in the configured unit of measurement ``` -------------------------------- ### SparkMax JNI: Inverted Motor Control Source: https://codedocs.revrobotics.com/java/com/revrobotics/jni/cansparkjni Methods to set and get the inverted state of the motor controller. ```Java public static int c_Spark_SetInverted(long handle, boolean inverted) public static boolean c_Spark_GetInverted(long handle) ``` -------------------------------- ### SparkBaseConfig Source: https://codedocs.revrobotics.com/java/index-all Base configuration for Spark controllers, including open loop ramp rates. ```APIDOC ## openLoopRampRate(double) ### Description Sets the ramp rate for open loop control modes. ### Method `openLoopRampRate` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java // Example usage sparkBaseConfig.openLoopRampRate(0.2); ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### SparkSim Applied Output Simulation Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/sparksim Simulates the applied output of a CAN Spark device. The `getAppliedOutput` method retrieves the simulated output, while `setAppliedOutput` allows manual setting, typically used in place of the `iterate` method. ```java public double getAppliedOutput() // Returns: applied output [-1, 1] public void setAppliedOutput(double appliedOutput) // Parameters: // `appliedOutput` - simulated applied output value [-1, 1] ``` -------------------------------- ### SparkMax JNI: PID Slot Selection Source: https://codedocs.revrobotics.com/java/com/revrobotics/jni/cansparkjni Method to get the currently selected PID slot on the SparkMax controller. ```Java public static int c_Spark_GetSelectedSlot(long handle) ``` -------------------------------- ### SparkBase.Warnings Source: https://codedocs.revrobotics.com/java/index-all Provides information about Spark controller warnings. ```APIDOC ## Variables in SparkBase.Warnings ### Description This class provides access to warning information for Spark controllers. ### Variables - **other** (boolean) - Indicates if other warnings are present. - **overcurrent** (boolean) - Indicates if an overcurrent warning is present. ``` -------------------------------- ### Servo Hub API Source: https://codedocs.revrobotics.com/java/index-all Methods for retrieving servo hub bank and channel information. ```APIDOC ## ServoHubSim.getBankPulsePeriod(ServoHub.Bank) ### Description Get the simulated bank pulse period. ### Method Signature ```java double getBankPulsePeriod(ServoHub.Bank bank) ``` ### Parameters - **bank** (ServoHub.Bank) - The servo bank to query ### Returns - **double** - The simulated bank pulse period ## ServoChannel.getChannelId() ### Description Returns the channel ID for this servo channel. ### Method Signature ```java int getChannelId() ``` ### Returns - **int** - The channel identifier ``` -------------------------------- ### Get SparkFlexExternalEncoder Velocity (Java) Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/sparkflexexternalencoder Retrieves the current velocity of the motor as reported by the external encoder. The velocity is measured in RPM by default, and can be scaled using conversion factors. ```java public double getVelocity() Description copied from interface: RelativeEncoder Get the velocity of the motor. This returns the native units of 'RPM' by default, and can be changed by a scale factor using AlternateEncoderConfig.velocityConversionFactor(double), or ExternalEncoderConfig.velocityConversionFactor(double), or EncoderConfig.velocityConversionFactor(double). Specified by: getVelocity in interface RelativeEncoder Returns: Number the RPM of the motor ``` -------------------------------- ### CANCommonJNI Constructor Source: https://codedocs.revrobotics.com/java/com/revrobotics/jni/cancommonjni Initializes a new instance of the CANCommonJNI class. This constructor does not require any parameters. ```java public CANCommonJNI() ``` -------------------------------- ### LimitSwitchConfig API Source: https://codedocs.revrobotics.com/java/index-all Configuration class and methods for setting up limit switches on REV Robotics Spark MAX controllers. ```APIDOC ## LimitSwitchConfig() ### Description Creates a new object to configure a LimitSwitch. ### Method Constructor ### Endpoint N/A (Class constructor) ### Response #### Success Response Returns a new LimitSwitchConfig instance. ## limitSwitchPositionSensor(FeedbackSensor) ### Description Specifies the feedback sensor that the triggered position value is set on. ### Method `limitSwitchPositionSensor` ### Endpoint N/A (Method in LimitSwitchConfig class) ### Parameters #### Request Body - **sensor** (FeedbackSensor) - Required - Feedback sensor for triggered position value ### Response #### Success Response Configures the feedback sensor associated with limit switch triggering. ``` -------------------------------- ### FeedForwardConfig sva Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/feedforwardconfig Sets the kS, kV, and kA gains for slot 0 in one call. kS is the static friction gain in Volts, kV is the velocity gain in Volts per velocity, and kA is the acceleration gain in Volts per velocity per second. ```APIDOC ## sva (slot 0) ### Description Set the kS, kV, and kA gains for slot 0 in one call. For more information on the kS, kV, and kA gains, see `kS(double)`, `kV(double)`, and `kA(double)`. ### Method `public FeedForwardConfig sva(double kS, double kV, double kA)` ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * None ### Request Example ```json { "example": "No request body" } ``` ### Response #### Success Response (200) * `FeedForwardConfig` (object) - The modified `FeedForwardConfig` object for method chaining. #### Response Example ```json { "example": "FeedForwardConfig object" } ``` ``` -------------------------------- ### Get SparkFlexExternalEncoder Position (Java) Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/sparkflexexternalencoder Retrieves the current position of the motor as reported by the external encoder. The position is measured in native units (rotations) by default, but can be scaled using conversion factors. ```java public double getPosition() Description copied from interface: RelativeEncoder Get the position of the motor. This returns the native units of 'rotations' by default, and can be changed by a scale factor using AlternateEncoderConfig.positionConversionFactor(double), or ExternalEncoderConfig.positionConversionFactor(double), or EncoderConfig.positionConversionFactor(double). Specified by: getPosition in interface RelativeEncoder Returns: Number of rotations of the motor ``` -------------------------------- ### setStickyFaults(SparkBase.Faults) - SparkSimFaultManager Source: https://codedocs.revrobotics.com/java/index-all Set the state of the simulated sticky faults of the device. ```APIDOC ## POST /api/sparksimfaultmanager/setstickyfaults ### Description Set the state of the simulated sticky faults of the device. ### Method POST ### Endpoint /api/sparksimfaultmanager/setstickyfaults ### Parameters #### Path Parameters - **None** #### Query Parameters - **None** #### Request Body - **SparkBase.Faults** (enum) - Required - The desired state of the sticky faults. ### Request Example { "Faults": "kOverTemperature" } ### Response #### Success Response (200) - **message** (string) - Confirmation message. ``` -------------------------------- ### Get Max Acceleration for Smart Motion in Java Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/smartmotionconfigaccessor Retrieves the maximum acceleration setting for Smart Motion. This method can fetch the default value or a value specific to a given ClosedLoopSlot. ```java public double getMaxAcceleration() public double getMaxAcceleration(ClosedLoopSlot slot) ``` -------------------------------- ### FeedForwardConfig svag Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/feedforwardconfig Sets the kS, kV, kA, and kG gains for slot 0 in one call. kS is the static friction gain in Volts, kV is the velocity gain in Volts per velocity, kA is the acceleration gain in Volts per velocity per second, and kG is the gravity gain in Volts. ```APIDOC ## svag (slot 0) ### Description Set the kS, kV, kA, and kG gains for slot 0 in one call. For more information on the kS, kV, kA, and kG gains, see `kS(double)`, `kV(double)`, `kA(double)`, and `kG(double)`. ### Method `public FeedForwardConfig svag(double kS, double kV, double kA, double kG)` ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * None ### Request Example ```json { "example": "No request body" } ``` ### Response #### Success Response (200) * `FeedForwardConfig` (object) - The modified `FeedForwardConfig` object for method chaining. #### Response Example ```json { "example": "FeedForwardConfig object" } ``` ``` -------------------------------- ### Get Max Velocity for Smart Motion in Java Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/smartmotionconfigaccessor Retrieves the maximum velocity setting for Smart Motion. This method can fetch the default value or a value specific to a given ClosedLoopSlot. ```java public double getMaxVelocity() public double getMaxVelocity(ClosedLoopSlot slot) ``` -------------------------------- ### sg(double, double, ClosedLoopSlot) - FeedForwardConfig Source: https://codedocs.revrobotics.com/java/index-all Sets the kS and kG gains for the provided slot in one call. ```APIDOC ## POST /feedforward/{slot}/sg ### Description Sets the kS and kG gains for the provided slot in one call. ### Method POST ### Endpoint /feedforward/{slot}/sg ### Parameters #### Path Parameters - **slot** (integer) - Required - The slot number. #### Query Parameters - **None** #### Request Body - **kS** (double) - Required - The kS gain value. - **kG** (double) - Required - The kG gain value. ### Request Example { "kS": 0.1, "kG": 0.05 } ### Response #### Success Response (200) - **None** #### Response Example { "status": "success" } ``` -------------------------------- ### Get Analog Sensor Position (Java) Source: https://codedocs.revrobotics.com/java/com/revrobotics/analoginput Retrieves the position of the analog sensor in its native unit ('volt' by default). The position value can be scaled using AnalogSensorConfig.positionConversionFactor(). ```java double getPosition() ``` -------------------------------- ### setWarnings(SparkBase.Warnings) - SparkSimFaultManager Source: https://codedocs.revrobotics.com/java/index-all Sets the state of simulated warnings of the device. ```APIDOC ## POST /spark/fault-manager/warnings ### Description Sets the state of the simulated warnings of the device. ### Method POST ### Endpoint /spark/fault-manager/warnings ### Parameters #### Path Parameters - **None** #### Query Parameters - **None** #### Request Body - **warnings** (SparkBase.Warnings) - Required - The warnings state to set. ### Request Example { "warnings": "SparkBase.Warnings.FAULT" } ### Response #### Success Response (200) - **None** #### Response Example { "status": "success" } ``` -------------------------------- ### Get Analog Sensor Voltage (Java) Source: https://codedocs.revrobotics.com/java/com/revrobotics/analoginput Retrieves the current voltage reading from an analog sensor. This method is part of the AnalogInput interface and returns a double representing the voltage. ```java double getVoltage() ``` -------------------------------- ### SparkMax JNI: Device Registration and Creation Source: https://codedocs.revrobotics.com/java/com/revrobotics/jni/cansparkjni Methods for registering a device ID and creating a SparkMax controller instance. These are fundamental for initializing communication with a motor controller. ```Java public CANSparkJNI() public static int c_Spark_RegisterId(int deviceId) public static long c_Spark_Create(int deviceId, int motortype, int sparkModel) ``` -------------------------------- ### Get Min Output Velocity for Smart Motion in Java Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/smartmotionconfigaccessor Retrieves the minimum output velocity setting for Smart Motion. This method can fetch the default value or a value specific to a given ClosedLoopSlot. ```java public double getMinOutputVelocity() public double getMinOutputVelocity(ClosedLoopSlot slot) ``` -------------------------------- ### MovingAverageFilterSim Class Source: https://codedocs.revrobotics.com/java/com/revrobotics/sim/movingaveragefiltersim Simulates a moving average filter for robotics simulations. The constructor initializes the filter with a specified number of taps and sample rate. Methods allow adding measurements with time deltas and retrieving the current filtered value. ```APIDOC ## MovingAverageFilterSim ### Description Simulate a moving average filter where samples are normally at some fixed rate that is different than the rate provided by the simulation. A sum of sample deltas is stored until the cumulative sample delta is greater than or equal to the sample rate. Two cases are possible: 1) The cumulative delta between samples is greater or equal to the sample rate. In this case, take a simple linear interpolation between the sample before and after the sample time, and add this new sample to the moving average. 2) The cumulative delta between the samples is less than the sample rate. In this case, store the last value, and accumulate the delta time. ### Constructor MovingAverageFilterSim(int taps, double sampleRate) ### Parameters #### Constructor Parameters - **taps** (int) - Required - Number of samples in moving average filter - **sampleRate** (double) - Required - Sample rate of moving average filter to simulate ### Methods #### put public void put(double value, double delta) Put a new measurement into the moving average filter. This will add any number of samples (or none) depending on the time delta provided. ##### Parameters - **value** (double) - Required - New measurement value - **delta** (double) - Required - Time delta between last measurement value #### get public double get() Get the current value of the filter. ##### Returns - **filtered value** (double) - The current filtered value ### Example Usage ```java MovingAverageFilterSim filter = new MovingAverageFilterSim(10, 100.0); filter.put(5.0, 0.01); double currentValue = filter.get(); ``` ``` -------------------------------- ### FeedForwardConfig sg Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/feedforwardconfig Sets the kS and kG gains for slot 0 in one call. kS is the static friction gain in Volts, and kG is the gravity gain in Volts. ```APIDOC ## sg (slot 0) ### Description Set the kS and kG gains for slot 0 in one call. For more information on the kS and kG gains, see `kS(double)` and `kG(double)`. ### Method `public FeedForwardConfig sg(double kS, double kG)` ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * None ### Request Example ```json { "example": "No request body" } ``` ### Response #### Success Response (200) * `FeedForwardConfig` (object) - The modified `FeedForwardConfig` object for method chaining. #### Response Example ```json { "example": "FeedForwardConfig object" } ``` ``` -------------------------------- ### Get Allowed Closed Loop Error for Smart Motion in Java Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/smartmotionconfigaccessor Retrieves the allowed closed-loop error setting for Smart Motion. This method can fetch the default value or a value specific to a given ClosedLoopSlot. ```java public double getAllowedClosedLoopError() public double getAllowedClosedLoopError(ClosedLoopSlot slot) ``` -------------------------------- ### MAXMotionConfigAccessor Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/maxmotionconfigaccessor This section details the methods available within the MAXMotionConfigAccessor class for retrieving motion configuration parameters. ```APIDOC ## MAXMotionConfigAccessor ### Description Provides access to motion configuration parameters for REV Robotics devices. ### Constructor #### `MAXMotionConfigAccessor(long sparkHandle)` - **sparkHandle** (long) - Required - The handle to the Spark controller. ### Methods #### `getCruiseVelocity()` - **Description**: Gets the current cruise velocity. - **Returns**: (double) The cruise velocity. #### `getCruiseVelocity(ClosedLoopSlot slot)` - **Description**: Gets the current cruise velocity for a specified closed loop slot. - **Parameters**: - **slot** (ClosedLoopSlot) - Required - The closed loop slot. - **Returns**: (double) The cruise velocity for the specified slot. #### `getMaxAcceleration()` - **Description**: Gets the maximum acceleration. - **Returns**: (double) The maximum acceleration. #### `getMaxAcceleration(ClosedLoopSlot slot)` - **Description**: Gets the maximum acceleration for a specified closed loop slot. - **Parameters**: - **slot** (ClosedLoopSlot) - Required - The closed loop slot. - **Returns**: (double) The maximum acceleration for the specified slot. #### `getAllowedProfileError()` - **Description**: Gets the allowed profile error. - **Returns**: (double) The allowed profile error. #### `getAllowedProfileError(ClosedLoopSlot slot)` - **Description**: Gets the allowed profile error for a specified closed loop slot. - **Parameters**: - **slot** (ClosedLoopSlot) - Required - The closed loop slot. - **Returns**: (double) The allowed profile error for the specified slot. #### `getPositionMode()` - **Description**: Gets the current position mode. - **Returns**: (MAXMotionConfig.MAXMotionPositionMode) The current position mode. #### `getPositionMode(ClosedLoopSlot slot)` - **Description**: Gets the position mode for a specified closed loop slot. - **Parameters**: - **slot** (ClosedLoopSlot) - Required - The closed loop slot. - **Returns**: (MAXMotionConfig.MAXMotionPositionMode) The position mode for the specified slot. #### `getMaxVelocity()` - **Deprecated**: Use `getCruiseVelocity()` instead. - **Description**: Gets the maximum velocity. - **Returns**: (double) The maximum velocity. #### `getMaxVelocity(ClosedLoopSlot slot)` - **Deprecated**: Use `getCruiseVelocity(ClosedLoopSlot slot)` instead. - **Description**: Gets the maximum velocity for a specified closed loop slot. - **Parameters**: - **slot** (ClosedLoopSlot) - Required - The closed loop slot. - **Returns**: (double) The maximum velocity for the specified slot. #### `getAllowedClosedLoopError()` - **Deprecated**: Use `getAllowedProfileError()` instead. - **Description**: Gets the allowed closed loop error. - **Returns**: (double) The allowed closed loop error. #### `getAllowedClosedLoopError(ClosedLoopSlot slot)` - **Deprecated**: Use `getAllowedProfileError(ClosedLoopSlot slot)` instead. - **Description**: Gets the allowed closed loop error for a specified closed loop slot. - **Parameters**: - **slot** (ClosedLoopSlot) - Required - The closed loop slot. - **Returns**: (double) The allowed closed loop error for the specified slot. ``` -------------------------------- ### Signal Configuration Accessors Source: https://codedocs.revrobotics.com/java/index-all Configuration methods for signal update rates and always-on settings for various sensor signals. ```APIDOC ## SignalsConfigAccessor Methods ### Description Accessors for configuring signal reporting rates and always-on behavior. ### getAbsoluteEncoderPositionAlwaysOn() ```java boolean getAbsoluteEncoderPositionAlwaysOn() ``` Returns whether absolute encoder position is always on. ### getAbsoluteEncoderPositionPeriodMs() ```java int getAbsoluteEncoderPositionPeriodMs() ``` Returns the update period (ms) for absolute encoder position. ### getAbsoluteEncoderVelocityAlwaysOn() ```java boolean getAbsoluteEncoderVelocityAlwaysOn() ``` Returns whether absolute encoder velocity is always on. ### getAbsoluteEncoderVelocityPeriodMs() ```java int getAbsoluteEncoderVelocityPeriodMs() ``` Returns the update period (ms) for absolute encoder velocity. ### getAnalogPositionAlwaysOn() ```java boolean getAnalogPositionAlwaysOn() ``` Returns whether analog position is always on. ### getAnalogPositionPeriodMs() ```java int getAnalogPositionPeriodMs() ``` Returns the update period (ms) for analog position. ### getAnalogVelocityAlwaysOn() ```java boolean getAnalogVelocityAlwaysOn() ``` Returns whether analog velocity is always on. ### getAnalogVelocityPeriodMs() ```java int getAnalogVelocityPeriodMs() ``` Returns the update period (ms) for analog velocity. ### getAnalogVoltageAlwaysOn() ```java boolean getAnalogVoltageAlwaysOn() ``` Returns whether analog voltage is always on. ### getAnalogVoltagePeriodMs() ```java int getAnalogVoltagePeriodMs() ``` Returns the update period (ms) for analog voltage. ### getAppliedOutputAlwaysOn() ```java boolean getAppliedOutputAlwaysOn() ``` Returns whether applied output is always on. ### getAppliedOutputPeriodMs() ```java int getAppliedOutputPeriodMs() ``` Returns the update period (ms) for applied output. ### getBusVoltageAlwaysOn() ```java boolean getBusVoltageAlwaysOn() ``` Returns whether bus voltage is always on. ### getBusVoltagePeriodMs() ```java int getBusVoltagePeriodMs() ``` Returns the update period (ms) for bus voltage. ``` -------------------------------- ### Get PIDF Gains - Specific Slot Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/closedloopconfigaccessor Retrieves the Proportional (P), Integral (I), Derivative (D), and Feed-Forward (FF) gains for a specified closed-loop slot. This allows for fine-grained control and different tuning profiles. ```java public double getP(ClosedLoopSlot slot) {} public double getI(ClosedLoopSlot slot) {} public double getD(ClosedLoopSlot slot) {} @Deprecated(forRemoval=true) public double getFF(ClosedLoopSlot slot) {} ``` -------------------------------- ### Get PIDF Gains - Default Slot Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/closedloopconfigaccessor Retrieves the Proportional (P), Integral (I), Derivative (D), and Feed-Forward (FF) gains for the default closed-loop slot. These values are fundamental for tuning motor controller behavior. ```java public double getP() {} public double getI() {} public double getD() {} @Deprecated(forRemoval=true) public double getFF() {} ``` -------------------------------- ### FeedForwardConfig scr Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/feedforwardconfig Sets the kS, kCos, and kCosRatio gains for slot 0 in one call. Includes static friction, cosine gravity, and cosine ratio gains. ```APIDOC ## scr (slot 0) ### Description Set the kS, kCos, and kCosRatio gains for slot 0 in one call. For more information on the kS, kCos, and kCosRatio gains, see `kS(double)`, `kCos(double)`, and `kCosRatio(double)`. ### Method `public FeedForwardConfig scr(double kS, double kCos, double kCosRatio)` ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * None ### Request Example ```json { "example": "No request body" } ``` ### Response #### Success Response (200) * `FeedForwardConfig` (object) - The modified `FeedForwardConfig` object for method chaining. #### Response Example ```json { "example": "FeedForwardConfig object" } ``` ``` -------------------------------- ### Get Motor Encoder Velocity - Java Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/sparkrelativeencoder Retrieves the current velocity of the motor encoder, typically in Revolutions Per Minute (RPM). The default unit is RPM, but it can be adjusted using velocity conversion factors specified in encoder configuration settings. ```java public double getVelocity() { // Description copied from interface: RelativeEncoder // Get the velocity of the motor. This returns the native units of 'RPM' by default, and can be changed by a scale factor using AlternateEncoderConfig.velocityConversionFactor(double), or ExternalEncoderConfig.velocityConversionFactor(double), or EncoderConfig.velocityConversionFactor(double). // Specified by: // getVelocity in interface RelativeEncoder // Returns: // Number the RPM of the motor } ``` -------------------------------- ### SmartMotionConfigAccessor Constructor in Java Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/smartmotionconfigaccessor The protected constructor for SmartMotionConfigAccessor initializes the object using a long sparkHandle. This constructor is intended for internal use within the framework. ```java protected SmartMotionConfigAccessor(long sparkHandle) ``` -------------------------------- ### Get Motor Encoder Position - Java Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/sparkrelativeencoder Retrieves the current position of the motor encoder. The position is measured in native units of 'rotations' by default. This value can be scaled using position conversion factors defined in various encoder configuration classes. ```java public double getPosition() { // Description copied from interface: RelativeEncoder // Get the position of the motor. This returns the native units of 'rotations' by default, and can be changed by a scale factor using AlternateEncoderConfig.positionConversionFactor(double), or ExternalEncoderConfig.positionConversionFactor(double), or EncoderConfig.positionConversionFactor(double). // Specified by: // getPosition in interface RelativeEncoder // Returns: // Number of rotations of the motor } ``` -------------------------------- ### Encoder Average Depth Configuration Source: https://codedocs.revrobotics.com/java/index-all Methods for retrieving average depth settings for absolute and external encoders. ```APIDOC ## AbsoluteEncoderConfigAccessor.getAverageDepth() ### Description Returns the average depth setting for the absolute encoder. ### Method Signature ```java int getAverageDepth() ``` ### Returns - **int** - The average depth value ## ExternalEncoderConfigAccessor.getAverageDepth() ### Description Returns the average depth setting for the external encoder. ### Method Signature ```java int getAverageDepth() ``` ### Returns - **int** - The average depth value ``` -------------------------------- ### Get Other Closed-Loop Settings Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/closedloopconfigaccessor Retrieves other closed-loop configuration parameters such as the allowed closed-loop error, position wrapping status, and feedback sensor type. These provide insights into the current state and configuration of the feedback system. ```java public double getAllowedClosedLoopError(ClosedLoopSlot slot) {} public boolean getPositionWrappingEnabled() {} public double getPositionWrappingMinInput() {} public double getPositionWrappingMaxInput() {} public FeedbackSensor getFeedbackSensor() ``` -------------------------------- ### c_REVLib_ErrorFromCode Source: https://codedocs.revrobotics.com/java/com/revrobotics/jni/revlibjni Details the c_REVLib_ErrorFromCode method. ```APIDOC ## c_REVLib_ErrorFromCode ### Description Details the c_REVLib_ErrorFromCode method. ### Method static String ### Endpoint c_REVLib_ErrorFromCode(int errorCode) ### Parameters #### Path Parameters - No path parameters. #### Query Parameters - No query parameters. #### Request Body - `errorCode` (int) - Required - The error code to convert. ### Request Example { "errorCode": 123 } ### Response #### Success Response (200) - Returns a String representation of the error. ``` -------------------------------- ### Get Advanced Closed-Loop Parameters - Default Slot Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/closedloopconfigaccessor Retrieves advanced closed-loop parameters including D-filter, I-zone, output limits, and maximum I-accumulation for the default slot. These parameters offer further customization of the control loop. ```java public double getDFilter() {} public double getIZone() {} public double getMinOutput() {} public double getMaxOutput() {} public double getMaxIAccumulation() ``` -------------------------------- ### MAXMotion Configuration Accessors Source: https://codedocs.revrobotics.com/java/index-all Methods for retrieving MAXMotion closed-loop error tolerance settings for profiled motion control. ```APIDOC ## MAXMotionConfigAccessor Methods ### Description Accessors for MAXMotion profiled motion control configuration. ### getAllowedClosedLoopError() **Deprecated**: Use `getAllowedProfileError()` instead. ```java double getAllowedClosedLoopError() ``` Returns the allowed closed loop error. ### getAllowedClosedLoopError(ClosedLoopSlot) **Deprecated**: Use `getAllowedProfileError(ClosedLoopSlot)` instead. ```java double getAllowedClosedLoopError(ClosedLoopSlot slot) ``` Returns the allowed closed loop error for the specified slot. ### getAllowedProfileError() ```java double getAllowedProfileError() ``` Returns the allowed profile error. ### getAllowedProfileError(ClosedLoopSlot) ```java double getAllowedProfileError(ClosedLoopSlot slot) ``` Returns the allowed profile error for the specified slot. ### Parameters - **slot** (ClosedLoopSlot) - The closed loop slot to query ### Returns - **double** - The allowed error value in the configured unit of measurement ``` -------------------------------- ### SparkBase Core Status Methods Source: https://codedocs.revrobotics.com/java/index-all Methods for retrieving fundamental motor controller status including set speed, applied output, and bus voltage. ```APIDOC ## SparkBase.get() ### Description Common interface for getting the current set speed of a speed controller. ### Method Signature ```java double get() ``` ### Returns - **double** - The current set speed of the motor controller ## SparkBase.getAppliedOutput() ### Description Returns the current applied output of the motor controller. ### Simulation Note This value will not be updated during simulation unless `SparkSim.iterate(double, double, double)` is called. ### Method Signature ```java double getAppliedOutput() ``` ### Returns - **double** - The applied output value ## SparkBase.getBusVoltage() ### Description Returns the current bus voltage of the motor controller. ### Method Signature ```java double getBusVoltage() ``` ### Returns - **double** - The bus voltage ``` -------------------------------- ### Get Advanced Closed-Loop Parameters - Specific Slot Source: https://codedocs.revrobotics.com/java/com/revrobotics/spark/config/closedloopconfigaccessor Retrieves advanced closed-loop parameters including D-filter, I-zone, output limits, and maximum I-accumulation for a specified slot. This enables tailored configurations for different operational modes. ```java public double getDFilter(ClosedLoopSlot slot) {} public double getIZone(ClosedLoopSlot slot) {} public double getMinOutput(ClosedLoopSlot slot) {} public double getMaxOutput(ClosedLoopSlot slot) {} public double getMaxIAccumulation(ClosedLoopSlot slot) ```