platypush.backend.sensor.leap

class platypush.backend.sensor.leap.LeapFuture(seconds, listener, event)[source]
__init__(seconds, listener, event)[source]

This constructor should always be called with keyword arguments. Arguments are:

group should be None; reserved for future extension when a ThreadGroup class is implemented.

target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.

args is the argument tuple for the target invocation. Defaults to ().

kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

class platypush.backend.sensor.leap.LeapListener(position_ranges, position_tolerance, logger, frames_throttle_secs=None)[source]
__init__(position_ranges, position_tolerance, logger, frames_throttle_secs=None)[source]

Initialize self. See help(type(self)) for accurate signature.

class platypush.backend.sensor.leap.SensorLeapBackend(position_ranges=None, position_tolerance=0.0, frames_throttle_secs=None, *args, **kwargs)[source]

Backend for events generated using a Leap Motion device to track hands and gestures, https://www.leapmotion.com/

Note that the default SDK is not compatible with Python 3. Follow the instructions on https://github.com/BlackLight/leap-sdk-python3 to build the Python 3 module.

Also, you’ll need the Leap driver and utils installed on your OS (follow instructions at https://www.leapmotion.com/setup/) and the leapd daemon running to recognize your controller.

Requires:

Triggers:

__init__(position_ranges=None, position_tolerance=0.0, frames_throttle_secs=None, *args, **kwargs)[source]
Parameters:position_ranges – It specifies how wide the hand space (x, y and z axes) should be in millimiters.

Default:

[
    [-300.0, 300.0],  # x axis
    [25.0, 600.0],    # y axis
    [-300.0, 300.0],  # z axis
]
Parameters:
  • position_tolerance (float) – % of change between a frame and the next to really consider the next frame as a new one (default: 0)
  • frames_throttle_secs (float) – If set, the frame events will be throttled and pushed to the main queue at the specified rate. Good to set if you want to connect Leap Motion events to actions that have a lower throughput (the Leap Motion can send a lot of frames per second). Default: None (no throttling)
run()[source]

Starts the backend thread. To be implemented in the derived classes if the loop method isn’t defined.