yaq/traits/has-limits


The has-limits trait extends the has-positions trait with limits. It's assumed that any position within the limits is valid.

requires

has-position

configuration

Daemons with the has-limits trait expect the following configuration:

limits ([number, number]) default: [-inf, +inf]
Configuration limits are strictly optional.

out_of_limits (string) default: closest
Control behavior of daemon when set_position is given a value outside of limits.

state

Daemons with the has-limits trait will provide the following state information:

hw_limits ([number, number])

position (number)
from has-position

destination (number)
from has-position

methods

Daemons with the has-limits trait expose the following public methods:

get_limits ➜ [number, number]
Get daemon limits. Limits will be the intersection of config limits and driver limits (when appliciable).

in_limits ➜ boolean
Check if a given position is within daemon limits.
Arguments:

position, {'type': 'number'}

get_destination ➜ number
Get current daemon destination.
from has-position

get_units ➜ string
Get units of daemon. These units apply to the position and destination fields.
from has-position

get_position ➜ number
Get current daemon position.
from has-position

set_position
Give the daemon a new destination, and begin motion towards that destination.
from has-position
Arguments:

position, {'type': 'number'}

set_relative ➜ number
Give the daemon a new destination relative to its current position. Daemon will immediately begin motion towards new destination. Returns new destination.
from has-position
Arguments:

distance, {'type': 'number'}

daemons

The following daemons implement the has-limits trait:

adafruit-stepper-motor-hat
continuous-hardware
micro-hr
ne1000