Accelerator pedal dead zone

User avatar
johu
Site Admin
Posts: 5797
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 160 times
Been thanked: 1031 times
Contact:

Re: Accelerator pedal dead zone

Post by johu »

I have finally merged the last pull request but something looks not right:
grafik.png
potnom runs in steps of 1 above 0 and even steps of 5 in regen
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
mane2
Posts: 179
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 20 times
Been thanked: 15 times

Re: Accelerator pedal dead zone

Post by mane2 »

That looks completely wrong. Also the acceleration looks off, as it should be linear. Are you sure it's the right code?

How do you test? Can I replicate that test somehow?

What maxregentravelhz have you set? How about what rotor hz are you passing? If rotor hz is 0, it calcThrottle will return the same value as potnom.

I tested passing 0,0 -> 50,0 and back from 50,0 to 0,0 with increment of 0,25 and results are not in steps of 1 or anything like what you're seeing there. Here's a sample of what calcThrottle() returns (going up to 50% and then down, using params: regentravel=30.0, regenrampstr=19.0 brkmax=-60.0 brknompedal=-60.0, maxregentravelhz = 200)

Code: Select all

throttle 49.000000 potnom 49.000000
throttle 49.250000 potnom 49.250000
throttle 49.500000 potnom 49.500000
throttle 49.750000 potnom 49.750000
throttle 50.000000 potnom 50.000000

throttle 49.750000 potnom 49.750000
throttle 49.500000 potnom 49.500000
throttle 49.250000 potnom 49.250000
throttle 49.000000 potnom 49.000000
throttle 48.750000 potnom 48.750000
throttle 48.500000 potnom 48.500000
throttle 48.250000 potnom 48.068237
throttle 48.000000 potnom 47.466305
throttle 47.750000 potnom 46.708073
throttle 47.500000 potnom 45.810776
throttle 47.250000 potnom 44.796227
throttle 47.000000 potnom 43.691948
throttle 46.750000 potnom 42.532146
throttle 46.500000 potnom 41.358173
I've been running with this code in my car past weekend and it has worked flawlessly. Though, I can't see plot in that precision from the webui. (especially when I barely get signal when running the car :)) But when testing the calcThrottle function (using test_sine), it works like it should - with decimals too.
User avatar
johu
Site Admin
Posts: 5797
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 160 times
Been thanked: 1031 times
Contact:

Re: Accelerator pedal dead zone

Post by johu »

I used this code: https://github.com/jsphuebner/stm32-sine/pull/42
maxregentravelhz=90 (the default) . I used a signal generator with 0.1 Hz saw tooth 0-2V
Will test more later
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
johu
Site Admin
Posts: 5797
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 160 times
Been thanked: 1031 times
Contact:

Re: Accelerator pedal dead zone

Post by johu »

I have stripped the code back down to the basics and it is also quite well drivable. Of course I never had a chance to test yours so can't compare

https://github.com/jsphuebner/stm32-sin ... f2268f195e

It's a simple linear curve, more speed more regentravel until maxregentravelhz is hit
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
mane2
Posts: 179
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 20 times
Been thanked: 15 times

Re: Accelerator pedal dead zone

Post by mane2 »

Ok. That looks simple and easy to understand. Good to get rid of that dead zone with the official firmware too :). Hopefully I made it bit easier for you :)

I agree that my code was bit difficult to read and maybe not as simple as I would liked it to be, but it works very nicely. Thought, just found out that there was a small bug related to increasing the regentravel - it never reached max. Just fixed that to my fork of stm32-sine.

Did you find out what was causing those weird steps in your graph?
Post Reply