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::torquethetargetValuesets the voltage.In angle mode
MotionControlType::anglethetargetValuesets the target position (radians).In velocity mode
MotionControlType::velocitythetargetValuesets 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: falseSet voltage limit
void setVoltageLimit(float limit); // default: 12.0 VSet velocity limit
void setVelocityLimit(float limit); // default: 22.0 rad/sTransmission 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.0Last updated
Was this helpful?