Config

Methods:

class Leap.Config

The Config class provides access to Leap Motion system configuration information.

You can get and set gesture configuration parameters using the Config object obtained from a connected Controller object (Controller.config). The key strings required to identify a configuration parameter include:

Key string Value type Default value Units
Gesture.Circle.MinRadius float 5.0 mm
Gesture.Circle.MinArc float 1.5 * pi radians
Gesture.Swipe.MinLength float 150 mm
Gesture.Swipe.MinVelocity float 1000 mm/s
Gesture.KeyTap.MinDownVelocity float 50 mm/s
Gesture.KeyTap.HistorySeconds float 0.1 s
Gesture.KeyTap.MinDistance float 3.0 mm
Gesture.ScreenTap.MinForwardVelocity float 50 mm/s
Gesture.ScreenTap.HistorySeconds float 0.1 s
Gesture.ScreenTap.MinDistance float 5.0 mm
head_mounted_display_mode boolean false n/a

After setting a configuration value, you must call the save() method to commit the changes. You can call save() after the Controller has connected to the Leap Motion service/daemon. In other words, after the Controller has dispatched the serviceConnected or connected events or Controller.isConnected is true. The configuration value changes are not persistent; your application needs to set the values everytime it runs.

Note: “head_mounted_display_mode” is a temporary setting that tells the Leap Motion software to expect hands viewed from the top rather than the bottom. In the long run, we expect that the software will handle both automatically without the need for a flag. This setting can also be set from the Leap Motion control panel.

See also:

New in version 1.0.

classmethod Config()

Constructs a Config object.

Do not create your own Config objects; rather, access the Config object of a connected controller with: Controller.config.

config = controller.config

New in version 1.0.

get(key)

Gets the current value of a configuration variable.

min_swipe_length = config.get("Gesture.Swipe.MinLength")
Parameters:key (string) – The name of the configuration variable.
Returns:the value currently associated with the specified key.
set(key, value)

Sets a configuration variable to the specified value locally. The change in value is not effective until the save() method is called.

config.set("Gesture.Swipe.MinLength", 100)
Parameters:
  • key (string) – The name of the configuration variable.
  • value (must be convertible to the type specified by the type parameter) – The value to set.
save()

Saves the current state of the config.

controller.config.set("Gesture.Circle.MinRadius", 15);
controller.config.set("Gesture.Circle.MinArc", 1.7);
success = controller.config.save();

Call save() after making a set of configuration changes. The save() function transfers the configuration changes to the Leap Motion service. You can call save() after the Controller has connected to the Leap Motion service/daemon. In other words, after the Controller has dispatched the serviceConnected or connected events or Controller.isConnected is true.The configuration value changes are not persistent; your application must set the values everytime it runs.

Returns:True on success; False on failure.

New in version 1.0.