PX4 / sapog

Sapog - advanced multiplatform ESC firmware
https://kb.zubax.com/x/cYAh
BSD 3-Clause "New" or "Revised" License
204 stars 142 forks source link

esc_setpoint_raw is offset from rpm feedback. #29

Closed keenanjohnson closed 6 years ago

keenanjohnson commented 6 years ago

I've noticed that in the PX4 logs of the sapog motor driver firmware, the esc_rpm and esc_setpoint_raw seem to be off by some set factor.

Does anyone know why that might be?

image

pavel-kirienko commented 6 years ago

Please make sure that the number of poles is configured correctly.

keenanjohnson commented 6 years ago

I've confirmed that this is the case. This test data comes from this motor: http://store-en.tmotor.com/goods.php?id=353 which is listed as 22 poles. That's what I have configured in the parameters.

pavel-kirienko commented 6 years ago

Assuming that you're using the default PWM frequency of 60 kHz, the maximum mechanical speed for your motor is 6900 RPM, which seems to be compatible with your application (judging by the graphs). So I would suggest making sure that the PID controller is configured properly. You can use the CLI to command the motor a particular speed and observe how quickly it is reached. The speed can be plotted using the UAVCAN GUI Tool.

keenanjohnson commented 6 years ago

Why would that affect the rpm feedback reading?

pavel-kirienko commented 6 years ago

I am suspecting that the reading is correct, and the divergence is caused by the ESC not reaching the speed setpoint due to misconfigured RPM PID controller.

keenanjohnson commented 6 years ago

What sort of parameters would cause that?

We've verified that our feedback is correct via an external tachometer. So we're confused why the setpoint is so much higher still.

pavel-kirienko commented 6 years ago

Seems like the integral gain is zero. Check the value of rpmctl_i please. You could also dump all configuration parameters here so we could have a look.