Skip to content

Conversation

@mjc-506
Copy link
Contributor

@mjc-506 mjc-506 commented Apr 19, 2021

As per https://openinverter.org/forum/viewtopic.php?p=26645#p26645

The new parameters/values, and the old atan2 code probably won't be needed long-term, but I've left them in for testing at the moment.

@jsphuebner
Copy link
Owner

Very nice, did you test it with some hardware? Could it also calculate angular speed to replace the clumsy 10ms angle difference calculation?

@mjc-506
Copy link
Contributor Author

mjc-506 commented Apr 19, 2021 via email

@jsphuebner
Copy link
Owner

Yes, that would be awesome!

@mjc-506
Copy link
Contributor Author

mjc-506 commented Apr 20, 2021

Now uses speed from the observer code for resolver or encoder ICs, but retains the current speed calculation for other position feedback types.
Seems to give nice output, and handles quick speed changes as well as I can test with this hardware here.

@mjc-506
Copy link
Contributor Author

mjc-506 commented Apr 20, 2021

Turns out 'lastFrequency' must remain positive - the motor will run fine with it negative but trying to regen results in increased speeds! (The TI observer code outputs speed with a sign - +ve for forward, -ve for backward, and the OpenInverter code 'corrects' that later by multiplying by the sign of the direction. This is needed for other position feedback, so I've left this there, and just 'ABS()'d the lastFrequency in the new code)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants