usb

Hardware that uses USB

Classes:

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

A continuously measured mouse wheel.

Scale([model, vendor_id, product_id])

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

Parameters
  • mouse_idx (int)

  • fs (int)

  • thresh (int)

  • thresh_type (‘dist’)

  • start (bool)

  • digi_out (Digital_Out, bool)

  • mode (‘vel_total’)

  • integrate_dur (int)

Attributes:

input

type

trigger

THRESH_TYPES

MODES

MOVE_DTYPE

Methods:

start()

check_thresh(move)

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

calc_move(move[, thresh_type])

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

thresh_trig()

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.

l_measure(value)

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

l_clear(value)

Stop measuring!

l_stop(value)

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

release()

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

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.

logger: logging.Logger
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.

Parameters
  • model

  • vendor_id

  • product_id

Attributes:

MODEL

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