Hey guys,
@DGAQ you cal also try downsampling the motion control loop. It will take a bit more time in between velocity calculations and the filtering will work better.
motor.motion_downsample = 5; // downsample 5 times
And if you are using an STM chip look into the work of @Chris in this thread
https://community.simplefoc.com/t/magneticsensorpwm/868
He has implemented this sensor “properly”, exploiting all the hardware features of the stm32.
Now regarding the smoothness that you can expect.
With the PWM sensor the highest resolution you can reach is 4096 cpr. And that is really not a lot.
For 1 rad/s velocity you will be passing through ~650 cunts per second and if your loop runs at 1khz then you’ll see 1 count change in each 2 loop calls
Which makes for a terrible velocity calculation.
So what you can try to do is leave the FOC loop running at max frequency and calculate the ;motion control loop down-sampled to 5ms per call for example. This you can do with the motion_downsample
parameter. At the moment this parameter is a ratio not the time so seting it to 10 means that your motor.move()
will be called each tenth time the motor.loopFOC()
is called.
Also I have a question, does your motor move smoother in torque mode?