mesoSPIM.src.devices.joysticks package

Submodules

mesoSPIM.src.devices.joysticks.Demo_SidePanel module

class mesoSPIM.src.devices.joysticks.Demo_SidePanel.Demo_SidePanel[source]

Bases: object

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: QObject

The 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:

str

farm_panel_handler(data)[source]

Buttons 1 to 8

get_bin(x, n=0)[source]

Get the binary representation of x.

Parameters:
  • x (int) – Data

  • n (int) – Minimum number of digits. If x needs less digits in binary, the rest

  • zeros. (is filled with) –

Return type:

str

handle_axis_value_changes(axis_id, axis_group, data_group, data)[source]
sample_handler(data)[source]
sig_axis_moved

alias of int

sig_button_pressed

alias of int

sig_mode_changed

alias of str

sig_start_timer

alias of int

sig_stop_timer

alias of int

start_axis_timer(axis)[source]
stop_axis_timer(axis)[source]

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

decrement_combobox(combobox)[source]
increase_slider(slider, event_devider=2)[source]
increment_combobox(combobox)[source]
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.

set_combobox_to_index(combobox, index)[source]
set_combobox_to_string(combobox, string)[source]

Module contents