Currently the developers are putting their own money into JC2-MP to keep the servers online.

Please take a few seconds of your time and disable your AdBlock plugin for our website.

Ad revenue is not going to developers, it is used purely for covering our hosting costs.

 

You are also free to donate, which removes all ads from our website!

Patch 0.3 was just released! Full changelog here: https://t.co/4A50m6IKen

2 years ago

Advertisement
August 23, 2019, 11:59:03 pm

Author Topic: Cruise Control Plus  (Read 1729 times)

ccfreak2k

  • Donator
  • Newbie
  • *****
  • Posts: 7
    • View Profile
Cruise Control Plus
« on: December 17, 2013, 08:22:59 am »
Cruise Control Plus is a script based on Tycoonman500's cruise control script that will keep your speed at the number you set. The Plus stands for PID integration! This script may be loaded along with the default cruise control script, however players should only have one enabled at a time. If you have any bug reports or suggestions, drop them here so I can get them fixed.

To install, extract the zip to your scripts/ folder. You can load/reload it with [re]load cruisecontrolplus.

To use this script, just use /cc #, where # is any number greater than 0. Typing /cc will turn cruise control off again. The gain and clamp values allow you to adjust how responsive the control is. Gain values less than 1 and greater than 0 may work better for fast cars (like race cars), while values greater than 1 might be better for slow cars (like buses). The I clamp value should also be set accordingly. The default values work pretty well for sedans at 100KM/h; at lower speeds it will pulse like the first cruise control script, and at higher speeds it tends to drive slightly slower than the set value. Tweaking these values may get you better results.

Usage:
/cc  <n>: Set cruise control to <n> speed and turn on (or just /cc to disable)
/ccp <n>: Set the P term gain (or just /ccp to see the current value)
/cci <n>: Set the I term gain (or just /cci to see the current value)
/ccd <n>: Set the D term gain (or just /ccd to see the current value)
/ccc <n>: Set I clamp value (or just /ccc to see the current value)
/ccg: Print all three gain values and clamp value


If you wish to look at the various internal values, use /ccs to show them. They are as follows:
  • * O: Actual output value to the throttle control (i.e. sum of PID)
  • * P: P term
  • * I: I term
  • * D: D term
  • * E: Delta of vehicle speed to set speed
  • * T: Delta of time since last sample

Future ideas:
* Disable when the player leaves the vehicle
* Stay disabled when the player is a passenger
* Have a table of different gain/clamp values for different vehicles


Like the script this is based on, it is licensed under the MIT license.
« Last Edit: December 17, 2013, 10:48:13 am by ccfreak2k »

oostcoast

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Cruise Control Plus
« Reply #1 on: December 25, 2013, 09:42:32 pm »
I don't think that there are many engineers on this forum so I don't think many people have the knowledge on how to tune PID's. It would be great if you could make it self-tuning, perhaps based on the vehicle mass? Should be a cool challenge.
« Last Edit: December 27, 2013, 02:26:52 am by oostcoast »

SonnySalieri

  • Full Member
  • ***
  • Posts: 189
    • View Profile
Re: Cruise Control Plus
« Reply #2 on: February 07, 2014, 01:36:38 pm »
Yea not all playaz may be engineers BUT if you explain some things briefly then everyone will get the idea of which parameter is for what.

Nice script anyway, good job

ccfreak2k

  • Donator
  • Newbie
  • *****
  • Posts: 7
    • View Profile
Re: Cruise Control Plus
« Reply #3 on: February 12, 2014, 09:59:30 pm »
Yea not all playaz may be engineers BUT if you explain some things briefly then everyone will get the idea of which parameter is for what.

It's not implemented in any special way; it's a standard PID controller. Understanding how it works requires a bit of algebra.

http://en.wikipedia.org/wiki/PID_controller