I want to make better quality sensing current for better detection.
I bet the most important will be better controll quality, but with what
methods I can improve my controll loop? I’m using stm32g4
Have you checked the documentation ?
Have you searched in the forum ?
What is your problem ? Be precise and informative about it.
What have you already tried ?
What is your end goal ? Do we have to guess based on the picture ?
Are you using a custom board ?
2 or 3 shunts/phase currents ?
Inline or low side sensing ?
If you want to interpret the current like shown in the picture, this is possible, I think. The getDCCurrent() function will return a number corresponding to (but probably not equal to) the bus current, it will generally be a positive quantity.
You can filter this, for example using our low-pass filter class.
And then you can apply a threshold detection to convert the signal into a boolean value - collision true/false.
Is this what you’re trying to achieve?
Note that motor stalls (e.g. the rug got wound up in the wheel) and sudden up-hill movement may also register as “collisions” with this detection scheme…