mesoSPIM.src.devices.joysticks package
Submodules
mesoSPIM.src.devices.joysticks.Demo_SidePanel module
mesoSPIM.src.devices.joysticks.logitech module
Logitech Joystick Classes
pywinusb.hid spawns another thread for joystick event handling which might cause problems.
Because the signals emitted can only be processed when a QEventLoop is running, you need something with an eventloop (e.g. a QApplication) even for testing.
- class mesoSPIM.src.devices.joysticks.logitech.FarmSimulatorSidePanel(*args: Any, **kwargs: Any)[source]
Bases:
QObjectThe joystick is set up using the pyqinusb package by using an HidDeviceFilter for the side panel values.
Axis numbers are 0-indexed as per Python convention, i.e. the 6 axes are designated “0” to “5”.
- Signals:
sig_button_pressed = QtCore.pyqtSignal(int) # <– allows handling of buttons sig_axis_moved = QtCore.pyqtSignal(int, int) # <– axis, value sig_mode_changed = QtCore.pyqtSignal(str) # <– Modal switching (XY/ZF mode) sig_start_timer = QtCore.pyqtSignal(int) # <– timer id, value to emit sig_stop_timer = QtCore.pyqtSignal(int) # <– timer id
- mode
Joysticks can have different modes (e.g. whether analog axes 0-2 or 3-5 are selected). This is represented in this attribute.
- Type:
mesoSPIM.src.devices.joysticks.mesoSPIM_JoystickHandlers module
Contains the joystick handlers
Because the signals emitted can only be processed when a QEventLoop is running, you need something with an eventloop (e.g. a QApplication) even for testing.
- class mesoSPIM.src.devices.joysticks.mesoSPIM_JoystickHandlers.Demo_JoystickHandler(*args: Any, **kwargs: Any)[source]
Bases:
QObject
- class mesoSPIM.src.devices.joysticks.mesoSPIM_JoystickHandlers.mesoSPIM_JoystickHandler(*args: Any, **kwargs: Any)[source]
Bases:
QObject- axis_handler(axis_id, value)
The axis handler deals with joystick movements.
The FarmSimulatorSidePanel has 6 movement axes, 0 to 2 in “blue” LED mode (grey button on the joystick) and 3 to 5 in “red” mode.
When starting up, the mode is unknown and has to be found out by registering which axes produce joystick events.
- button_handler(button_id)
Debugging print statement
- cfg
parent is the window
- decrease_slider(slider, event_devider=2)[source]
To avoid events coming too quickly, only every n-th event is causing a change if n = event_devider
- mode_handler(str)
Helper method to handle mode changes of the joystick.
The FarmSimulatorSidePanel has 6 movement axes, 0 to 2 in “blue” LED mode (grey button on the joystick) and 3 to 5 in “red” mode.
When starting up, the mode is unknown and has to be found out by registering which axes produce joystick events.