Is there a way to limit torque amount per gear/speed?

Discussion in 'Programming' started by Spaceballs the Username, Nov 29, 2015.

  1. Spaceballs the Username

    Spaceballs the Username
    Expand Collapse

    Joined:
    Oct 13, 2015
    Messages:
    568
    I want to write some launch control script, and I want to know if it is possible to limit the torque in first gear to, say, 500Nm, or if it's possible to do that, say, if the vehicle is going less than 60mph.

    I've never coded in LUA or for BeamNG but I do have quite a bit of experience with C++, C#, Java, etc so assume I have logical knowledge but not syntax knowledge.
     
  2. Diamondback

    Diamondback
    Expand Collapse
    Vehicle Systems Lead
    BeamNG Team

    Joined:
    Apr 8, 2014
    Messages:
    1,957
    A launch control does not artificially limit the torque transmission. Instead it's just a special software that lets you start with an appropriate RPM and tries to prevent power slip from happening (much like our TCS system)
    In fact, you could already configure the TCS to behave almost like a real launch control (except the RPM holding feature, but that can be done manually in neutral gear)

    So all in all, the only thing you need to code is a trigger for the LC that lets you rev up to a fixed RPM (somewhere around 4k usually) while holding the brake and then shifts into the D mode once you let go of the brake. Together with a sporty TCS configuration this will resemble a real life LC as closely as possible :)
     
    • Like Like x 1
  3. Spaceballs the Username

    Spaceballs the Username
    Expand Collapse

    Joined:
    Oct 13, 2015
    Messages:
    568
    Thanks, I will have to give that a try. The main problem I was having is that there is so much torque in the engine I made (I looked up details on the Koenigsegg One:1 engine and transmission, so I have a 1400Nm engine stuck into a Sunburst) that it's really hard to drive even with good throttle control in the lower gears. The current TCS/ECS implementation seems it's unable to handle the massive power and still lets the wheels spin quite a bit. I tried messing with the threshold parameters but I didn't seem to get very far with it. I'm trying to make it like the Koenigsegg where you can (to my knowledge) mash the throttle and the ECS will handle everything for you.
     
  4. Diamondback

    Diamondback
    Expand Collapse
    Vehicle Systems Lead
    BeamNG Team

    Joined:
    Apr 8, 2014
    Messages:
    1,957
    The current TCS suffers a bit from the lack of throttle accuracy currently present in our throttle code.
    We are looking into this though.

    Nevertheless can the TCS handle all sorts of torque as long as the rest of the system is sized properly and the TCS is configured in the right way.
     
  5. torsion

    torsion
    Expand Collapse

    Joined:
    May 31, 2015
    Messages:
    1,600
    Maybe you could mask the bad behavior by using Jalkku's diff-locker script during launches. You still need the throttle+brake=rev-limiter code, but when that initiates you could lock the diffs until some trigger (x), such as steering beyond x degrees.

    That said, I don't know if this would break the diffs / drivetrain / etc - and it sounds like Diamondback is saying that the problem resides in your TCS parameters anyway.

    FWIW, now that I look at it the One:1 features an electronic differential. Launch control probably does lock the diff on that vehicle. Also note that if you're having trouble at shift points, the One:1 features a dual-clutch transmission... I can't imagine that you'll be in as good a situation with a single-clutch tranny?
     
    • Like Like x 1
  6. Spaceballs the Username

    Spaceballs the Username
    Expand Collapse

    Joined:
    Oct 13, 2015
    Messages:
    568
    I'm using a dual clutch tranny with a 0.002 shift time.

    I will take a look at that code for sure.

    One other issue I'm having is the immense amount of engine braking happening when I'm off the accelerator. Due to the clutch torque of the engine (2100) (max torque of engine is 2088), the engine applies 2100 brake torque whenever the accelerator is not applied, resulting in 0.8G of instant braking force. This requires some really fancy throttle tricks, especially on the controller I use, to prevent the snap oversteer that occurs when I let off the throttle into a turn. Is there any way to code something to reduce engine braking to normal levels?
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice