vedderb / bldc

The VESC motor control firmware
2.14k stars 1.34k forks source link

FOC fault handling, terminal usability and flux linkage detection improvement. #533

Closed TechAUmNu closed 1 year ago

TechAUmNu commented 1 year ago

Add fault handling to all foc functions that touch the motor. Fault codes are now caught at the time they are generated and returned. Previously a lot of commands could be run even when a fault was active. The conf_general_detect_apply_all_foc returns faults as -100 + fault for display in the foc wizard.

Improve terminal usability by echoing commands and giving feedback on faults and missing / invalid arguments.

Improve flux linkage measurement and using the measured resistance and inductance to set the kp & ki. I also found that increasing the switching frequency helped although not sure exactly if 40khz zvf is allowed on the dual hardwares.

vedderb commented 1 year ago

Nice updates!

I will be away for a few days, then I will start reviewing and testing this.

About dual hardware, it is best to stay at 25 kHz to be safe.

One thing that would be great is if you fix the code indentation. Your updates have spaces for indentation, but all other code has tabs (I'm using a tab width of 4 btw). Most editors can probably choose to use tabs or spaces with some setting, and if you set it to tabs you can select the code you changed and use the auto-indent function to fix it (ctrl+i in eclipse and qt creator). In case you are wondering: vesc tool uses spaces and the firmware uses tabs. Don't ask me why :)

TechAUmNu commented 1 year ago

Thanks, I will put in the vesc tool side tomorrow.

Ok will make it 25 kHz on the dual hardware.

I didn't notice the indentation was using spaces in qt until I committed! Will change it to tabs.

TechAUmNu commented 1 year ago

I think this is now ready to go.

Associated change to display faults in the wizard https://github.com/vedderb/vesc_tool/pull/259