Hey @Owen_Williams, that sounds perfect!
You are moving very fast, at the moment I am not able to follow you with testing and integrating. I will not be able to do so for one week more, but I am in for a pull request. Until then, this is a great option for the people to try out!
You can check the FOC implementation docs for calibration purposes:
And the Sensor docs for more info about the functions in question:
// initialize counter to zero
float HallSensor::initRelativeZero(){
// this one you need to implement
return 0;
}
The relative zero init you will need to implement.
I also am not sure that we will be able to use SinePWM
and SpaceVectorPWM
modulation with Hall sensors because with hall sensor you use only three sampled values of the sine wave. positive and negative maximum and zero. But they need to be well sampled, otherwise you might have some strange behavior. I was planning to introduce a new simplified modulation technique, only for the hall sensors which would use effectively square waves. But it will have to wait at least one week.
I can implement full PID, up to now, I did not have requests to do it and I did not really have problems with it but it is a simple mod and you are right that it might be interesting for some applications.