usb

Hardware that uses USB

Classes

Scale([model, vendor_id, product_id])

Wheel([mouse_idx, fs, thresh, thresh_type, …])

A continuously measured mouse wheel.

class Wheel(mouse_idx=0, fs=10, thresh=100, thresh_type='dist', start=True, digi_out=False, mode='vel_total', integrate_dur=5)[source]

Bases: autopilot.hardware.Hardware

A continuously measured mouse wheel.

Uses a USB computer mouse.

Warning

‘vel’ thresh_type not implemented

Attributes

MODES

Built-in immutable sequence.

MOVE_DTYPE

Built-in mutable sequence.

THRESH_TYPES

Built-in mutable sequence.

input

bool(x) -> bool

trigger

bool(x) -> bool

type

str(object=’‘) -> str

Methods

assign_cb(trigger_fn)

Every hardware device that is a trigger must redefine this to accept a function (typically Task.handle_trigger()) that is called when that trigger is activated.

calc_move(move[, thresh_type])

Calculate distance move depending on type (x, y, total dist)

check_thresh(move)

Updates thresh_val and checks whether it’s above/below threshold

l_clear(value)

Stop measuring!

l_measure(value)

Task has signaled that we need to start measuring movements for a trigger

l_stop(value)

Stop measuring and clear system resources

release()

Every hardware device needs to redefine release(), and must

start()

thresh_trig()

Parameters
  • mouse_idx (int)

  • fs (int)

  • thresh (int)

  • thresh_type (‘dist’)

  • start (bool)

  • digi_out (Digital_Out, bool)

  • mode (‘vel_total’)

  • integrate_dur (int)

input = True
type = 'Wheel'
trigger = False
THRESH_TYPES = ['dist', 'x', 'y', 'vel']
MODES = ('vel_total', 'steady', 'dist', 'timed')
MOVE_DTYPE = [('vel', 'i4'), ('dir', 'U5'), ('timestamp', 'f8')]
start()[source]
check_thresh(move)[source]

Updates thresh_val and checks whether it’s above/below threshold

Parameters

move (np.array) – Structured array with fields (‘vel’, ‘dir’, ‘timestamp’)

Returns:

calc_move(move, thresh_type=None)[source]

Calculate distance move depending on type (x, y, total dist)

Parameters
  • move ()

  • thresh_type ()

Returns:

thresh_trig()[source]
assign_cb(trigger_fn)[source]

Every hardware device that is a trigger must redefine this to accept a function (typically Task.handle_trigger()) that is called when that trigger is activated.

When not redefined, a warning is given.

l_measure(value)[source]

Task has signaled that we need to start measuring movements for a trigger

Parameters

value ()

l_clear(value)[source]

Stop measuring!

Parameters

value ()

Returns:

l_stop(value)[source]

Stop measuring and clear system resources :Parameters: value ()

Returns:

release()[source]

Every hardware device needs to redefine release(), and must

  • Safely unload any system resources used by the object, and

  • Return the object to a neutral state - eg. LEDs turn off.

When not redefined, a warning is given.

class Scale(model='stamps.com', vendor_id=None, product_id=None)[source]

Bases: autopilot.hardware.Hardware

Note

Not implemented, working on using a digital scale to make weighing faster.

Attributes

MODEL

dict() -> new empty dictionary

Parameters
  • model

  • vendor_id

  • product_id

MODEL = {'stamps.com': {'product_id': 27251, 'vendor_id': 5190}}