joystick component
This component exports any connected joystick state.
Additionnaly, it can filter a state reference for controllers by either publishing it as-is (no-op filter) or by overwriting it with a user command, for instance to act as an emergency mode component.
Ports
device (multiple out)
Data structure
|
Represents the current buttons and axes state of connected devices.
desired (out)
Data structure
|
Reference velocity computed according to user input.
The published reference contains vel
, acc
, avel
and aacc
members. intrinsic
flag is set according to current coordinates
mode (see set_intrinsic_mode (attribute)).
The mapping from user input to velocity is defined by a set of mappings (see set_mappings (attribute)) and parameters (see set_state_params (attribute).
reference (in)
Data structure
|
Reference state published in inactive mode.
In inactive mode, this reference is read and published as is in the desired (out) port. See set_mappings (attribute) for inactive mode activation.
Services
device_list (function)
Outputs
|
Throws
|
Return the list of available devices
rename (activity)
Inputs
|
Throws
|
Context
|
Rename an existing device
set_state_params (attribute)
Inputs
|
State integration parameters for desired (out) velocity.
User input is mapped (see set_mappings (attribute)) to a desired acceleration
a
ranging from -amax
to +amax
and angular acceleration aw
ranging from -awmax
to +awmax
. In slow motion mode, the range
is divided by the slow
factor. The drag
parameter is a linear
friction coefficient acting on the current velocity.
The resulting acceleration is integrated into the published desired velocity by using the following differential equations:
-
∂v/∂t = a - drag . v
-
∂w/∂t = aw - drag . w
get_mappings (attribute)
Outputs
|
Get mapping between axes and x, y, z
motion.
set_mappings (attribute)
Inputs
|
Define mapping between axes and x, y, z
motion.
User input on the defined axes is mapped to the corresponding
x, y, z
coordinates. If an axis is specified as -1
, the
motion on that coordinate is disabled. User input ranges from
-1.0
to 1.0
and is further scaled according to the offset
and
scale
parameters to produce the final command like so:
command = scale . (input + offset)
For instance, to invert an axis, specify scale as -1.0
. Some axes
have a default position of -1
. To map it to [0;1]
, use an
offset
equal to 1.0
and a scale
equal to 0.5
.
Motion can be set to be active only when a button is pressed by
defining an enable.on
button number. In a similar manner, a
enable.slow
button can enable a slowed down motion
(see set_state_params (attribute) slow
parameter). Pressing both
enable.on
and enable.slow
buttons activate an intermediate
dynamics mode using half of the slow
parameter. Finally, a
enable.toggle
defines a button to permanently switch between active
or deactivated mode. If none of those three buttons is defined, the
mode is always active
.
coords.intrinsic
and coords.world
may define a button number
selecting one of the corresponding mode (see set_intrinsic_mode (attribute)).
Alternatively a coords.toggle
button can be used to switch between
those two modes.
set_intrinsic_mode (attribute)
Inputs
|
Select frame of the published desired (out) velocity.
With intrinsic
set to true
, the velocity is published relative
to the robot frame. With false
, global coordinates are used.
This flag requires that the readers of the output port actually use the intrinsic flags of the published velocity.
log (activity)
Inputs
|
Throws
|
Context
|
Log published state
Tasks
publish
Context
|
Throws
|