SimpleFOC v2 - understanding sensor align

Hi @David_Gonzalez,

Yup, absolutely. I’ve included here a table of various control loop variables to get sensible (but not perfect) operation of the ODrive motor in the following control configuration:

motor.foc_modulation = FOCModulationType::SpaceVectorPWM;
motor.controller = MotionControlType::velocity;
motor.torque_controller = TorqueControlType::foc_current;

The test harness I have setup cycles the target velocity of the motor from: 0 → 6 → 0 (rad/s) every 4 seconds. It’s not perfect, as there are still times when various control loops saturate, but it’s nothing compared to the jerky/non-rotating behavior I was getting before:

Parameter Value
voltage limit 4
current limit 2
velocity limit 20
PID_current_q:
P 0.5
I 0.1
D 0
output_ramp 50
limit 1
PID_current_d:
P 1
I 0.5
D 0.01
output_ramp 100
limit 2
PID_velocity:
P 1
I 0.2
D 0.05
output_ramp 1000
limit 500
LPF_current_q 0.1
LPF_current_d 0
LPF_velocity 1
2 Likes