sensor.leap
Platypush documentation
sensor.leap
- class platypush.backend.sensor.leap.LeapFuture(seconds, listener, event)[source]
Bases:
Timer
- __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(*args: Any, **kwargs: Any)[source]
Bases:
Listener
- class platypush.backend.sensor.leap.SensorLeapBackend(position_ranges=None, position_tolerance=0.0, frames_throttle_secs=None, *args, **kwargs)[source]
Bases:
Backend
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:
The Redis backend enabled
The Leap Motion SDK compiled with Python 3 support, see my port at https://github.com:BlackLight/leap-sdk-python3.git
The leapd daemon to be running and your Leap Motion connected
Triggers:
platypush.message.event.sensor.leap.LeapFrameEvent
when a new frame is receivedplatypush.message.event.sensor.leap.LeapFrameStartEvent
when a new sequence of frame startsplatypush.message.event.sensor.leap.LeapFrameStopEvent
when a sequence of frame stopsplatypush.message.event.sensor.leap.LeapConnectEvent
when a Leap Motion device is connectedplatypush.message.event.sensor.leap.LeapDisconnectEvent
when a Leap Motion device disconnects
- __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)