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
You can also use the functions specified in the documentation of the simpleFOC library directly.
Control type options
Use when writing custom code for motor control. For FeelixEffects, this is automatically handled in the backend.
The MotionControlType can be changed at runtime to switch control modes.
feelix.bldc->controller = MotionControlType::torque;
feelix.bldc->controller = MotionControlType::angle;
feelix.bldc->controller = MotionControlType::velocity;
Move Motor
Set controlType
to MotionControlType::torque, MotionControlType::angle, or MotionControlType::velocity.
In torque mode,
targetValue
sets the voltage.In angle mode,
targetValue
sets the target position (radians).In velocity mode,
targetValue
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
void setRange(float rangeMin, float rangeMax, bool updateStartPos = true);
void setVoltageLimit(float limit);
void setVelocityLimit(float limit);
float transmissionFactor;
bool constrain_range;
Last updated
Was this helpful?