It might be that my current readings are fairly noisy. I did not measure them yet, but in angle mode with foc_current torque mode position is very unstable and wiggles back and forth quite a bit. Changing torque control back to voltage smooths out holding position a lot (which is a surprise to me, as in the docs the foc_current option was supposed to yield best results, but it is probably best for torque control and not for rotational speed I guess), but when I set it for some motion, the sinusoidal floating of velocity around setpoint is still there.
Furthermore on the current thing, my device have very poor chances of actually performing current sense calibration succesfully. It succeds maybe half of tries, other times it tells me that some phases are inverted or missing (despite I don’t actually change anything physically), and around 1 in 5 attempt ends with ‘current too low’ (motor didn’t even move) and initFOC fails, the only way to restore this situation is to power cycle the microcontroller (attempts at reruning motor initFOC function through commander instafails every time). This is however not needed right now, as I suspect I might not need precise torque control yet (or at all).
The more I try settings, the more convoluted and unexpected behavior emerges from this contraption. From time to time, when I get overwhelmed, I nuke everything from the orbit and load a fresh sample code. Now I got this: with motion::velocity and torque::voltage, my motor never gets to the setpoint (velocity is measured on my phone at around 30rpm instead of 33). However, when I downsampled motion by 10, it behaves OK (by that I mean, it floats around setpoint by ~2,5%). The same effect I got when I inserted some Serial.println, that was spamming some variable in the loop() (which, as I measured it with commander (MTT), resulted in around 250us of motion loop time - instead of 58us while containing no println or downsample). I am really curious if these numbers even make any sense, and if so, what can be a cause to such behavior?
Last thing I encountered (it’s a lot, I know) when trying to test things from the ground up; I cannot perform pole pair counting sample. For some reason, in the while loop, where motor should go in small steps in angle_openloop mode, it never even budges while the setpoint angle increases, resulting in 0 angle difference and inf PP error. I do have some mismatch in sensor direction, as I have to set negative velocity to get clockwise (or turntable-wise) direction, it might be part of reason why this doesn’t work, but I have no idea where to change that in software (if possible; I could maybe turn sensor board around, but I don’t know whether this affects it. I tried to turn a magnet around, but it seemingly didn’t make a difference).
@Rosewill2, I did perform a fair bit of experimenting with all PID variables. Turning LPF_velocity.Tf a bit up resulted in damping smallest oscillations (I could even call them ‘audible whine’), but too much resulted in unstable motion. I don’t think this setting could help with my oscillations, which have period of roughly 1Hz.
my most current code