Calculating velocity value in sensorless mode

I am trying to calculate the velocity of the motor as it spins in sensorless ramp mode. When I plot odrv0.axis0.encoder.vel_estimate, the result is very bad. Velocity estimation takes up very specific values and the plot of it doesn’t really correspond to an integration of the encoder position plot (Case 1)

So i tried integrating it myself and this is the result i got (Case 2)

Granted the acceleration I have given is different on both cases, manually integrating and plotting the velocity seems much better than the odrive’s velocity estimate. Does odrive really use this value as a velocity feedback? If not, how can I access the actual velocity estimate from odrive.

So the first thing I notice is that your velocity plot seems to be severely undersampled. It’s pretty difficult to tell what is really going on from that plot.
It’s possible that the velocity estimate is coming from the Back-EMF measurement, but I haven’t read the code.
If you have an encoder, why are you using sensorless mode anyway? :stuck_out_tongue: