umich_sim.wizard.inputs package#

Submodules#

umich_sim.wizard.inputs.base_input_dev module#

class umich_sim.wizard.inputs.base_input_dev.InputDevice(client_mode: ClientMode)#

Bases: object

base class for general input device

abstract events_handler() None#
has_ff: bool = False#
start() None#

start the thread

stop() None#

stop the thread

classmethod support_ff() bool#

umich_sim.wizard.inputs.base_wheel module#

class umich_sim.wizard.inputs.base_wheel.BaseWheel(ev_path: str, client_mode: ClientMode)#

Bases: InputDevice

Abstract wheel class to be inherited

classmethod PedalMap(val: int)#

map the input of pedals to carla defined region [0,1]

SetWheelPos(val: float)#

Set the wheel position inputs: - val: float to indicate wheel position [-1,1]

classmethod SteerMap(val: int)#

map the input of steering wheel to carla defined region [-1,1]

erase_ff(ff_type: int)#

Erase the specified force feedback type

erase_ff_autocenter()#
erase_ff_spring()#
events_handler() None#

Capture and handle events

has_ff: bool = True#
pedal_max: int = 255#
set_speed_feedback()#

Update the auto center force feedback using speed

steer_max: int = 65535#

umich_sim.wizard.inputs.g27_wheel module#

class umich_sim.wizard.inputs.g27_wheel.G27(ev_path: str, client_mode: ClientMode = ClientMode.EGO)#

Bases: BaseWheel

acc_val: int#
brake_val: int#
client_mode: ClientMode#
clutch_val: int#
ev_abs_map: dict#
ev_events: list#
ev_key_map: dict#
ev_type_accepted: tuple#
steer_val: int#

umich_sim.wizard.inputs.g29_wheel module#

class umich_sim.wizard.inputs.g29_wheel.G29(ev_path: str, client_mode: ClientMode = ClientMode.EGO)#

Bases: BaseWheel

acc_val: int#
brake_val: int#
client_mode: ClientMode#
clutch_val: int#
ev_abs_map: dict#
ev_events: list#
ev_key_map: dict#
ev_type_accepted: tuple#
steer_val: int#

umich_sim.wizard.inputs.g920_wheel module#

class umich_sim.wizard.inputs.g920_wheel.G920(ev_path: str, client_mode: ClientMode = ClientMode.EGO)#

Bases: BaseWheel

acc_val: int#
brake_val: int#
client_mode: ClientMode#
clutch_val: int#
collision_effect()#
ev_abs_map: dict#
ev_events: list#
ev_key_map: dict#
ev_type_accepted: tuple#
start_rumble()#
steer_val: int#
stop_rumble()#

umich_sim.wizard.inputs.input_types module#

class umich_sim.wizard.inputs.input_types.ClientMode(value)#

Bases: IntEnum

Enum indicating input device type

EGO: Driver input WIZARD: Wizard input as autopilot

EGO = 0#
WIZARD = 1#
class umich_sim.wizard.inputs.input_types.ControlEventType(value)#

Bases: IntEnum

Enum indicating the event requested for controller to handle

BRAKE = 10#
CHANGE_WEATHER = 0#
CLOSE = 21#
CLUTCH = 12#
DEC_GEAR = 7#
GAS = 9#
INC_GEAR = 8#
KB_BRAKE = 14#
KB_GAS = 13#
KB_LEFT = 15#
KB_RIGHT = 16#
KB_TOGGLE_REVERSE = 17#
LEFT_BLINKER = 18#
NONE = 22#
RESTART_WORLD = 1#
RIGHT_BLINKER = 19#
STEER = 11#
SWITCH_DRIVER = 20#
TOGGLE_CAMERA = 3#
TOGGLE_HELP = 5#
TOGGLE_INFO = 2#
TOGGLE_LDW = 6#
TOGGLE_SENSOR = 4#
class umich_sim.wizard.inputs.input_types.InputDevType(value)#

Bases: IntEnum

Type of input device

G27 = 2#
G29 = 1#
G920 = 0#
KBD = 3#
class umich_sim.wizard.inputs.input_types.InputPacket(event_type: ControlEventType, dev: ClientMode, val: int)#

Bases: object

dataclass carrying data to controller

dev: ClientMode#
event_type: ControlEventType#
val: int#
class umich_sim.wizard.inputs.input_types.WheelKeyType(value)#

Bases: IntEnum

Enum indicating the keys on the racing wheel

A = 11#
ACC = 24#
B = 12#
BRAKE = 23#
CIRCLE = 16#
CLUTCH = 22#
CROSS = 15#
HPAD = 20#
L2 = 5#
L3 = 6#
LBOT = 27#
LMID = 26#
LSB = 1#
LSHIFT = 3#
LTOP = 25#
MENU = 10#
R2 = 7#
R3 = 8#
RBOT = 30#
RMID = 29#
RSB = 2#
RSHIFT = 4#
RTOP = 28#
SQUARE = 17#
STEER = 21#
TRIANGLE = 18#
VIEW = 9#
VPAD = 19#
X = 13#
XBOX = 0#
Y = 14#

umich_sim.wizard.inputs.keyboard module#

class umich_sim.wizard.inputs.keyboard.KeyboardInput(client_type: ClientMode = ClientMode.EGO)#

Bases: InputDevice

keyboard input device type, use pygame api to get keyboard event

W : throttle S : brake A/D : steer left/right Q : toggle reverse Z/X : toggle right/left blinker L : toggle lane departure warning TAB : toggle camera F1 : toggle HUD H/? : toggle help ESC : quit

KB_EVENT_MAP: dict = {9: ControlEventType.TOGGLE_CAMERA, 27: ControlEventType.CLOSE, 47: ControlEventType.TOGGLE_HELP, 63: ControlEventType.TOGGLE_HELP, 97: ControlEventType.KB_LEFT, 100: ControlEventType.KB_RIGHT, 104: ControlEventType.TOGGLE_HELP, 108: ControlEventType.TOGGLE_LDW, 113: ControlEventType.KB_TOGGLE_REVERSE, 115: ControlEventType.KB_BRAKE, 119: ControlEventType.KB_GAS, 120: ControlEventType.RIGHT_BLINKER, 122: ControlEventType.LEFT_BLINKER, 1073741882: ControlEventType.TOGGLE_INFO, 1073741903: ControlEventType.KB_RIGHT, 1073741904: ControlEventType.KB_LEFT, 1073741905: ControlEventType.KB_BRAKE, 1073741906: ControlEventType.KB_GAS}#
events_handler() None#

Module contents#

umich_sim.wizard.inputs.create_input_device(dev_type: InputDevType, client_mode: ClientMode, dev_path: Optional[str] = None) InputDevice#

create input device based on dev_type passed :param dev_type: device type :param client_mode: client mode (wizard or host) :param dev_path: optional argument passed to joystick devices