pyrcf.components.global_planners.ui_reference_generators.key_mappings
Attributes
Default key mappings when using the keyboard interface for sending global motion |
|
Default joystick mapping when using JoystickInterface as global planner for sending |
Classes
By default all buttons do nothing to the GlobalMotionPlan object. |
|
By default all analog sticks do nothing to the GlobalMotionPlan object. |
|
Functions
|
|
|
Toggle between two bindings (callables) for the specified attribute name in the mapping. |
|
Module Contents
- pyrcf.components.global_planners.ui_reference_generators.key_mappings.MAX_LIN_VEL = 0.5
- pyrcf.components.global_planners.ui_reference_generators.key_mappings.MAX_ANG_VEL = 1.0
- pyrcf.components.global_planners.ui_reference_generators.key_mappings.LIN_VEL_DELTA = 0.05
- pyrcf.components.global_planners.ui_reference_generators.key_mappings.ANG_VEL_DELTA = 0.1
- pyrcf.components.global_planners.ui_reference_generators.key_mappings.POS_DELTA = 0.02
- pyrcf.components.global_planners.ui_reference_generators.key_mappings.JOINT_POS_DELTA = 0.01
- pyrcf.components.global_planners.ui_reference_generators.key_mappings._jpi
- pyrcf.components.global_planners.ui_reference_generators.key_mappings.DEFAULT_KEYBOARD_MAPPING
Default key mappings when using the keyboard interface for sending global motion plan messages.
o –> TOGGLE between CUSTOM and IDLE
h –> HOLD_POSITION
w –> APPLY_LIN_VEL_DELTA(np.array([0.05, 0.0, 0.0]))
s –> APPLY_LIN_VEL_DELTA(np.array([-0.05, 0.0, 0.0]))
q –> APPLY_LIN_VEL_DELTA(np.array([0.0, 0.05, 0.0]))
e –> APPLY_LIN_VEL_DELTA(np.array([0.0, -0.05, 0.0]))
a –> APPLY_ROT_VEL_DELTA(np.array([0.0, 0.0, 0.1]))
d –> APPLY_ROT_VEL_DELTA(np.array([0.0, 0.0, -0.1]))
up –> increment selected joint by 0.01 units
down –> reduce reference joint position target for selected joint by 0.01 units
right –> increment the id of the joint to be controlled with up/down keys
left –> reduce the id of the joint to be controlled with up/down keys by 1
- pyrcf.components.global_planners.ui_reference_generators.key_mappings._return_arg1(x: Any, *args, **kwargs)
- class pyrcf.components.global_planners.ui_reference_generators.key_mappings.GamePadButtonMappings
By default all buttons do nothing to the GlobalMotionPlan object.
Each button mapping can be replaced with another function callable that takes as argument a GlobalMotionPlan object and returns another GlobalMotionPlan object.
- NORTH: Callable[[pyrcf.core.types.GlobalMotionPlan], pyrcf.core.types.GlobalMotionPlan]
- SOUTH: Callable[[pyrcf.core.types.GlobalMotionPlan], pyrcf.core.types.GlobalMotionPlan]
- EAST: Callable[[pyrcf.core.types.GlobalMotionPlan], pyrcf.core.types.GlobalMotionPlan]
- WEST: Callable[[pyrcf.core.types.GlobalMotionPlan], pyrcf.core.types.GlobalMotionPlan]
- DPAD_UP: Callable[[pyrcf.core.types.GlobalMotionPlan], pyrcf.core.types.GlobalMotionPlan]
- DPAD_DOWN: Callable[[pyrcf.core.types.GlobalMotionPlan], pyrcf.core.types.GlobalMotionPlan]
- DPAD_LEFT: Callable[[pyrcf.core.types.GlobalMotionPlan], pyrcf.core.types.GlobalMotionPlan]
- DPAD_RIGHT: Callable[[pyrcf.core.types.GlobalMotionPlan], pyrcf.core.types.GlobalMotionPlan]
- START_BUTTON: Callable[[pyrcf.core.types.GlobalMotionPlan], pyrcf.core.types.GlobalMotionPlan]
- RB: Callable[[pyrcf.core.types.GlobalMotionPlan], pyrcf.core.types.GlobalMotionPlan]
- LB: Callable[[pyrcf.core.types.GlobalMotionPlan], pyrcf.core.types.GlobalMotionPlan]
- class pyrcf.components.global_planners.ui_reference_generators.key_mappings.GamePadAnalogStickMappings
By default all analog sticks do nothing to the GlobalMotionPlan object.
Each analog stick mapping can be replaced with another function callable that takes as argument a GlobalMotionPlan object and a scaling value (float from the analog output (e.g. joystick value)), and returns a GlobalMotionPlan object.
- LEFT_X: Callable[[pyrcf.core.types.GlobalMotionPlan, float], pyrcf.core.types.GlobalMotionPlan]
- LEFT_Y: Callable[[pyrcf.core.types.GlobalMotionPlan, float], pyrcf.core.types.GlobalMotionPlan]
- RIGHT_X: Callable[[pyrcf.core.types.GlobalMotionPlan, float], pyrcf.core.types.GlobalMotionPlan]
- RIGHT_Y: Callable[[pyrcf.core.types.GlobalMotionPlan, float], pyrcf.core.types.GlobalMotionPlan]
- RT: Callable[[pyrcf.core.types.GlobalMotionPlan, float], pyrcf.core.types.GlobalMotionPlan]
- LT: Callable[[pyrcf.core.types.GlobalMotionPlan, float], pyrcf.core.types.GlobalMotionPlan]
- class pyrcf.components.global_planners.ui_reference_generators.key_mappings.GamePadMappings
- button_mappings: GamePadButtonMappings
- analog_mappings: GamePadAnalogStickMappings
- pyrcf.components.global_planners.ui_reference_generators.key_mappings.toggle_mapping(mapping: GamePadButtonMappings | GamePadAnalogStickMappings, key_name: str, bindings: Tuple[Callable[Ellipsis, pyrcf.core.types.GlobalMotionPlan], Callable[Ellipsis, pyrcf.core.types.GlobalMotionPlan]])
Toggle between two bindings (callables) for the specified attribute name in the mapping.
- Parameters:
mapping (GamePadButtonMappings | GamePadAnalogStickMappings) – The original mapping (should be mutable).
key_name (str) – Name of the attribute whose binding is to be modified.
bindings (Tuple[Callable[..., GlobalMotionPlan], Callable[..., GlobalMotionPlan]]) – The two bindings to switch between.
- pyrcf.components.global_planners.ui_reference_generators.key_mappings._toggle_mapping_and_return_original_gplan(global_plan: pyrcf.core.types.GlobalMotionPlan, mapping: GamePadButtonMappings | GamePadAnalogStickMappings, key_name: str, bindings: Tuple[Callable[Ellipsis, pyrcf.core.types.GlobalMotionPlan], Callable[Ellipsis, pyrcf.core.types.GlobalMotionPlan]])
- pyrcf.components.global_planners.ui_reference_generators.key_mappings._jpi2
- pyrcf.components.global_planners.ui_reference_generators.key_mappings.DEFAULT_GAMEPAD_MAPPINGS
Default joystick mapping when using JoystickInterface as global planner for sending global plan messages.
- NOTE: SOUTH, EAST, WEST, NORTH below indicates the keys on the right side of the joypad.
(e.g. this is A, B, X, Y respectively on logitech joypad)
BUG: WEST and NORTH for logitech seems to be switched!!
Start btn –> Toggle between CUSTOM and IDLE modes
South –> HOLD_POSITION
DPAD UP –> Increase joint position target for the current joint id by 0.01 units.
DPAD DOWN –> Decrease joint position target for the current joint id by 0.01 units.
DPAD LEFT –> Change the ID of the joint by -1 (affects actions of DPAD UP and DOWN buttons).
DPAD LEFT –> Change the ID of the joint by +1 (affects actions of DPAD UP and DOWN buttons).
- LEFT Analog up/down –> apply linear velocity forward/backward (x axis) (max vel: 0.5 m/s)
(OR) apply linear velocity up/down (z axis) (max vel: 0.5 m/s). Toggle behaviour of LEFT Analog up/down using LB button.
LEFT Analog right/left –> apply linear velocity right/left (base frame) (max vel: 0.5 m/s)
- RIGHT Analog right/left –> apply rotational velocity (about z axis of base frame; yaw rate)
(max vel: 1.0 rad/sec) (OR) apply rotational velocity (about x axis; roll rate) (max vel: 0.5 m/s). Toggle behaviour of RIGHT Analog right/left using RB button.
RIGHT Analog up/down –> apply rotational velocity (about y axis of global frame; pitch rate)
- LB: This button changes the behaviour of the LEFT analog stick. Switches between sending
linear velocity along X, and linear velocity along Z.
- RB: This button changes the behaviour of the RIGHT analog stick. Switches between sending
angular velocity about X, and linear velocity about Z.