Import Feelix Effects

Initialize the Effect

Effect configuration includes:

  • data_size – length of the data array.

  • angle – width of the effect (in degrees or ms).

  • quality – spacing between data points in the array.

  • control type – effect type (torque, angle, or velocity). Haptic effects can be dependent or independent (see Getting Started).

EffectConfig_s zigzag_spring_config { 
	.data_size = 6,
	.angle = 100,
	.quality = 20,
	.effect_type = Effect_type::INDEPENDENT,
	.control_type = Control_type::TORQUE
 };

float data_zigzag_spring[] = {1.0, 0.4, 0.8, 0.2, 0.6, 0.0};
FeelixEffect zigzag_spring = FeelixEffect(zigzag_spring_config, data_zigzag_spring);

Play a Haptic Effect

Call playHapticEffectAtAngle(FeelixEffect effect, float angle_deg) in every loop to check the torque or angle based on the motor’s current position. Pass the FeelixEffect and the effect’s start position (in degrees) as arguments. Multiple effects can run in parallel or alternate using if statements.

Call move_feelix() to send data to the motor, it automatically sums overlapping effects.

Play a Velocity Effect

Call playVelocityEffect(FeelixEffect effect, void (*callback)() = NULL) in every loop to check the velocity based on the motor’s current speed. The optional callback is executed when the effect finishes.

Call move_feelix() to send data to the motor.

Change Feelix Effect Settings

Effect settings can be adjusted in the setup or main loop at run time.

  • Enable effecteffect.enable(); (enabled by default)

  • Disable effecteffect.disable();

  • Check if enabledeffect.isEnabled(); (returns true if enabled, false if not)

  • Start / Stop velocity effect

    • play = true starts the effect

    • time can delay the start (default is millis())

    • play = false stops the effect

  • Check if velocity effect is playing - effect.isPlaying(); (returns true if playing, false if not)

  • Change effect scale

    • scale.x controls angle (for position/torque effects) or duration (for velocity effects).

    • scale.y controls intensity (%)

  • Change vertical position effect

    • position.y

  • Repeat effecteffect.infinite = true; (default is false, works for both velocity and haptic effects)

  • Disable effect by direction (haptic only)

Last updated

Was this helpful?