Accelerator pedal dead zone

User avatar
muehlpower
Posts: 575
Joined: Fri Oct 11, 2019 10:51 am
Location: Germany Fürstenfeldbruck
Has thanked: 12 times
Been thanked: 103 times

Re: Accelerator pedal dead zone

Post by muehlpower »

That's exactly what I suggested here: viewtopic.php?p=59989#p59989

I named the new parameter "regenRPM", you called it "maxregentravelhz".
User avatar
mane2
Posts: 177
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 20 times
Been thanked: 8 times

Re: Accelerator pedal dead zone

Post by mane2 »

muehlpower wrote: Sat Nov 18, 2023 11:33 am That's exactly what I suggested here: viewtopic.php?p=59989#p59989

I named the new parameter "regenRPM", you called it "maxregentravelhz".
Could be! Though I don't understand that graph. Would be nice to have one line for speed, one for pedal pressed % one for actual throttle % (ranging from maxregen eg -70% to max throttle 100%).
jrbe
Posts: 287
Joined: Mon Jul 03, 2023 3:17 pm
Location: CT, central shoreline, USA
Has thanked: 99 times
Been thanked: 74 times

Re: Accelerator pedal dead zone

Post by jrbe »

Mane2 is focused on the throttle transition at low rpm and has a flat regen over that.
Muehlpower is talking similar but instead of the regen being flat, it tapers regen up with speed.
2 similar but different things that I think would be great additions.
I think you'd have to define a regen low taper speed and regen amount, high regen taper point (max rpm) and regen amount. If you set both low and high regen amounts the same is flat with speed. Could cover both a consistent regen amount and a speed variable regen that way.
User avatar
muehlpower
Posts: 575
Joined: Fri Oct 11, 2019 10:51 am
Location: Germany Fürstenfeldbruck
Has thanked: 12 times
Been thanked: 103 times

Re: Accelerator pedal dead zone

Post by muehlpower »

I don't understand your graphic either. I only do regentravel linearly depending on the speed or RPM, up to an adjustable speed. Above it remains at the set value. This means, as in my graph, if regentravel is set to 50% and regenRPM is set to 100km/h, everything above 100km/h accelerates over 50% pedal travel, and everything below that is regenerated.
At 50km/h acceleration is over 25% and deceleration under 25%. At 2km/h acceleration is over 1%, deceleration under 1%, etc. At any speed, full acceleration is at 100% pedal travel, and at 0% the value set with ofthrotregen is reached. Of course, everyone can choose the values ​​themselves.


you write
"
So I added config parameter for speed (maxregentravelhz) where regen is in full power regentravel is at max. It grows linear when approaching defined speed and it goes to zero only when fully stopped.
......
EDIT: regen % is always at full power - it's only regentravel which gets adjusted. regenrampstr still works. You can see regenrampstr effect in picture where yellow line starts to go closer to 0% after being negative.
"
That's exactly the same, only regen% is of course not always full, but rather the value set with ofthrotregen.
User avatar
mane2
Posts: 177
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 20 times
Been thanked: 8 times

Re: Accelerator pedal dead zone

Post by mane2 »

Ah, now I understand what Muehlpower graph shows. I was reading it wrong, I thought those lines presented different regentravel setting and got confused because of that. It's actually one set of parameter showing how regen and throttle acts on different speeds. Makes sense now.

Seems like it's pretty much the same thing. Just different views of the same idea.

My graph is coming from stm32-sine test class that i modified to print out in csv form and plotted to google sheets directly. I added simple physics simulation for speed and drag, to test difrerent scenarios. X axis is time. It's also missing time and speed. Might need some imagination to read, agreed :)
User avatar
mane2
Posts: 177
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 20 times
Been thanked: 8 times

Re: Accelerator pedal dead zone

Post by mane2 »

My LDU board is acting up badly, throwing overcurrent here and there. Sometimes does not even get going. Web interface shows parameters like 50% of the time.. Got stuck in the middle of the road at least five times. But, I was able to get some feel to it. I think it works pretty good, just need to tune my parameters. Initially I had 25% regentravel, which felt too small. Upped it to 30%. Then wanted to up the regen 70->80%. Then realized I need to up regenrampstr as regen got too heavy on low speeds.

Initially I had 200hz (70 km/h) as maxregentravelhz, which was clearly too much. Dropped it to 120hz which is like 40km/h. That felt better, but I think it could be dropped even more. Maybe 100hz (35km/h) or even bit lower. It clearly requires fine tuning to get the feel right. Especially the combination of regenrampstr, maxregentravelhz and offthrottleregen.

I need to swap that new OI board before doing further testing. Not sure if I can even drive the car to shop, probably need to tow it. It works like 30 seconds per go .. Hopefully swapping the board fixes that issue. It's also minus degrees here and with those summer wheels, I don't feel like driving a lot right now :)

But in summary, I think it works great once you dial in the settings. Not sure if I can test it much more before spring comes. I could do pull request to stm32-sine github repo, and people could test it as well. (I added safety feature to throttle calculation so that throttle % after calculation is never more than throttle % of pedal pressed.)
User avatar
muehlpower
Posts: 575
Joined: Fri Oct 11, 2019 10:51 am
Location: Germany Fürstenfeldbruck
Has thanked: 12 times
Been thanked: 103 times

Re: Accelerator pedal dead zone

Post by muehlpower »

mane2 wrote: Sat Nov 18, 2023 7:15 pm It's actually one set of parameter showing how regen and throttle acts on different speeds. Makes sense now.

Seems like it's pretty much the same thing. Just different views of the same idea.

:)
Exactly. And if you program and test it now, I'll be very excited to see your results.
User avatar
mane2
Posts: 177
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 20 times
Been thanked: 8 times

Re: Accelerator pedal dead zone

Post by mane2 »

Posted my changes (pull request) here https://github.com/jsphuebner/stm32-sine/pull/41

Too much ice and snow currently to test it, but I was able to test it briefly before the snow came and it works nicely.
User avatar
muehlpower
Posts: 575
Joined: Fri Oct 11, 2019 10:51 am
Location: Germany Fürstenfeldbruck
Has thanked: 12 times
Been thanked: 103 times

Re: Accelerator pedal dead zone

Post by muehlpower »

Question to mane2 and johu. In stm32 sine.cpp, brknom is assigned the value of regentavel. Correct?

Code: Select all

Throttle::brknom = Param::GetFloat(Param::regentravel);
In throttle.cpp potnom is calculated. Correct?

Code: Select all

float Throttle::CalcThrottle(float potnom, float pot2nom, bool brkpedal)
{
   float scaledBrkMax = brkpedal ? brknompedal : brkmax;

   //Never reach 0, because that can spin up the motor
   scaledBrkMax = -0.1 + (scaledBrkMax * pot2nom) / 100.0f;

   if (brkpedal)
   {
      potnom = scaledBrkMax;                                                                                                                                                                 
   }
   else if (potnom < brknom)
   {
      potnom -= brknom;
      potnom = -(potnom * scaledBrkMax / brknom);
   }
   else
   {
      potnom -= brknom;
      potnom = 100.0f * potnom / (100.0f - brknom);
   }

   return potnom;
}
Wouldn't it then be easiest to calculate a modified brknom and then use it instead of brknom and leave everything else as is?

like this:

Code: Select all

if (rotorfreq > maxregentravelhz) brknomModified = brknom;
else brknomModified = brknom * rotorfreq / maxregentravelhz;
edit: I see you do it like this brknomModified = brknomdynamic! just more complicated
User avatar
mane2
Posts: 177
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 20 times
Been thanked: 8 times

Re: Accelerator pedal dead zone

Post by mane2 »

Correct for both.

Reason I didn’t do it like that, is because I wanted to have same regentravel/brknom until the car is stopped. If you decrease the brknom while speed decreases, you constantly change the pedal curve and also as brknom, so regen might not be linear. Though it might not be a problem, haven’t tested it that way. I can do some tests with that.
User avatar
muehlpower
Posts: 575
Joined: Fri Oct 11, 2019 10:51 am
Location: Germany Fürstenfeldbruck
Has thanked: 12 times
Been thanked: 103 times

Re: Accelerator pedal dead zone

Post by muehlpower »

Now I see it. You shift brknom up to the value set with regentravel when you accelerate. It then remains at that value until the car stops again and the accelerator pedal is at zero at the same time. That means if you don't come to a complete standstill, you'll have a dead zone again!

I do not like that.
User avatar
mane2
Posts: 177
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 20 times
Been thanked: 8 times

Re: Accelerator pedal dead zone

Post by mane2 »

Think of a situation, where you have off-throttle-regen set -80%. You're going steep downhill quite low speed and you have completely lifted your foot from accelerator. Car regens / brakes heavily. Now when you push accelerator just like 1%, would you want it to go immediately from -80% -> 0%?. No you don't.. Because I tried that and it felt awful. Car suddenly feels like it would accelerate.

With code you posted - on low speed - regentravel is zero or almost zero, this would mean above "kick in the back" would happen every time. It would be very hard to smoothly control the regen/speed.
Aragorn
Posts: 127
Joined: Wed Jan 04, 2023 10:23 am
Has thanked: 5 times
Been thanked: 53 times

Re: Accelerator pedal dead zone

Post by Aragorn »

Most OEM's get around that by ramping regen down with speed, so its not at -80% in the first place. It feels fine, because as the car slows, you need less torque to maintain the same decelleration.
tom91
Posts: 1308
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bristol
Has thanked: 103 times
Been thanked: 216 times

Re: Accelerator pedal dead zone

Post by tom91 »

Aragorn wrote: Mon Dec 11, 2023 3:16 pm Most OEM's get around that by ramping regen down with speed, so its not at -80% in the first place. It feels fine, because as the car slows, you need less torque to maintain the same decelleration.
Just like everyone has been proposing in this thread.
Founder Volt Influx https://www.voltinflux.com/
Webstore: https://citini.com/
User avatar
muehlpower
Posts: 575
Joined: Fri Oct 11, 2019 10:51 am
Location: Germany Fürstenfeldbruck
Has thanked: 12 times
Been thanked: 103 times

Re: Accelerator pedal dead zone

Post by muehlpower »

For me, a pedal that behaves differently depending on what happened before is a NO GO.
User avatar
mane2
Posts: 177
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 20 times
Been thanked: 8 times

Re: Accelerator pedal dead zone

Post by mane2 »

I ran my small simulation with both implementations. To spot the differences, easiest is top copy both to text editor, in different tabs and cycle them.

What happens there is that you press the accelerator from 0% to 50% and then slowly lifting off the pedal until stopped. Then two last values are when car starts rolling down the hill, without accelerator pressed - and then slightly applying throttle.

First one is using this

Code: Select all

float brknomDynamic = MIN(brknom * rotorfreq / maxregentravelhz, brknom);

Code: Select all

Params: regentravel=30.000000, regenrampstr=50.000000  brkmax=-90.00 brknompedal=-90.00
regentravel 0 	km/h: 0 	hz: 000.0	pedal: 0.0%	potnom: 0.0
regentravel 0 	km/h: 3 	hz: 000.0	pedal: 10.0%	potnom: 10.0
regentravel 3 	km/h: 8 	hz: 008.6	pedal: 20.0%	potnom: 17.7
regentravel 8 	km/h: 15 	hz: 023.6	pedal: 30.0%	potnom: 24.0
regentravel 15 	km/h: 24 	hz: 044.0	pedal: 40.0%	potnom: 29.7
regentravel 23 	km/h: 34 	hz: 068.7	pedal: 50.0%	potnom: 35.1
regentravel 30 	km/h: 41 	hz: 097.1	pedal: 50.0%	potnom: 28.6
regentravel 30 	km/h: 47 	hz: 118.3	pedal: 48.0%	potnom: 25.7
regentravel 30 	km/h: 52 	hz: 135.4	pedal: 46.0%	potnom: 22.9
regentravel 30 	km/h: 55 	hz: 148.5	pedal: 44.0%	potnom: 20.0
regentravel 30 	km/h: 57 	hz: 157.9	pedal: 42.0%	potnom: 17.1
regentravel 30 	km/h: 58 	hz: 163.8	pedal: 40.0%	potnom: 14.3
regentravel 30 	km/h: 58 	hz: 166.6	pedal: 38.0%	potnom: 11.4
regentravel 30 	km/h: 58 	hz: 166.7	pedal: 36.0%	potnom: 8.6
regentravel 30 	km/h: 56 	hz: 164.3	pedal: 34.0%	potnom: 5.7
regentravel 30 	km/h: 54 	hz: 159.7	pedal: 32.0%	potnom: 2.9
regentravel 30 	km/h: 51 	hz: 153.2	pedal: 30.0%	potnom: 0.0
regentravel 30 	km/h: 48 	hz: 145.0	pedal: 28.0%	potnom: -6.0
regentravel 30 	km/h: 45 	hz: 136.3	pedal: 26.0%	potnom: -12.0
regentravel 30 	km/h: 41 	hz: 127.2	pedal: 24.0%	potnom: -18.0
regentravel 30 	km/h: 38 	hz: 117.7	pedal: 22.0%	potnom: -24.0
regentravel 30 	km/h: 34 	hz: 107.7	pedal: 20.0%	potnom: -30.0
regentravel 30 	km/h: 30 	hz: 097.2	pedal: 18.0%	potnom: -36.0
regentravel 29 	km/h: 26 	hz: 086.2	pedal: 16.0%	potnom: -39.9
regentravel 25 	km/h: 23 	hz: 075.0	pedal: 14.0%	potnom: -39.7
regentravel 22 	km/h: 19 	hz: 064.6	pedal: 12.0%	potnom: -39.9
regentravel 18 	km/h: 16 	hz: 054.6	pedal: 10.0%	potnom: -40.6
regentravel 15 	km/h: 13 	hz: 044.9	pedal: 8.0%	potnom: -37.6
regentravel 12 	km/h: 10 	hz: 036.1	pedal: 6.0%	potnom: -32.6
regentravel 10 	km/h: 8 	hz: 028.7	pedal: 4.0%	potnom: -30.0
regentravel 7 	km/h: 5 	hz: 022.0	pedal: 2.0%	potnom: -28.8
regentravel 5 	km/h: 3 	hz: 015.6	pedal: 0.0%	potnom: -28.2
regentravel 3 	km/h: 2 	hz: 009.5	pedal: 0.0%	potnom: -17.2
regentravel 2 	km/h: 1 	hz: 005.8	pedal: 0.0%	potnom: -10.5
regentravel 1 	km/h: 1 	hz: 003.6	pedal: 0.0%	potnom: -6.4
regentravel 1 	km/h: 0 	hz: 002.2	pedal: 0.0%	potnom: -3.9
regentravel 5 	km/h: 3 	hz: 014.3	pedal: 0.0%	potnom: -25.7
regentravel 19 	km/h: 15 	hz: 057.0	pedal: 5.0%	potnom: -66.4
regentravel 29 	km/h: 25 	hz: 085.6	pedal: 10.0%	potnom: -58.5
Second one is using fixed regentravel until car is stopped:

Code: Select all

Params: regentravel=30.000000, regenrampstr=50.000000  brkmax=-90.00 brknompedal=-90.00
regentravel 0 	km/h: 0 	hz: 000.0	pedal: 0.0%	potnom: 0.0
regentravel 0 	km/h: 3 	hz: 000.0	pedal: 10.0%	potnom: 10.0
regentravel 3 	km/h: 8 	hz: 008.6	pedal: 20.0%	potnom: 17.7
regentravel 8 	km/h: 15 	hz: 023.6	pedal: 30.0%	potnom: 24.0
regentravel 15 	km/h: 24 	hz: 044.0	pedal: 40.0%	potnom: 29.7
regentravel 23 	km/h: 34 	hz: 068.7	pedal: 50.0%	potnom: 35.1
regentravel 30 	km/h: 41 	hz: 097.1	pedal: 50.0%	potnom: 28.6
regentravel 30 	km/h: 47 	hz: 118.3	pedal: 48.0%	potnom: 25.7
regentravel 30 	km/h: 52 	hz: 135.4	pedal: 46.0%	potnom: 22.9
regentravel 30 	km/h: 55 	hz: 148.5	pedal: 44.0%	potnom: 20.0
regentravel 30 	km/h: 57 	hz: 157.9	pedal: 42.0%	potnom: 17.1
regentravel 30 	km/h: 58 	hz: 163.8	pedal: 40.0%	potnom: 14.3
regentravel 30 	km/h: 58 	hz: 166.6	pedal: 38.0%	potnom: 11.4
regentravel 30 	km/h: 58 	hz: 166.7	pedal: 36.0%	potnom: 8.6
regentravel 30 	km/h: 56 	hz: 164.3	pedal: 34.0%	potnom: 5.7
regentravel 30 	km/h: 54 	hz: 159.7	pedal: 32.0%	potnom: 2.9
regentravel 30 	km/h: 51 	hz: 153.2	pedal: 30.0%	potnom: 0.0
regentravel 30 	km/h: 48 	hz: 145.0	pedal: 28.0%	potnom: -6.0
regentravel 30 	km/h: 45 	hz: 136.3	pedal: 26.0%	potnom: -12.0
regentravel 30 	km/h: 41 	hz: 127.2	pedal: 24.0%	potnom: -18.0
regentravel 30 	km/h: 38 	hz: 117.7	pedal: 22.0%	potnom: -24.0
regentravel 30 	km/h: 34 	hz: 107.7	pedal: 20.0%	potnom: -30.0
regentravel 30 	km/h: 30 	hz: 097.2	pedal: 18.0%	potnom: -36.0
regentravel 30 	km/h: 26 	hz: 086.2	pedal: 16.0%	potnom: -42.0
regentravel 30 	km/h: 23 	hz: 075.0	pedal: 14.0%	potnom: -48.1
regentravel 30 	km/h: 19 	hz: 064.6	pedal: 12.0%	potnom: -54.1
regentravel 30 	km/h: 16 	hz: 054.6	pedal: 10.0%	potnom: -60.1
regentravel 30 	km/h: 13 	hz: 044.9	pedal: 8.0%	potnom: -59.3
regentravel 30 	km/h: 10 	hz: 036.1	pedal: 6.0%	potnom: -52.1
regentravel 30 	km/h: 8 	hz: 028.7	pedal: 4.0%	potnom: -44.8
regentravel 30 	km/h: 5 	hz: 022.0	pedal: 2.0%	potnom: -36.9
regentravel 30 	km/h: 3 	hz: 015.6	pedal: 0.0%	potnom: -28.2
regentravel 30 	km/h: 2 	hz: 009.5	pedal: 0.0%	potnom: -17.2
regentravel 30 	km/h: 1 	hz: 005.8	pedal: 0.0%	potnom: -10.5
regentravel 30 	km/h: 1 	hz: 003.6	pedal: 0.0%	potnom: -6.4
regentravel 30 	km/h: 0 	hz: 002.2	pedal: 0.0%	potnom: -3.9
regentravel 30 	km/h: 3 	hz: 014.3	pedal: 0.0%	potnom: -25.7
regentravel 30 	km/h: 15 	hz: 057.0	pedal: 5.0%	potnom: -75.1
regentravel 30 	km/h: 25 	hz: 085.6	pedal: 10.0%	potnom: -60.1
I agree that what muehlpower proposed, is way more simple way to do it, and works very well too. Only difference here is that you get stronger regen with the fixed regentravel and more control for regen but also you need to push bit more on the accelerator to get going again. Both implementations have their advantages.
User avatar
mane2
Posts: 177
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 20 times
Been thanked: 8 times

Re: Accelerator pedal dead zone

Post by mane2 »

Here's a side by side output for easier reading. potnom1 = "speed based regentravel" and potnom2 = "fixed (only increasing) regentravel until stopped".

In this output, first line shows car doing 67kmh and lifting off the pedal slowly. When the speed slows down to 24kmh, you start to see differences. "pedal" showing the percentage of pedal pressed. hz just show the rotor frequency, for easier tracking when "regen ramping down" (regenrampstr) start to have effect.

Code: Select all

Params: regentravel=30.000000, regenrampstr=50.000000  brkmax=-90.00 brknompedal=-90.00

km/h: 67 	hz: 187.5	pedal: 42.0%	potnom1: 17.1	potnom2:  17.1
km/h: 66 	hz: 189.9	pedal: 40.0%	potnom1: 14.3	potnom2:  14.3
km/h: 65 	hz: 189.4	pedal: 38.0%	potnom1: 11.4	potnom2:  11.4
km/h: 64 	hz: 186.6	pedal: 36.0%	potnom1: 8.6	potnom2:  8.6
km/h: 61 	hz: 181.8	pedal: 34.0%	potnom1: 5.7	potnom2:  5.7
km/h: 58 	hz: 175.1	pedal: 32.0%	potnom1: 2.9	potnom2:  2.9
km/h: 55 	hz: 166.8	pedal: 30.0%	potnom1: 0.0	potnom2:  0.0
km/h: 52 	hz: 157.0	pedal: 28.0%	potnom1: -6.0	potnom2:  -6.0
km/h: 48 	hz: 147.1	pedal: 26.0%	potnom1: -12.0	potnom2:  -12.0
km/h: 44 	hz: 136.9	pedal: 24.0%	potnom1: -18.0	potnom2:  -18.0
km/h: 41 	hz: 126.5	pedal: 22.0%	potnom1: -24.0	potnom2:  -24.0
km/h: 37 	hz: 115.8	pedal: 20.0%	potnom1: -30.0	potnom2:  -30.0
km/h: 33 	hz: 104.6	pedal: 18.0%	potnom1: -36.0	potnom2:  -36.0
km/h: 28 	hz: 093.1	pedal: 16.0%	potnom1: -42.0	potnom2:  -42.0
km/h: 24 	hz: 081.1	pedal: 14.0%	potnom1: -43.4	potnom2:  -48.1
km/h: 19 	hz: 068.5	pedal: 12.0%	potnom1: -42.7	potnom2:  -54.1
km/h: 14 	hz: 055.3	pedal: 10.0%	potnom1: -41.2	potnom2:  -60.1

-  regenrampstr starts to decrease regen linearly after this point (50hz)  -
      
km/h: 10 	hz: 041.3	pedal: 8.0%	potnom1: -31.2	potnom2:  -54.6
km/h: 7 	hz: 029.1	pedal: 6.0%	potnom1: -19.9	potnom2:  -41.9
km/h: 5 	hz: 019.8	pedal: 4.0%	potnom1: -14.1	potnom2:  -30.9
km/h: 3 	hz: 013.0	pedal: 2.0%	potnom1: -12.7	potnom2:  -21.9
km/h: 2 	hz: 008.3	pedal: 0.0%	potnom1: -14.9	potnom2:  -14.9
km/h: 1 	hz: 005.1	pedal: 0.0%	potnom1: -9.1	potnom2:  -9.1
km/h: 1 	hz: 003.1	pedal: 0.0%	potnom1: -5.6	potnom2:  -5.6
km/h: 0 	hz: 001.9	pedal: 0.0%	potnom1: -3.4	potnom2:  -3.4
km/h: 0 	hz: 001.2	pedal: 0.0%	potnom1: -2.1	potnom2:  -2.1
km/h: 3 	hz: 014.3	pedal: 0.0%	potnom1: -25.7	potnom2:  -25.7
km/h: 14 	hz: 057.0	pedal: 5.0%	potnom1: -66.4	potnom2:  -75.1
km/h: 25 	hz: 085.6	pedal: 10.0%	potnom1: -58.5	potnom2:  -60.1
km/h: 22 	hz: 070.1	pedal: 20.0%	potnom1: -13.0	potnom2:  -30.0
km/h: 18 	hz: 062.0	pedal: 15.0%	potnom1: -24.7	potnom2:  -45.0
km/h: 18 	hz: 051.0	pedal: 30.0%	potnom1: 15.7	potnom2:  0.0
Potnom2 gives you stronger regen on slower speeds and more control over as regentravel stays at 30%.
Potnom1 is more linear, as the regentravel shrinks by speed, thus making slow speed regen bit lighter. This can be a good thing, as it seems that numbers decrease more linearly, and it's harder to notice the regenrampstr taking effect.

I like the simplicity of the potnom1 and also the fact that on slow speeds, accelerator goes faster on the throttle side. But it remains to be tested, which feels better in real life. I think there will be difference also in what people prefer. If you like how ICE cars act, you might not like strong low speed regen. In that case, the potnom1 version is probably for you. For more EV style and stronger regen on low speeds, potnom2 -version might feel better.

I flashed the "potnom1" version to my car now. Got my LDU working again too, but unfortunately there is ice and snow out there and with summer tires, there is no business to do any driving. So I can't really say which one feels better yet :)

Would be nice to have both implementations in firmware and you could switch the version from web interface parameters. Should I do pull request for that? Would that be interesting? There could be 3 versions. One for the original implementation (with dead zone) and these two different ones.
User avatar
muehlpower
Posts: 575
Joined: Fri Oct 11, 2019 10:51 am
Location: Germany Fürstenfeldbruck
Has thanked: 12 times
Been thanked: 103 times

Re: Accelerator pedal dead zone

Post by muehlpower »

If you set the maxregentravelhz to zero in potnom1 version, you will automatically get the behavior you have now, with dead zone, since rotorfreq is always larger maxregentravelhz, and thus potnom remains unchanged. So you don't need 3 versions.

In your table you don't take into account the case where you only want to decelerate to 3km/h and then accelerate again. That's where the biggest difference will be and it will feel like a lot of dead zone. The car reacts completely differently depending on whether you have come to a standstill or only decelerated up to 1km/h.
User avatar
mane2
Posts: 177
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 20 times
Been thanked: 8 times

Re: Accelerator pedal dead zone

Post by mane2 »

Yes, that's true. Basically only two to choose from. My point was just to have an option to select implementations.

I have that case covered, look at the bottom of the table. There you're going 3km/h without accelerator pressed and then next row shows situation when you press accelerator 5%.

Code: Select all

km/h: 3 	hz: 014.3	pedal: 0.0%	potnom1: -25.7	potnom2:  -25.7
km/h: 14 	hz: 057.0	pedal: 5.0%	potnom1: -66.4	potnom2:  -75.1
I agree, that is exactly where there difference is. There is more dead zone if you are in regenrampstr "zone" where regen is basically close to zero. That might feel like dead zone, that's true. Even though not as bad as the initial dead zone. Initial dead zone is the most annoying, as you don't know if you are "in gear" or not.

Maybe it might be best to have the speed based version only, without the fixed regentravel when decelerating. I like the simplicity of it. Maybe it's best compromise of everything. I feel I have tested all possible different approaches :D
User avatar
mane2
Posts: 177
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 20 times
Been thanked: 8 times

Re: Accelerator pedal dead zone

Post by mane2 »

I started playing with the idea of ramping down regentravel on "potnom2" -version, when rotor hz hits the regenrampstr hz. This way, you can utilize the regen area further than just speed based, and still have strong regen if wanted. I experimented few curves, like expoOut and results are interesting!

So, when accelerating, regentravel area grows exactly the same way, linearly on both implementations. But when slowing down, you can see the benefit.

This is linear speed based regentravel version (aka potnom1)

Code: Select all

regentravel 30 	km/h: 31 	hz: 096.0	pedal: 21.0% 	potnom: -18.0
regentravel 30 	km/h: 29 	hz: 088.9	pedal: 19.0% 	potnom: -21.6
regentravel 27 	km/h: 26 	hz: 081.5	pedal: 17.0% 	potnom: -22.5
regentravel 25 	km/h: 24 	hz: 074.4	pedal: 15.0% 	potnom: -23.7
regentravel 22 	km/h: 21 	hz: 067.4	pedal: 13.0% 	potnom: -25.3
regentravel 20 	km/h: 19 	hz: 060.4	pedal: 11.0% 	potnom: -27.2
regentravel 18 	km/h: 16 	hz: 053.3	pedal: 9.0% 	potnom: -29.6
regentravel 15 	km/h: 13 	hz: 045.9	pedal: 7.0% 	potnom: -32.6
regentravel 13 	km/h: 11 	hz: 038.2	pedal: 5.0% 	potnom: -34.9
regentravel 10 	km/h: 8 	hz: 030.2	pedal: 3.0% 	potnom: -31.9
regentravel 8 	km/h: 6 	hz: 023.1	pedal: 1.0% 	potnom: -30.2
regentravel 5 	km/h: 4 	hz: 016.4	pedal: 0.0% 	potnom: -24.7
regentravel 4 	km/h: 3 	hz: 011.1	pedal: 0.0% 	potnom: -16.6
regentravel 2 	km/h: 2 	hz: 007.5	pedal: 0.0% 	potnom: -11.2
regentravel 2 	km/h: 1 	hz: 005.0	pedal: 0.0% 	potnom: -7.6

	- slight acceleration when almost standsill below - 

regentravel 1 	km/h: 1 	hz: 003.4	pedal: 2.0% 	potnom: 0.9
regentravel 1 	km/h: 2 	hz: 004.2	pedal: 4.0% 	potnom: 2.7
regentravel 2 	km/h: 3 	hz: 006.4	pedal: 6.0% 	potnom: 3.9
regentravel 3 	km/h: 5 	hz: 009.8	pedal: 8.0% 	potnom: 4.9
regentravel 5 	km/h: 7 	hz: 013.9	pedal: 10.0% 	potnom: 5.6
and here is version that ramps down regentravel with a expoOut curve:

Code: Select all

regentravel 30 	km/h: 31 	hz: 096.0	pedal: 21.0% 	potnom: -18.0
regentravel 30 	km/h: 29 	hz: 088.9	pedal: 19.0% 	potnom: -22.0
regentravel 30 	km/h: 26 	hz: 081.4	pedal: 17.0% 	potnom: -26.0
regentravel 30 	km/h: 23 	hz: 073.6	pedal: 15.0% 	potnom: -30.0
regentravel 30 	km/h: 20 	hz: 065.2	pedal: 13.0% 	potnom: -34.1
regentravel 30 	km/h: 17 	hz: 056.5	pedal: 11.0% 	potnom: -38.1
regentravel 30 	km/h: 13 	hz: 047.2	pedal: 9.0% 	potnom: -42.1
regentravel 30 	km/h: 10 	hz: 037.4	pedal: 7.0% 	potnom: -43.1
regentravel 30 	km/h: 7 	hz: 027.7	pedal: 5.0% 	potnom: -34.6
regentravel 29 	km/h: 5 	hz: 020.0	pedal: 3.0% 	potnom: -27.0
regentravel 27 	km/h: 3 	hz: 014.1	pedal: 1.0% 	potnom: -20.4
regentravel 24 	km/h: 2 	hz: 009.7	pedal: 0.0% 	potnom: -14.5
regentravel 20 	km/h: 2 	hz: 006.5	pedal: 0.0% 	potnom: -9.8
regentravel 16 	km/h: 1 	hz: 004.4	pedal: 0.0% 	potnom: -6.6

	- slight acceleration when almost standsill below - 

regentravel 12 	km/h: 1 	hz: 003.0	pedal: 2.0% 	potnom: -3.8
regentravel 9 	km/h: 1 	hz: 002.2	pedal: 4.0% 	potnom: -1.9
regentravel 8 	km/h: 1 	hz: 001.8	pedal: 6.0% 	potnom: -0.7
regentravel 7 	km/h: 1 	hz: 001.6	pedal: 8.0% 	potnom: 0.6
regentravel 7 	km/h: 2 	hz: 002.2	pedal: 10.0% 	potnom: 2.8
This second version - using curve - is smoother and giving stronger regen and more control on low speeds. Regen hits -43 on this second version where on the linear speed based version, it only hits -34.

Different curves can be applied. This expoOut is quite extreme, and regentravel goes to zero only at the very end but makes a good example. Attached different curves for ramping down the regentravel. Those curves ending with Out work the best here.
Attachments
curve-types.png
User avatar
mane2
Posts: 177
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 20 times
Been thanked: 8 times

Re: Accelerator pedal dead zone

Post by mane2 »

I was bothered by the fact of that non-linear acceleration - as increasing regentravel creates this slope. I think different OEM cars have done this differently. For example BMW seems to have done this "slope" way (non-linear) but I feel Tesla has linear.

I combined the speed based regen with my previous code where I tracked pedal history. So acceleration is linear until you start to lift. When lifting, regentravel gets created. This way, you can have linear feel when accelerating, and creating that regen-slope happens where you don't notice it. I also ended up removing that curve that I mentioned above, as it's effect was actually minimal.

Here's how it works:

Code: Select all

Params: regentravel=30.000000, regenrampstr=40.000000  brkmax=-60.00 brknompedal=-60.00
regentravel 0 	km/h: 0 	hz: 000.0	pedal: 0.0% 	potnom: 0.0
regentravel 0 	km/h: 4 	hz: 011.4	pedal: 10.0% 	potnom: 10.0
regentravel 0 	km/h: 12 	hz: 034.2	pedal: 20.0% 	potnom: 20.0
regentravel 0 	km/h: 24 	hz: 068.0	pedal: 30.0% 	potnom: 30.0
regentravel 0 	km/h: 39 	hz: 112.0	pedal: 40.0% 	potnom: 40.0
regentravel 0 	km/h: 58 	hz: 164.7	pedal: 50.0% 	potnom: 50.0
regentravel 0 	km/h: 78 	hz: 223.6	pedal: 60.0% 	potnom: 60.0
regentravel 0 	km/h: 100 	hz: 285.9	pedal: 70.0% 	potnom: 70.0
regentravel 0 	km/h: 122 	hz: 348.5	pedal: 80.0% 	potnom: 80.0
regentravel 0 	km/h: 143 	hz: 408.6	pedal: 90.0% 	potnom: 90.0
regentravel 0 	km/h: 163 	hz: 464.2	pedal: 100.0% 	potnom: 100.0
regentravel 0 	km/h: 172 	hz: 491.3	pedal: 90.0% 	potnom: 90.0
regentravel 0 	km/h: 175 	hz: 497.9	pedal: 80.0% 	potnom: 80.0
regentravel 3 	km/h: 172 	hz: 489.8	pedal: 70.0% 	potnom: 69.1
regentravel 18 	km/h: 163 	hz: 464.1	pedal: 60.0% 	potnom: 51.2
regentravel 30 	km/h: 148 	hz: 421.2	pedal: 50.0% 	potnom: 28.6
regentravel 30 	km/h: 132 	hz: 375.3	pedal: 40.0% 	potnom: 14.3
regentravel 30 	km/h: 114 	hz: 325.9	pedal: 30.0% 	potnom: 0.0
regentravel 30 	km/h: 99 	hz: 283.0	pedal: 20.0% 	potnom: -20.0
regentravel 30 	km/h: 85 	hz: 243.5	pedal: 10.0% 	potnom: -40.1
regentravel 30 	km/h: 72 	hz: 205.5	pedal: 0.0% 	potnom: -60.1
regentravel 30 	km/h: 61 	hz: 173.6	pedal: 0.0% 	potnom: -60.1
regentravel 30 	km/h: 51 	hz: 145.9	pedal: 0.0% 	potnom: -60.1
regentravel 30 	km/h: 43 	hz: 121.3	pedal: 0.0% 	potnom: -60.1
regentravel 30 	km/h: 35 	hz: 099.0	pedal: 0.0% 	potnom: -60.1
regentravel 30 	km/h: 27 	hz: 078.4	pedal: 0.0% 	potnom: -60.1
regentravel 30 	km/h: 21 	hz: 059.1	pedal: 0.0% 	potnom: -60.1
regentravel 30 	km/h: 14 	hz: 040.7	pedal: 0.0% 	potnom: -60.1
regentravel 30 	km/h: 8 	hz: 023.0	pedal: 0.0% 	potnom: -34.6
regentravel 17 	km/h: 2 	hz: 005.7	pedal: 0.0% 	potnom: -8.5
regentravel 4 	km/h: 0 	hz: 000.0	pedal: 0.0% 	potnom: -0.0
regentravel 0 	km/h: 2 	hz: 005.7	pedal: 5.0% 	potnom: 5.0
regentravel 0 	km/h: 4 	hz: 011.4	pedal: 5.0% 	potnom: 5.0
regentravel 0 	km/h: 6 	hz: 017.1	pedal: 5.0% 	potnom: 5.0
regentravel 0 	km/h: 10 	hz: 028.4	pedal: 10.0% 	potnom: 10.0
regentravel 0 	km/h: 18 	hz: 050.9	pedal: 20.0% 	potnom: 20.0
And for comparison, this is speed based regen.

Code: Select all

Params: regentravel=30.000000, regenrampstr=40.000000  brkmax=-60.00 brknompedal=-60.00
regentravel 0 	km/h: 0 	hz: 000.0	pedal: 0.0% 	potnom: 0.0
regentravel 0 	km/h: 4 	hz: 011.4	pedal: 10.0% 	potnom: 10.0
regentravel 4 	km/h: 11 	hz: 030.6	pedal: 20.0% 	potnom: 16.8
regentravel 10 	km/h: 19 	hz: 055.4	pedal: 30.0% 	potnom: 22.1
regentravel 18 	km/h: 30 	hz: 084.5	pedal: 40.0% 	potnom: 26.4
regentravel 28 	km/h: 41 	hz: 116.6	pedal: 50.0% 	potnom: 30.4
regentravel 30 	km/h: 56 	hz: 160.8	pedal: 60.0% 	potnom: 42.9
regentravel 30 	km/h: 76 	hz: 216.9	pedal: 70.0% 	potnom: 57.1
regentravel 30 	km/h: 99 	hz: 281.9	pedal: 80.0% 	potnom: 71.4
regentravel 30 	km/h: 123 	hz: 351.8	pedal: 90.0% 	potnom: 85.7
regentravel 30 	km/h: 148 	hz: 422.5	pedal: 100.0% 	potnom: 100.0
regentravel 30 	km/h: 160 	hz: 457.7	pedal: 90.0% 	potnom: 85.7
regentravel 30 	km/h: 163 	hz: 465.7	pedal: 80.0% 	potnom: 71.4
regentravel 30 	km/h: 159 	hz: 454.9	pedal: 70.0% 	potnom: 57.1
regentravel 30 	km/h: 151 	hz: 431.2	pedal: 60.0% 	potnom: 42.9
regentravel 30 	km/h: 140 	hz: 398.6	pedal: 50.0% 	potnom: 28.6
regentravel 30 	km/h: 126 	hz: 359.2	pedal: 40.0% 	potnom: 14.3
regentravel 30 	km/h: 110 	hz: 314.0	pedal: 30.0% 	potnom: 0.0
regentravel 30 	km/h: 96 	hz: 273.7	pedal: 20.0% 	potnom: -20.0
regentravel 30 	km/h: 83 	hz: 236.0	pedal: 10.0% 	potnom: -40.1
regentravel 30 	km/h: 70 	hz: 199.3	pedal: 0.0% 	potnom: -60.1
regentravel 30 	km/h: 59 	hz: 168.3	pedal: 0.0% 	potnom: -60.1
regentravel 30 	km/h: 50 	hz: 141.2	pedal: 0.0% 	potnom: -60.1
regentravel 30 	km/h: 41 	hz: 117.1	pedal: 0.0% 	potnom: -60.1
regentravel 30 	km/h: 33 	hz: 095.1	pedal: 0.0% 	potnom: -60.1
regentravel 30 	km/h: 26 	hz: 074.8	pedal: 0.0% 	potnom: -60.1
regentravel 25 	km/h: 20 	hz: 055.7	pedal: 0.0% 	potnom: -60.1
regentravel 19 	km/h: 13 	hz: 037.5	pedal: 0.0% 	potnom: -56.3
regentravel 12 	km/h: 7 	hz: 019.8	pedal: 0.0% 	potnom: -29.8
regentravel 7 	km/h: 1 	hz: 002.6	pedal: 0.0% 	potnom: -3.8
regentravel 1 	km/h: 0 	hz: 000.0	pedal: 0.0% 	potnom: -0.0
regentravel 0 	km/h: 2 	hz: 005.7	pedal: 5.0% 	potnom: 5.0
regentravel 2 	km/h: 3 	hz: 009.3	pedal: 5.0% 	potnom: 3.2
regentravel 3 	km/h: 4 	hz: 011.5	pedal: 5.0% 	potnom: 2.0
regentravel 4 	km/h: 7 	hz: 018.8	pedal: 10.0% 	potnom: 6.4
regentravel 6 	km/h: 12 	hz: 035.4	pedal: 20.0% 	potnom: 14.7
Big difference here is linearly increasing throttle (potnom) and stronger regen on slow speeds (see 25km/h potnom on both).

I feel this might be it. Any thoughts, worries or comments?
User avatar
mane2
Posts: 177
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 20 times
Been thanked: 8 times

Re: Accelerator pedal dead zone

Post by mane2 »

Same examples with graphs.

Notice the yellow line (potnom) in speed based image, potnom grows pretty awkwardly and non-linear fashion. You will feel that at some point the acceleration picks up quite quickly, when regentravel has grown to full.

Also notice the blue line (regentravel), for example around time 29s. In speed based you have just few percentages of regentravel to control low speed regen compared to other graph, where you have stronger regen lower speeds and more control over it.

Here's the one with regentravel growing when lifting accelerator and decreasing regentravel linearly when hitting regenrampstr (hz).
linear_liftoff_regentravel.png
Here's the version with just speed based regentravel.
speedbased_regentravel.png
Parameters: Regentravel 30%, regenrampstr 40hz, brkmax & brknompedal -60%.

With latest stm32-sine release (v5.32.R), blue line would be at 30% constantly and pressing accelerator the first 30% of travel, would give you negative or 0 potnom and potnom would grow and decrease linearly after that.
User avatar
mane2
Posts: 177
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 20 times
Been thanked: 8 times

Re: Accelerator pedal dead zone

Post by mane2 »

Just flashed this to my LDU and tested it in garage. Car is sitting on jacks, but wheels turn, throttle commands and plot looks very good. It's working nicely! Road testing it more when this snow melts and roads dry up.

Created pull request here: https://github.com/jsphuebner/stm32-sine/pull/42
User avatar
mane2
Posts: 177
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 20 times
Been thanked: 8 times

Re: Accelerator pedal dead zone

Post by mane2 »

Attached a plot from my test.

Not related to code changes - but if you're wondering - wheel start rotating only when potnom is higher than 6%. I've tried to overcome this by increasing ampmin to 18. But increasing that closer to 20, it starts to accelerate by iteself .. so I had to tune it down from there. Not sure if this is a issue for everyone, or just me? So even with zero deadzone code, it requires some 5% pedal pressing before anything happens. I'ld like to get rid of that if possible..?
Attachments
plot.png
User avatar
mane2
Posts: 177
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 20 times
Been thanked: 8 times

Re: Accelerator pedal dead zone

Post by mane2 »

Snow & ice has finally melted from the roads so I was able to take the first drive and properly test that throttle/regen code (https://github.com/jsphuebner/stm32-sine/pull/42/files). It works beautifully!

Didn't drive too many kilometers yet, but the feel is very good. I would even say it's better than in my daily electric BMW in B mode. That's because it accelerates linearly and creates the regen area (regentravel) only when easing up the pedal - and there you don't notice it. With BMW on slow speeds you can feel that regen area is constantly being adjusted and it "eats" the power from initial pedal travel until it reaches full regentravel and also causes bit weird feel on the pedal as all the sudden you get more power from same pedal travel (after reaching regentravel). If you drive BMW in D mode, it's linear and feel is way better but unfortunately I want 1-pedal drive and no creep. I need this in my BMW as well :D More testing tomorrow.
Post Reply