Package org.team1126.lib.util.vendors
Class RevUtil
java.lang.Object
org.team1126.lib.util.vendors.RevUtil
Utilities for REVLib.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanconfig(com.revrobotics.spark.SparkFlex spark, com.revrobotics.spark.config.SparkBaseConfig config) Shorthand for configuring a Spark motor controller with error checking.static booleanconfig(com.revrobotics.spark.SparkMax spark, com.revrobotics.spark.config.SparkBaseConfig config) Shorthand for configuring a Spark motor controller with error checking.static booleanconfigEphemeral(com.revrobotics.spark.SparkFlex spark, com.revrobotics.spark.config.SparkBaseConfig config) Shorthand for configuring a Spark motor controller ephemerally with error checking.static booleanconfigEphemeral(com.revrobotics.spark.SparkMax spark, com.revrobotics.spark.config.SparkBaseConfig config) Shorthand for configuring a Spark motor controller ephemerally with error checking.static booleanconfigNoReset(com.revrobotics.spark.SparkFlex spark, com.revrobotics.spark.config.SparkBaseConfig config) Shorthand for configuring a Spark motor controller with error checking.static booleanconfigNoReset(com.revrobotics.spark.SparkMax spark, com.revrobotics.spark.config.SparkBaseConfig config) Shorthand for configuring a Spark motor controller with error checking.static booleanrun(String name, com.revrobotics.spark.SparkLowLevel device, Supplier<com.revrobotics.REVLibError> target) Runs a REVLib API call and checks for errors.static booleanrun(String name, com.revrobotics.spark.SparkLowLevel device, Supplier<com.revrobotics.REVLibError> target, int maxTries) Runs a REVLib API call and checks for errors.
-
Method Details
-
config
public static boolean config(com.revrobotics.spark.SparkMax spark, com.revrobotics.spark.config.SparkBaseConfig config) Shorthand for configuring a Spark motor controller with error checking. UsesResetMode.kResetSafeParametersandPersistMode.kPersistParameters.- Parameters:
spark- The Spark to configure.config- The configuration to apply.- Returns:
trueif success (REVLibError.kOk),falseotherwise.
-
config
public static boolean config(com.revrobotics.spark.SparkFlex spark, com.revrobotics.spark.config.SparkBaseConfig config) Shorthand for configuring a Spark motor controller with error checking. UsesResetMode.kResetSafeParametersandPersistMode.kPersistParameters.- Parameters:
spark- The Spark to configure.config- The configuration to apply.- Returns:
trueif success (REVLibError.kOk),falseotherwise.
-
configNoReset
public static boolean configNoReset(com.revrobotics.spark.SparkMax spark, com.revrobotics.spark.config.SparkBaseConfig config) Shorthand for configuring a Spark motor controller with error checking. UsesResetMode.kNoResetSafeParametersandPersistMode.kPersistParameters.- Parameters:
spark- The Spark to configure.config- The configuration to apply.- Returns:
trueif success (REVLibError.kOk),falseotherwise.
-
configNoReset
public static boolean configNoReset(com.revrobotics.spark.SparkFlex spark, com.revrobotics.spark.config.SparkBaseConfig config) Shorthand for configuring a Spark motor controller with error checking. UsesResetMode.kNoResetSafeParametersandPersistMode.kPersistParameters.- Parameters:
spark- The Spark to configure.config- The configuration to apply.- Returns:
trueif success (REVLibError.kOk),falseotherwise.
-
configEphemeral
public static boolean configEphemeral(com.revrobotics.spark.SparkMax spark, com.revrobotics.spark.config.SparkBaseConfig config) Shorthand for configuring a Spark motor controller ephemerally with error checking. UsesResetMode.kNoResetSafeParametersandPersistMode.kNoPersistParameters.- Parameters:
spark- The Spark to configure.config- The configuration to apply.- Returns:
trueif success (REVLibError.kOk),falseotherwise.
-
configEphemeral
public static boolean configEphemeral(com.revrobotics.spark.SparkFlex spark, com.revrobotics.spark.config.SparkBaseConfig config) Shorthand for configuring a Spark motor controller ephemerally with error checking. UsesResetMode.kNoResetSafeParametersandPersistMode.kNoPersistParameters.- Parameters:
spark- The Spark to configure.config- The configuration to apply.- Returns:
trueif success (REVLibError.kOk),falseotherwise.
-
run
public static boolean run(String name, com.revrobotics.spark.SparkLowLevel device, Supplier<com.revrobotics.REVLibError> target) Runs a REVLib API call and checks for errors. Will try up to 3 times if the target API call fails.- Parameters:
name- The name of the API call.device- The device the call is relevant to.target- The target call to run.- Returns:
trueif success (REVLibError.kOk),falseotherwise.
-
run
public static boolean run(String name, com.revrobotics.spark.SparkLowLevel device, Supplier<com.revrobotics.REVLibError> target, int maxTries) Runs a REVLib API call and checks for errors.- Parameters:
name- The name of the API call.device- The device the call is relevant to.target- The target call to run.maxTries- The number of times to try the call before failing.1only runs the call once.- Returns:
trueif success (REVLibError.kOk),falseotherwise.
-