Accelerator pedal dead zone

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 »

Some tweaks to regen calculation that I did for my branch of stm32-sine.

Added check for rpm, so when rpm is zero and you don't press the pedal, regenZone resets (regentravel disabled). Also added example output how potnom gets ramped with throtramp = 5. And usually it's always ramped, just added example for the most extreme drop to make it more clear what happens in reality.

Here's how it works when driving, when regentravel set to 30 and offthrottleregen to -100

Code: Select all

pedal: 0% potnom: 0.000000
pedal: 2% potnom: 2.000000
pedal: 4% potnom: 4.000000
pedal: 6% potnom: 6.000000
pedal: 8% potnom: 8.000000
pedal: 10% potnom: 10.000000
pedal: 12% potnom: 12.000000
pedal: 14% potnom: 14.000000
pedal: 16% potnom: 16.000000
pedal: 18% potnom: 18.000000
pedal: 20% potnom: 20.000000
pedal: 22% potnom: 22.000000
pedal: 24% potnom: 24.000000
pedal: 26% potnom: 26.000000
pedal: 28% potnom: 28.000000
pedal: 30% potnom: 30.000000
pedal: 32% potnom: 32.000000
pedal: 34% potnom: 34.000000
pedal: 35% potnom: 35.000000 ramped (5): 35.000000

Starts lifting off the accelerator

pedal: 33% potnom: 4.285714 ramped (5): 30.000000
pedal: 31% potnom: 1.428571 ramped (5): 25.000000
pedal: 29% potnom: -3.336667 ramped (5): 20.000000
pedal: 27% potnom: -10.009999 ramped (5): 15.000000
pedal: 25% potnom: -16.683332 ramped (5): 10.000000
pedal: 23% potnom: -23.356667 ramped (5): 5.000000
pedal: 21% potnom: -30.029999 ramped (5): -20.000000
pedal: 19% potnom: -36.703331 ramped (5): -36.703331
pedal: 17% potnom: -43.376663 ramped (5): -43.376663
pedal: 15% potnom: -50.049999 ramped (5): -50.049999
pedal: 13% potnom: -56.723331 ramped (5): -56.723331
pedal: 11% potnom: -63.396667 ramped (5): -63.396667
pedal: 9% potnom: -70.069992 ramped (5): -70.069992
pedal: 7% potnom: -76.743332 ramped (5): -76.743332
pedal: 5% potnom: -83.416664 ramped (5): -83.416664
pedal: 3% potnom: -90.089996 ramped (5): -90.089996
pedal: 1% potnom: -96.763329 ramped (5): -96.763329
pedal: 0% potnom: -100.099998

(car did not stop)

pedal: 1% potnom: -96.763329
pedal: 2% potnom: -93.426666
pedal: 3% potnom: -90.089996
pedal: 4% potnom: -86.753326
pedal: 5% potnom: -83.416664
pedal: 6% potnom: -80.079994
pedal: 7% potnom: -76.743332
pedal: 8% potnom: -73.406662
pedal: 9% potnom: -70.069992
pedal: 10% potnom: -66.733330
pedal: 11% potnom: -63.396667
pedal: 12% potnom: -60.059998
pedal: 13% potnom: -56.723331
pedal: 14% potnom: -53.386665
pedal: 15% potnom: -50.049999
pedal: 16% potnom: -46.713333
pedal: 17% potnom: -43.376663
pedal: 18% potnom: -40.039997
pedal: 19% potnom: -36.703331
pedal: 20% potnom: -33.366665
pedal: 21% potnom: -30.029999
pedal: 22% potnom: -26.693333
pedal: 23% potnom: -23.356667
pedal: 24% potnom: -20.019999
pedal: 25% potnom: -16.683332
pedal: 26% potnom: -13.346666
pedal: 27% potnom: -10.009999
pedal: 28% potnom: -6.673333
pedal: 29% potnom: -3.336667
pedal: 30% potnom: 0.000000
pedal: 31% potnom: 1.428571
pedal: 32% potnom: 2.857143
pedal: 33% potnom: 4.285714
pedal: 34% potnom: 5.714286
pedal: 35% potnom: 7.142857
pedal: 36% potnom: 8.571428
pedal: 37% potnom: 10.000000
pedal: 38% potnom: 11.428572
pedal: 39% potnom: 12.857142
pedal: 40% potnom: 14.285714
pedal: 41% potnom: 15.714286
pedal: 42% potnom: 17.142857
pedal: 43% potnom: 18.571428
pedal: 44% potnom: 20.000000
pedal: 45% potnom: 21.428572
pedal: 46% potnom: 22.857143
pedal: 47% potnom: 24.285715
pedal: 48% potnom: 25.714285
pedal: 49% potnom: 27.142857
pedal: 50% potnom: 28.571428
pedal: 51% potnom: 30.000000
pedal: 52% potnom: 31.428572
pedal: 53% potnom: 32.857143
pedal: 54% potnom: 34.285713
pedal: 55% potnom: 35.714287
pedal: 56% potnom: 37.142857
pedal: 57% potnom: 38.571430
pedal: 58% potnom: 40.000000
pedal: 59% potnom: 41.428570
pedal: 60% potnom: 42.857143
pedal: 61% potnom: 44.285713
pedal: 62% potnom: 45.714287
pedal: 63% potnom: 47.142857
pedal: 64% potnom: 48.571430
pedal: 65% potnom: 50.000000
pedal: 66% potnom: 51.428570
pedal: 67% potnom: 52.857143
pedal: 68% potnom: 54.285713
pedal: 69% potnom: 55.714287
pedal: 70% potnom: 57.142857
pedal: 71% potnom: 58.571430
pedal: 72% potnom: 60.000000
pedal: 73% potnom: 61.428570
pedal: 74% potnom: 62.857143
pedal: 75% potnom: 64.285713
pedal: 76% potnom: 65.714287
pedal: 77% potnom: 67.142860
pedal: 78% potnom: 68.571426
pedal: 79% potnom: 70.000000
pedal: 80% potnom: 71.428574
pedal: 81% potnom: 72.857140
pedal: 82% potnom: 74.285713
pedal: 83% potnom: 75.714287
pedal: 84% potnom: 77.142860
pedal: 85% potnom: 78.571426
pedal: 86% potnom: 80.000000
pedal: 87% potnom: 81.428574
pedal: 88% potnom: 82.857140
pedal: 89% potnom: 84.285713
pedal: 90% potnom: 85.714287
pedal: 91% potnom: 87.142860
pedal: 92% potnom: 88.571426
pedal: 93% potnom: 90.000000
pedal: 94% potnom: 91.428574
pedal: 95% potnom: 92.857140
pedal: 96% potnom: 94.285713
pedal: 97% potnom: 95.714287
pedal: 98% potnom: 97.142860
pedal: 99% potnom: 98.571426
pedal: 100% potnom: 100.000000

pedal: 99% potnom: 98.571426
pedal: 98% potnom: 97.142860
pedal: 97% potnom: 95.714287
pedal: 96% potnom: 94.285713
pedal: 95% potnom: 92.857140
pedal: 94% potnom: 91.428574
pedal: 93% potnom: 90.000000
pedal: 92% potnom: 88.571426
pedal: 91% potnom: 87.142860
pedal: 90% potnom: 85.714287
pedal: 89% potnom: 84.285713
pedal: 88% potnom: 82.857140
pedal: 87% potnom: 81.428574
pedal: 86% potnom: 80.000000
pedal: 85% potnom: 78.571426
pedal: 84% potnom: 77.142860
pedal: 83% potnom: 75.714287
pedal: 82% potnom: 74.285713
pedal: 81% potnom: 72.857140
pedal: 80% potnom: 71.428574
pedal: 79% potnom: 70.000000
pedal: 78% potnom: 68.571426
pedal: 77% potnom: 67.142860
pedal: 76% potnom: 65.714287
pedal: 75% potnom: 64.285713
pedal: 74% potnom: 62.857143
pedal: 73% potnom: 61.428570
pedal: 72% potnom: 60.000000
pedal: 71% potnom: 58.571430
pedal: 70% potnom: 57.142857
pedal: 69% potnom: 55.714287
pedal: 68% potnom: 54.285713
pedal: 67% potnom: 52.857143
pedal: 66% potnom: 51.428570
pedal: 65% potnom: 50.000000
pedal: 64% potnom: 48.571430
pedal: 63% potnom: 47.142857
pedal: 62% potnom: 45.714287
pedal: 61% potnom: 44.285713
pedal: 60% potnom: 42.857143
pedal: 59% potnom: 41.428570
pedal: 58% potnom: 40.000000
pedal: 57% potnom: 38.571430
pedal: 56% potnom: 37.142857
pedal: 55% potnom: 35.714287
pedal: 54% potnom: 34.285713
pedal: 53% potnom: 32.857143
pedal: 52% potnom: 31.428572
pedal: 51% potnom: 30.000000
pedal: 50% potnom: 28.571428
pedal: 49% potnom: 27.142857
pedal: 48% potnom: 25.714285
pedal: 47% potnom: 24.285715
pedal: 46% potnom: 22.857143
pedal: 45% potnom: 21.428572
pedal: 44% potnom: 20.000000
pedal: 43% potnom: 18.571428
pedal: 42% potnom: 17.142857
pedal: 41% potnom: 15.714286
pedal: 40% potnom: 14.285714
pedal: 39% potnom: 12.857142
pedal: 38% potnom: 11.428572
pedal: 37% potnom: 10.000000
pedal: 36% potnom: 8.571428
pedal: 35% potnom: 7.142857
pedal: 34% potnom: 5.714286
pedal: 33% potnom: 4.285714
pedal: 32% potnom: 2.857143
pedal: 31% potnom: 1.428571
pedal: 30% potnom: 0.000000
pedal: 29% potnom: -3.336667
pedal: 28% potnom: -6.673333
pedal: 27% potnom: -10.009999
pedal: 26% potnom: -13.346666
pedal: 25% potnom: -16.683332
pedal: 24% potnom: -20.019999
pedal: 23% potnom: -23.356667
pedal: 22% potnom: -26.693333
pedal: 21% potnom: -30.029999
pedal: 20% potnom: -33.366665
pedal: 19% potnom: -36.703331
pedal: 18% potnom: -40.039997
pedal: 17% potnom: -43.376663
pedal: 16% potnom: -46.713333
pedal: 15% potnom: -50.049999
pedal: 14% potnom: -53.386665
pedal: 13% potnom: -56.723331
pedal: 12% potnom: -60.059998
pedal: 11% potnom: -63.396667
pedal: 10% potnom: -66.733330
pedal: 9% potnom: -70.069992
pedal: 8% potnom: -73.406662
pedal: 7% potnom: -76.743332
pedal: 6% potnom: -80.079994
pedal: 5% potnom: -83.416664
pedal: 4% potnom: -86.753326
pedal: 3% potnom: -90.089996
pedal: 2% potnom: -93.426666
pedal: 1% potnom: -96.763329
pedal: 0% potnom: -100.099998
pedal: 0% potnom: -100.099998

Stopped: RPM 0, Pedal not pressed 0% pedal
pedal: 0% potnom: -100.099998

pedal: 0% potnom: 0.000000
pedal: 1% potnom: 1.000000
pedal: 2% potnom: 2.000000
pedal: 3% potnom: 3.000000
pedal: 4% potnom: 4.000000
pedal: 5% potnom: 5.000000
pedal: 6% potnom: 6.000000
pedal: 7% potnom: 7.000000
pedal: 8% potnom: 8.000000
pedal: 9% potnom: 9.000000
pedal: 10% potnom: 10.000000
pedal: 0% potnom: 0.000000
pedal: 1% potnom: 1.000000
pedal: 2% potnom: 2.000000
pedal: 3% potnom: 3.000000
pedal: 4% potnom: 4.000000
pedal: 5% potnom: 5.000000
pedal: 6% potnom: 6.000000
pedal: 7% potnom: 7.000000
pedal: 8% potnom: 8.000000
pedal: 9% potnom: 9.000000
pedal: 10% potnom: 10.000000
pedal: 11% potnom: 11.000000
pedal: 12% potnom: 12.000000
pedal: 13% potnom: 13.000000
pedal: 14% potnom: 14.000000
pedal: 15% potnom: 15.000000
pedal: 16% potnom: 16.000000
pedal: 17% potnom: 17.000000
pedal: 18% potnom: 18.000000
pedal: 19% potnom: 19.000000
pedal: 20% potnom: 20.000000
pedal: 21% potnom: 21.000000
pedal: 22% potnom: 22.000000
pedal: 23% potnom: 23.000000
pedal: 24% potnom: 24.000000
pedal: 25% potnom: 25.000000
pedal: 26% potnom: 26.000000
pedal: 27% potnom: 27.000000
pedal: 28% potnom: 28.000000
pedal: 29% potnom: 29.000000
pedal: 30% potnom: 30.000000
pedal: 31% potnom: 31.000000
pedal: 32% potnom: 32.000000
pedal: 33% potnom: 33.000000
pedal: 34% potnom: 34.000000
pedal: 35% potnom: 35.000000
pedal: 36% potnom: 36.000000
pedal: 37% potnom: 37.000000
pedal: 38% potnom: 38.000000
pedal: 39% potnom: 39.000000

pot2 (regen pot) turned to 50%:

pedal: 40% potnom: 40.000000 (pot2 50%)
pedal: 39% potnom: 12.857142 (pot2 50%)
pedal: 38% potnom: 11.428572 (pot2 50%)
pedal: 37% potnom: 10.000000 (pot2 50%)
pedal: 36% potnom: 8.571428 (pot2 50%)
pedal: 35% potnom: 7.142857 (pot2 50%)
pedal: 34% potnom: 5.714286 (pot2 50%)
pedal: 33% potnom: 4.285714 (pot2 50%)
pedal: 32% potnom: 2.857143 (pot2 50%)
pedal: 31% potnom: 1.428571 (pot2 50%)
pedal: 30% potnom: 0.000000 (pot2 50%)
pedal: 29% potnom: -1.670000 (pot2 50%)
pedal: 28% potnom: -3.340000 (pot2 50%)
pedal: 27% potnom: -5.010000 (pot2 50%)
pedal: 26% potnom: -6.680000 (pot2 50%)
pedal: 25% potnom: -8.350000 (pot2 50%)
pedal: 24% potnom: -10.020000 (pot2 50%)
pedal: 23% potnom: -11.690000 (pot2 50%)
pedal: 22% potnom: -13.360000 (pot2 50%)
pedal: 21% potnom: -15.030000 (pot2 50%)
pedal: 20% potnom: -16.700001 (pot2 50%)
pedal: 19% potnom: -18.369999 (pot2 50%)
pedal: 18% potnom: -20.039999 (pot2 50%)
pedal: 17% potnom: -21.709999 (pot2 50%)
pedal: 16% potnom: -23.379999 (pot2 50%)
pedal: 15% potnom: -25.049999 (pot2 50%)
pedal: 14% potnom: -26.719999 (pot2 50%)
pedal: 13% potnom: -28.389997 (pot2 50%)
pedal: 12% potnom: -30.059999 (pot2 50%)
pedal: 11% potnom: -31.730000 (pot2 50%)
pedal: 10% potnom: -33.400002 (pot2 50%)
pedal: 9% potnom: -35.070000 (pot2 50%)
pedal: 8% potnom: -36.739998 (pot2 50%)
pedal: 7% potnom: -38.409996 (pot2 50%)
pedal: 6% potnom: -40.079998 (pot2 50%)
pedal: 5% potnom: -41.750000 (pot2 50%)
pedal: 4% potnom: -43.419998 (pot2 50%)
pedal: 3% potnom: -45.090000 (pot2 50%)
pedal: 2% potnom: -46.759998 (pot2 50%)
pedal: 1% potnom: -48.429996 (pot2 50%)
pedal: 0% potnom: -50.099998 (pot2 50%)
alexbeatle
Posts: 155
Joined: Sun Jan 03, 2021 6:12 am
Has thanked: 46 times
Been thanked: 15 times

Re: Accelerator pedal dead zone

Post by alexbeatle »

Has this or similar approach been pushed into the main firmware? Makes sense to me for the throttle calcs to depend on the motor rpm.

Thank you. This thread helps me understand why I had accel dead zone when running the motor for the first time, yesterday.
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 my replacement code for CalcThrottle(). I have made lots of unit tests (output from tests in my previous message), but not tested in real car as updating firmware to my bench SDU failed, and I would need to open that again and flash it with st-link to get it back alive.

Would love to get that in to main. All feedback is welcome :)

Some explanations for variables:
potnom = accelerator pedal position, 0 - 100.
pot2nom = second pot (eg. regen pot)
brkpedal = brake pedal is pressed, true / false
zeroRpm = if rpm of motor equals zero.
useRegenZone = means if regen "zone" (regentravel) is being used for regen.
brkNom (regentravel) = how many % of pedal travel is assigned for regen-zone (earlier dead zone)
brknompedal (brakeregen) = how strong the regen is when brake pressed
brkmax (offthrotregen) = how strong the regen is when accelerator lifted pressed


ps. useRegenZone and prevPotnom are static, so initialized only once even though reading the code it looks like they reset to zero / false on every iteration. This way we can keep track if we're still on "regen zone", or which way we are going with accelerator.

Code: Select all

float Throttle::CalcThrottle(float potnom, float pot2nom, bool brkpedal, bool zeroRpm)
{
   static bool useRegenZone = false;
   static float prevPotnom = 0;
   const static float noiseTolerance = 0.5f;  // Adjust as needed

   float scaledBrkMax = brkpedal ? brknompedal : brkmax;

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

   
   //reset
   if ((potnom < 1 && zeroRpm) || brkpedal)
   {
      potnom = scaledBrkMax;
      useRegenZone = false; //accelerator has been lifted
   }
   else if (potnom < brknom && prevPotnom >= brknom)
   {
      useRegenZone = true;
   }
   else if (potnom > brknom && prevPotnom > potnom + noiseTolerance)  //coming down after initial acceleration
   {
      useRegenZone = true;
   }

   if (useRegenZone)
   {
      if (potnom < brknom) //pedal in regenZone
      {
         potnom -= brknom;
         potnom = -(potnom * scaledBrkMax / brknom);
      }
      else //pedal above regenZone
      {
         potnom -= brknom;
         potnom = 100.0f * potnom / (100.0f - brknom);
      }
   }

   prevPotnom = potnom; 
   return potnom;
}
User avatar
uhi22
Posts: 601
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 91 times
Been thanked: 413 times

Re: Accelerator pedal dead zone

Post by uhi22 »

I'd love to have the comments directly in the code, this would make it more easy to understand, debug and improve the software afterwards.
eGrandpa
Posts: 24
Joined: Tue Jun 21, 2022 11:38 pm
Location: Michigan, USA
Been thanked: 7 times
Contact:

Re: Accelerator pedal dead zone

Post by eGrandpa »

I've read through the various posts, but still not sure how to solve my throttle issue with my Tesla LDU Sport motor with a car weight of 3,600#. I like my idlemode off for now. I don't like that I have to tip into the throttle 20% to get the car to move. I'm used to it, but when others drive it with me they say -- "there's something wrong -- it wont move". I like my regen setting -- throttle off, decel similar to an ICE. I thought it was the fslipmin setting, but that doesn't seem to address the issue. Any suggestions?
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 just flashed my code to the OI board. Will try it out next week when new motor going in. I’ll let you know how it works :)
User avatar
johu
Site Admin
Posts: 5791
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1025 times
Contact:

Re: Accelerator pedal dead zone

Post by johu »

If you want it integrated into the "vanilla" firmware read this: viewtopic.php?p=62622
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
catphish
Posts: 955
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 94 times
Been thanked: 179 times

Re: Accelerator pedal dead zone

Post by catphish »

One nice thing about making regen proportional to speed is that as well as eliminating the deadzone, it also replaces brkrampstr.
Please see my old thread and patch here: viewtopic.php?p=42509
User avatar
catphish
Posts: 955
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 94 times
Been thanked: 179 times

Re: Accelerator pedal dead zone

Post by catphish »

I've created a Github issue to track this feature request: https://github.com/jsphuebner/stm32-sine/issues/38
User avatar
uhi22
Posts: 601
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 91 times
Been thanked: 413 times

Re: Accelerator pedal dead zone

Post by uhi22 »

Very good. But really for the esp32-web-interface?
User avatar
catphish
Posts: 955
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 94 times
Been thanked: 179 times

Re: Accelerator pedal dead zone

Post by catphish »

uhi22 wrote: Fri Oct 20, 2023 8:52 pm Very good. But really for the esp32-web-interface?
Yeah, I definitely opened that in the wrong project! Fixed now :)
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 made some changes to my regen code, to CalcThrottle() -function. I realized that the first one (code that I posted) had a problem. It was when you don't go over that regentravel area. (eg set to 30%), you don't get any regen when lifting the pedal (until off throttle). And doing 30% of throttle can get you to some speeds already. I started wondering how BMW does this, and noticed that they have different curve for accelerator for the first maybe 20-30%, car moves but it only stars to pick up more power after the regentravel area. So I made similar changes. Here's how it works with regentravel set to 30%.

Going from 0% pedal to 100% pedal, first 30% you only accelerate 0-10% of the throttle. This makes parking lot manoeuvres easy and helps you initially get over the 30% regentravel "area" - so it's easier to control speed after that. So, after getting over that regentravel (30% of travel) you are at 10% of throttle, so the rest from 30% to 100% is 10%-100% throttle.

It keeps track of pedal position history, and once you start lifting off the pedal, the curve changes just a bit. Now it's 0-30% for regen and 30-100% for acceleration. So this is the same as current implementation in Johannes's firmware. And it's like this until you do complete stop.

There is no speed related regen factored in. I don't think it's needed. And of course regenramp and regenrampstr and all parameters works like they have used to.
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 »

You seem to be really overcomplicating this....

Catphish and toms approaches are clean and resemble what an OEM setup would do.

Tracking historic throttle position and remapping the pedal on the fly seems like a recipe for issues. The pedal should not IMO randomly change its mapping at some undefined point.

If you place an OEM EV on a steep hill, engage drive and release the brakes, it will ramp itself into regen without touching the throttle at all for instance. This function should be related to speed.
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 »

What's with the attitude? I've been investigating, thinking and testing that for days. Saying that I would have written something that would "randomly" change mapping on "undefined point" feels like an insult. My goal is to develop something that I could use and maybe some others might want to try it too. Openly discuss here and share ideas.

With this code - on steep hill - it will do exactly the same as current released firmware does. If offthrottleregen is set to something higher than 0%, it will regen normally as speed increases. Only difference here to Johannes's implementation is that that dead zone is being utilized. And because the same dead-zone is used for regen, mapping must change at some point. Same as it does in any other implementations. It cannot be same throttle mapping when initially accelerating 0-30% and when coming off throttle 30% - 0%.

What implementation are you running? Catphish's or tom's?
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 »

It is an undefined point, it could happen at any speed/condition depending on what youve done with the throttle pedal.

You could, for instance, apply 28% pedal and slowly accellerate to 30mph, and lift off the pedal and get zero regen. Then the next minute you apply 31% throttle (which will be an almost imperceptable difference to your foot!) and then lift and get full regen... Or you could be creeping along in slow moving traffic, only requiring light throttle application, and again, never manage to enable regen. Or you apply 25% pedal, then go to 35% and back to 25% and its a completely different torque request? It just doesnt make sense and can only serve to make the throttle application inconsistent, which IMO means its not sensible or safe.

For whatever reason you seem to be insisting that it should not be speed based, and as a result are creating ever more complicated algorithms to work around the issues that arise from trying to make it not-speed-based. Perhaps my post came across as harsh, but i feel like its the wrong approach and need to point that out. Ofcourse if your going to continue down that route thats your call.
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 »

It seems important to me that there is only one behavior for each speed/throttle position, regardless of whether I accelerated or decelerated beforehand or pressed the pedal slowly or quickly or was above or below a value in the meantime. For me, the behavior of an ICE engine is exemplary. Whether the engine decelerates or accelerates at a certain accelerator pedal position does not depend on what I did before, but on the current speed and the gradient of the road. In no ICE car is there a fixed accelerator pedal value as the boundary between acceleration and deceleration. At very low speeds, acceleration is already present at 0% gas pedal, at near top speed, almost any pedal position causes deceleration.
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 »

Aragorn wrote: Tue Oct 24, 2023 3:05 pm It is an undefined point, it could happen at any speed/condition depending on what youve done with the throttle pedal.
My main idea here is that the "regen zone" is quickly covered once you get going. If you're only doing speeds less than 15kmh, you don't have regen anyway. After covering that first 20-30%, it does not feel any different from the current logic in the firmware. If you set regenrampstr to 15km/h, it won't do anything weird. Whatever the speed or pedal position. Basically the difference is only that there is no dead zone, but it's replaced with low speed / less attacking pedal feel.

I tested also Catphis's code, but for some reason I'm getting weird values back. For example calling it with values

CalcThrottle(4.0, 100.0, false, 2.71700668) ==> returns potnom -7. (almost standsill, accelerating.. )
CalcThrottle(12.0, 100.0, false, 14) ==> returns potnom -44.2. (5km/h, accelerating.. )

This is when regenrampstr = 19.9hz. brknompedal and brkmax = -90 and brknom = 30.

I don't understand the logic how it should work as it is, some calculations are off. Here's the code I'm testing https://github.com/catphish/stm32-sine/ ... le.cpp#L85

I think it gets confused from certain kind of parameters and needs them to be within some limits. As my own tests show it failing, I'm don't want to be the one to test it in real life :D
P.S.Mangelsdorf
Posts: 772
Joined: Tue Sep 17, 2019 8:33 pm
Location: Raleigh, NC, USA
Has thanked: 96 times
Been thanked: 96 times

Re: Accelerator pedal dead zone

Post by P.S.Mangelsdorf »

eGrandpa wrote: Fri Oct 20, 2023 2:59 pm I've read through the various posts, but still not sure how to solve my throttle issue with my Tesla LDU Sport motor with a car weight of 3,600#. I like my idlemode off for now. I don't like that I have to tip into the throttle 20% to get the car to move. I'm used to it, but when others drive it with me they say -- "there's something wrong -- it wont move". I like my regen setting -- throttle off, decel similar to an ICE. I thought it was the fslipmin setting, but that doesn't seem to address the issue. Any suggestions?
Try reducing brknom / regentravel, that will reduce the percentage of throttle dedicated to regen.
If at first you don't succeed, buy a bigger hammer.

1940 Chevrolet w/ Tesla LDU - "Shocking Chevy" - Completed 2023 Hot Rod Drag Week
eGrandpa
Posts: 24
Joined: Tue Jun 21, 2022 11:38 pm
Location: Michigan, USA
Been thanked: 7 times
Contact:

Re: Accelerator pedal dead zone

Post by eGrandpa »

P.S.Mangelsdorf wrote: Tue Oct 24, 2023 8:57 pm Try reducing brknom / regentravel, that will reduce the percentage of throttle dedicated to regen.
Thanks. Will try it.
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 »

eGrandpa wrote: Wed Oct 25, 2023 12:25 pm Thanks. Will try it.
If you only use off throttle regen, you can just put zero to brknom / regentravel. Then there is no dead zone.
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 uploaded my throttle code after changing the motor, and I can say it works almost perfectly! No dead zone feel and you can't tell that the mapping changes, because it changes when you start to lift the accelerator. Only downside is that if you barely make the car move and don't exceed that 30% (or whatever is configured as regentravel), regen wont activate. But in my test cases, that only happened when car was standstill on top of a hill, and lifted the brake or barely touched the accelerator not exceeding the regentravel.

It's interesting how much more refined the car feels without that dead zone.
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 wrote: Mon Oct 30, 2023 9:31 pm It's interesting how much more refined the car feels without that dead zone.
Are you willing to share your code if you haven't posted it somewhere already?
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 want to test bit more before sharing it. Maybe add that very low speed regen too. My OI board has some water damage and it’s acting up. Need to wait for new board before I can continue testing it.
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 »

After some more testing, I decided to simplify this and use speed in regen calculation. Main annoyance in previous solution being that case when starting on top of the hill and pedal never travels past regentravel, and you get no regen. And what actually happened was that off throttle regen worked, but once you touched accelerator it went eg. from -70% to 5% in instant, and that was not very smooth feeling 😅.

So I added config parameter for speed (maxregentravelhz) where regen is in full power regentravel is at max (eg 30%). It grows linear when approaching defined speed and it goes to zero only when fully stopped.

Picture shows how it works. Uploaded the firmware to car this evening and testing it tomorrow, if it’s not too icy/snowy weather for summer tires :) I’ll update here after that.

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.

EDIT2: in picture, Regen % label should be Regentravel %
Attachments
IMG_7881.jpeg
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 »

Updated the previous post, as I had few errors in text and in picture. Hope it makes more sense now :)
Post Reply