yaq/traits/has-position


Daemons with this trait have one specific value that describes their current position. This position can be set (using the set_position method). In general, these daemons may not be able to reach exactly the set position. The destination (get_destination) returns exactly the set position, while the position (get_position) returns the current actual position of the daemon. These daemons should start motion and become busy when set_daemon is called. They should release busy once they arrive as close as possible to the destination, and their position should not change until set_position is called again.

state

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

position (number)

destination (number)

methods

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

get_destination ➜ number
Get current daemon destination.

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

get_position ➜ number
Get current daemon position.

set_position
Give the daemon a new destination, and begin motion towards that destination.
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.
Arguments:

distance, {'type': 'number'}

daemons

The following daemons implement the has-position trait:

adafruit-stepper-motor-hat (from has-limits)
continuous-hardware (from has-limits)
hardware
micro-hr (from is-homeable)
ne1000 (from has-limits)
wright-wl-motor (from is-homeable)