HoldableActuator

Controls a generic encoder motor that can be controlled through various means and commanded to hold a position.

Author

Lucas Bubner, 2024

Since

1.0.0-pre

Constructors

Link copied to clipboard
constructor(@Nullable motor: DcMotor)
Create a new HoldableActuator.

Types

Link copied to clipboard
open inner class Tasks
Tasks for HoldableActuator, access with tasks.

Properties

Link copied to clipboard
Tasks for HoldableActuator.

Inherited properties

Link copied to clipboard
open var currentTask: Task
Link copied to clipboard
protected open var name: String
Reference to the unmodified name of this subsystem.
Link copied to clipboard
Get a reference to the currently running BunyipsOpMode.

Functions

Link copied to clipboard
Disable the timeout for the Home Task.
Link copied to clipboard
Disable the zero hit threshold for the Home Task.
Link copied to clipboard
Disable the max steady state timer.
Link copied to clipboard
Disable the overcurrent threshold for stall detection.
Link copied to clipboard
Calling this method will restore the user input functionality translating into direct power on the motor.
Link copied to clipboard
open fun getMappedPosition(@Nullable switchSensor: TouchSensor): Integer
Get the mapped position of a limit switch.
Link copied to clipboard
open fun map(@Nullable switchSensor: TouchSensor, position: Int): HoldableActuator
Map a limit switch to a position on the actuator, which will update the current encoder reading to the position of the switch when pressed.
Link copied to clipboard
protected open fun onDisable()
User callback that runs once when this subsystem is disabled by a call to disable or by an assertion failure.
Link copied to clipboard
protected open fun periodic()
To be updated periodically on every hardware loop.
Link copied to clipboard
Instantaneously set the user input power for the actuator.
Link copied to clipboard
Set the auto response power magnitude of the actuator, where a positive value will bring the arm upwards (away from bottom).
Link copied to clipboard
open fun withBottomSwitch(@Nullable bottomLimitSwitch: TouchSensor): HoldableActuator
Set the bottom limit switch of the actuator to use in homing and encoder awareness.
Link copied to clipboard
open fun withEncoderLimits(minLimit: Long, maxLimit: Long): HoldableActuator
Set the encoder limits of the actuator.
Link copied to clipboard
Set the homing power magnitude of the actuator, where a positive value will bring the arm upwards (away from bottom).
Link copied to clipboard
Set the timeout for the Home Task.
Link copied to clipboard
Set the zero hit threshold to how many greater than or equal to zero velocity hits are required for the Home Task.
Link copied to clipboard
Set the lower limit of the actuator.
Link copied to clipboard
Set the lower power clamp of the actuator.
Link copied to clipboard
Defines a max amount of time that the system can be responding for.
Link copied to clipboard
Set the overcurrent threshold used for stall detection.
Link copied to clipboard
open fun withPowerClamps(lowerPower: Double, upperPower: Double): HoldableActuator
Set the lower and upper power clamps of the actuator.
Link copied to clipboard
open fun withTolerance(tolerance: Int, applyToMotor: Boolean): HoldableActuator
Set the target tolerance of the actuator.
Link copied to clipboard
open fun withTopSwitch(@Nullable topLimitSwitch: TouchSensor): HoldableActuator
Set the top limit switch of the actuator to use in encoder awareness.
Link copied to clipboard
Set the upper limit of the actuator.
Link copied to clipboard
Set the upper power clamp of the actuator.
Link copied to clipboard
Calling this method will enable the user input mode to instead adjust the setpoint dynamically, rather than unlocking the setpoint then relocking it when the mode transitions to holding.

Inherited functions

Link copied to clipboard
protected fun assertParamsNotNull(@NonNull parameters: Array<Any>): Boolean
Utility function to run NullSafety.assertComponentArgs() on the given parameters, usually on the motors/hardware/critical objects passed into the constructor.
Link copied to clipboard
Cancel the current task immediately and return to the default task, if available.
Link copied to clipboard
infix fun BunyipsSubsystem.default(defaultTask: Task)

Default task setter extension for BunyipsSubsystem to set the default task of a subsystem.

Link copied to clipboard
protected fun delegate(@NonNull child: BunyipsSubsystem)
Call to delegate the update of this subsystem, usually a component of another subsystem, to this subsystem.
Link copied to clipboard
fun disable()
Prevent a subsystem from running.
Link copied to clipboard
fun enable()
Re-enable a subsystem if it was previously disabled via a disable() call.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Determine if the subsystem is idle, meaning an IdleTask is running.
Link copied to clipboard
protected open fun onEnable()
User callback that runs once when this subsystem is enabled by a call to enable or the first active call to periodic.
Link copied to clipboard
protected fun opMode(@NonNull ifRunning: Consumer<BunyipsOpMode>)
Null check consumer for the opMode field which will no-op the given consumer if an active BunyipsOpMode is not present (i.e.
Link copied to clipboard
protected fun require(@Nullable nullableOpMode: BunyipsOpMode): BunyipsOpMode
Null assertion for the opMode field which throws a NullPointerException if an active BunyipsOpMode is not present (i.e.
Link copied to clipboard
open fun resetForOpMode()
Reset stored static instances of BunyipsSubsystem.
Link copied to clipboard
fun setDefaultTask(@NonNull defaultTask: Task)
Set the default task for this subsystem, which will be run when no other task is running.
Link copied to clipboard
Set the current task to the given task, overriding any current task.
Link copied to clipboard
fun startThread(@NonNull loopSleepDuration: Measure<Time>)
Call to delegate all updates of this subsystem to a thread that will begin execution on this method call.
Link copied to clipboard
Call to stop delegating updates of this subsystem to a thread.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun update()
Update the subsystem and run the current task, if tasks are not set up this will just call periodic.
Link copied to clipboard
open fun updateAll()
Update all instances of BunyipsSubsystem that has been constructed since the last clearing.
Link copied to clipboard
fun <T : BunyipsSubsystem?> withName(@NonNull subsystemName: String): T
Set the name of this subsystem that will be used in telemetry and references.