Skip to content

Repository files navigation

motion-features

A monoclass library computing a customizable set of gestural descriptors, taking accelerometer and gyroscope sensors data as input.

List of available descriptors :

computed from accelerometer only :

  • accIntensity : gesture intensity computed from the accelerometer
  • kick : detects a hit gesture
  • shake : amount of shakiness of a gesture

computed from gyroscope only :

  • gyrIntensity : gesture intensity computed from the gyroscope
  • spin : the global rotation speed
  • still : tell if the sensors are still

computed from both accelerometer and gyroscope :

  • freefall : tell if the sensors are falling

API documentation :

MotionFeatures

Class computing the descriptors from accelerometer and gyroscope data.
es6 + browserify example :

import{MotionFeatures}from'motion-features';constmf=newMotionFeatures({descriptors: ['accIntensity','kick']});// then, on each motion event :mf.setAccelerometer(x,y,z);mf.setGyroscope(alpha,beta,gamma);mf.update(function(err,res){if(err===null){// do something with res}});

Kind: global class

new MotionFeatures(initObject)

ParamTypeDescription
initObjectObjectobject containing an array of the required descriptors and some variables used to compute the descriptors that you might want to change (for example if the browser is chrome you might want to set gyrIsInDegrees to false because it's the case on some versions, or you might want to change some thresholds). See the code for more details.

motionFeatures.updateParams(params)

Update configuration parameters (except descriptors list)

Kind: instance method of MotionFeatures

ParamTypeDescription
paramsObjecta subset of the constructor's parameters

motionFeatures.setAccelerometer(x, y, z)

Sets the current accelerometer values.

Kind: instance method of MotionFeatures

ParamTypeDefaultDescription
xNumberthe accelerometer's x value
yNumber0the accelerometer's y value
zNumber0the accelerometer's z value

motionFeatures.setGyroscope(x, y, z)

Sets the current gyroscope values.

Kind: instance method of MotionFeatures

ParamTypeDefaultDescription
xNumberthe gyroscope's x value
yNumber0the gyroscope's y value
zNumber0the gyroscope's z value

motionFeatures.update(callback) ⇒ features

Triggers computation of the descriptors from the current sensor values and pass the results to a callback

Kind: instance method of MotionFeatures
Returns: features - features - Return these computed descriptors anyway

ParamTypeDefaultDescription
callbackfeaturesCallbackThe callback handling the last computed descriptors

accIntensity : Object

Intensity of the movement sensed by an accelerometer.

Kind: global typedef
Properties

NameTypeDescription
normNumberthe global energy computed on all dimensions.
xNumberthe energy in the x (first) dimension.
yNumberthe energy in the y (second) dimension.
zNumberthe energy in the z (third) dimension.

gyrIntensity : Object

Intensity of the movement sensed by a gyroscope.

Kind: global typedef
Properties

NameTypeDescription
normNumberthe global energy computed on all dimensions.
xNumberthe energy in the x (first) dimension.
yNumberthe energy in the y (second) dimension.
zNumberthe energy in the z (third) dimension.

freefall : Object

Information about the free falling state of the sensor.

Kind: global typedef
Properties

NameTypeDescription
accNormNumberthe norm of the acceleration.
fallingBooleantrue if the sensor is free falling, false otherwise.
durationNumberthe duration of the free falling since its beginning.

kick : Object

Impulse / hit movement detection information.

Kind: global typedef
Properties

NameTypeDescription
intensityNumberthe current intensity of the "kick" gesture.
kickingBooleantrue if a "kick" gesture is being detected, false otherwise.

shake : Object

Shake movement detection information.

Kind: global typedef
Properties

NameTypeDescription
shakingNumberthe current amount of "shakiness".

spin : Object

Information about the spinning state of the sensor.

Kind: global typedef
Properties

NameTypeDescription
spinningBooleantrue if the sensor is spinning, false otherwise.
durationNumberthe duration of the spinning since its beginning.
gyrNormNumberthe norm of the rotation speed.

still : Object

Information about the stillness of the sensor.

Kind: global typedef
Properties

NameTypeDescription
stillBooleantrue if the sensor is still, false otherwise.
slideNumberthe original value thresholded to determine stillness.

features : Object

Computed features.

Kind: global typedef
Properties

NameTypeDescription
accIntensityaccIntensityIntensity of the movement sensed by an accelerometer.
gyrIntensitygyrIntensityIntensity of the movement sensed by a gyroscope.
freefallfreefallInformation about the free falling state of the sensor.
kickkickImpulse / hit movement detection information.
shakeshakeShake movement detection information.
spinspinInformation about the spinning state of the sensor.
stillstillInformation about the stillness of the sensor.

featuresCallback : function

Callback handling the features.

Kind: global typedef

ParamTypeDescription
errStringDescription of a potential error.
resfeaturesObject holding the feature values.

About

set of real-time gesture descriptors for accelerometers and gyroscopes

Resources

Stars

10 stars

Watchers

6 watching

Forks

Releases

Packages

Contributors

Languages