cras_joy_tools package¶
cras_joy_tools.history_joystick module¶
Stateful gamepad/joystick library. It allows querying for button state changes, button combos etc.
Originally implemented in nifti_teleop_joy.
-
class
cras_joy_tools.history_joystick.HistoryJoystick(*args, **kwds)¶ Bases:
sensor_msgs.msg._Joy.JoyClass to allow detecting transition in buttons and axes.
It can be used like a Joy message but with additional methods.
-
axis_moved(axis_id)¶ Check if a given axis has moved.
-
axis_released(axis_id)¶ Check if a given axis has just been released has (transition anything else->0).
-
axis_touched(axis_id)¶ Check if a given axis that was released has moved (transition 0->anything else).
Check if a given button state has just changed (either transitions).
Check if any of given buttons state has just changed (either transitions).
-
is_down(button_id)¶ Check if a given button is currently pressed down (state 1).
-
is_down_all(button_ids)¶ Check if all of given button are currently pressed down (state 1).
-
is_down_any(button_ids)¶ Check if any of given button is currently pressed down (state 1).
-
is_down_only(button_id)¶
-
pressed(button_id)¶ Check if a given button has just been pressed (transition 0->1).
-
pressed_any(button_ids)¶ Check if at least one in a given list of buttons has just been pressed (transition 0->1).
Check if the given button combination has just been pressed ( all buttons 1 and one of them just transitioned 0->1)
-
released(button_id)¶ Check if a given button has just been released (transition 1->0).
-
released_all(button_ids)¶ Check if all given buttons have just been released (transition 1->0).
-
released_any(button_ids)¶ Check if any of given buttons has just been released (transition 1->0).
-
update(joy)¶ To be called with each new joystick data.
-
was_down(button_id)¶ Check if a given button was pressed down (state 1).
-
was_down_all(button_ids)¶ Check if all given button were pressed down (state 1).
-
was_down_any(button_ids)¶ Check if any of given button was pressed down (state 1).
-
was_down_only(button_id)¶
-