Control
These functions provide motor control without using effects from Feelix and are based on the SimpleFOC library. Visit simplefoc.com for more details.
This code works with the Feelix Effect Arduino Library
Move Motor
In torque mode
MotionControlType::torque
thetargetValue
sets the voltage.In angle mode
MotionControlType::angle
thetargetValue
sets the target position (radians).In velocity mode
MotionControlType::velocity
thetargetValue
sets the target speed (rad/s).
feelix.move_feelix(float targetValue, MotionControlType controlType);
Motor Control Parameters
PID controller settings (more information)
Angle PID
feelix.bldc->P_angle.P = 14.0;
feelix.bldc->P_angle.I = 0.0;
feelix.bldc->P_angle.D = 0.0;
Velocity PID
feelix.bldc->PID_velocity.P = 0.5;
feelix.bldc->PID_velocity.I = 10.0;
feelix.bldc->PID_velocity.D = 0.0;
Functions and Parameters
Set rotation range
void setRange(float rangeMin, float rangeMax, bool updateStartPos = true);
rangeMin – start position in degrees (default: 0)
rangeMax – end position in degrees (default: 360)
updateStartPos (optional) – set current position to zero (default: true)
Constrain range within which effects can be played
bool constrain_range = true; // default: false
Set voltage limit
void setVoltageLimit(float limit); // default: 12.0 V
Set velocity limit
void setVelocityLimit(float limit); // default: 22.0 rad/s
Transmission Factor
Setting this factor lets you account for gear ratios so motion is calculated at the output shaft rather than just at the motor.
float transmissionFactor = 1.0; //default 1.0
Last updated
Was this helpful?