AICarSteeringComponent – Arma 3

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Lou Montana moved page Arma 3 AICarSteeringComponent to Arma 3: AICarSteeringComponent: Text replacement - "^Arma 3 " to "Arma 3: ")
m (Text replacement - "syntaxhighlight lang="c"" to "syntaxhighlight lang="cpp"")
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''Config'''
=== Config ===


<syntaxhighlight lang="c">
<syntaxhighlight lang="cpp">
class AICarSteeringComponent
class AICarSteeringComponent
{
{
    // controls working parameters of steering PID controller (Kp, Ki, Kd)
// controls working parameters of steering PID controller (Kp, Ki, Kd)
    steeringPIDWeights[] = { 1.2, 0.1, 0.2 };
steeringPIDWeights[] = { 1.2, 0.1, 0.2 };
    // controls working parameters of speed PID controller (Kp, Ki, Kd)
// controls working parameters of speed PID controller (Kp, Ki, Kd)
    speedPIDWeights[] = { 0.7, 0.2, 0.0 };
speedPIDWeights[] = { 0.7, 0.2, 0.0 };
 
    // remapping of maxSpeed of vehicle, for fast vehicles we want to lower the used speed
// remapping of maxSpeed of vehicle, for fast vehicles we want to lower the used speed
    doRemapSpeed = true;
doRemapSpeed = true;
    remapSpeedRange[] = { 30.0, 70.0 };
remapSpeedRange[] = { 30.0, 70.0 };
    remapSpeedScalar[] = { 1.0, 0.35 };
remapSpeedScalar[] = { 1.0, 0.35 };
 
    // prediction ahead is used for both steering and analysing of shape to modify the speed
// prediction ahead is used for both steering and analysing of shape to modify the speed
    doPredictForward = true;
doPredictForward = true;
    predictForwardRange[] = { 1, 20 };
predictForwardRange[] = { 1, 20 };
    // steer ahead is a point to steer to, saturated down to given range, in meters
// steer ahead is a point to steer to, saturated down to given range, in meters
    steerAheadSaturation[] = { 0.01, 0.4 };
steerAheadSaturation[] = { 0.01, 0.4 };
 
    // set method of predicting safe speed
// set method of predicting safe speed
   
    speedPredictionMethod = 2;
speedPredictionMethod = 2;
    // 0 - three angles method
// 0 - three angles method
    // 1 - wheel direction method
// 1 - wheel direction method
    // 2 - combined method
// 2 - combined method
    // three coef's to determine how much given angle should influence slowing down
// three coef's to determine how much given angle should influence slowing down
    wheelAngleCoef = 0.7;
wheelAngleCoef = 0.7;
    forwardAngleCoef = 0.7;
forwardAngleCoef = 0.7;
    steeringAngleCoef = 1.0;
steeringAngleCoef = 1.0;
    differenceAngleCoef = 1.0;
differenceAngleCoef = 1.0;
 
 
    // for how long we allow to be not moving, before we consider us stuck
// for how long we allow to be not moving, before we consider us stuck
    stuckMaxTime = 3.0;
stuckMaxTime = 3.0;
               
    // overtaking is part of collision avoidance
// overtaking is part of collision avoidance
    allowOvertaking = true;
allowOvertaking = true;
    allowCollisionAvoidance = true;
allowCollisionAvoidance = true;
    // allow using movement vector as direction
// allow using movement vector as direction
    allowDrifting = false;
allowDrifting = false;
 
 
    // parameters of predictionMethod = 1
// parameters of predictionMethod = 1
    maxWheelAngleDiff = 0.2616;
maxWheelAngleDiff = 0.2616;
    minSpeedToKeep = 0.1;
minSpeedToKeep = 0.1;
 
 
    // how strong AI will turn when commanded left/right
// how strong AI will turn when commanded left/right
  commandTurnFactor = 1.0;
commandTurnFactor = 1.0;
};
};
</syntaxhighlight>
</syntaxhighlight>


'''Scripting commands'''
=== Scripting commands ===


[[useAISteeringComponent]] true/false
[[useAISteeringComponent]] true/false
Line 65: Line 65:


* sets distance between following vehicles, should be set for all vehicles in convoy with the same value.
* sets distance between following vehicles, should be set for all vehicles in convoy with the same value.




Line 72: Line 71:
* sets a custom path for a vehicle, behaves like Move command but with ability to send path through list of points. Accepts array of arrays (3 or 4 elements). Either (x,y,z) or (x,y,z,wantedSpeed)
* sets a custom path for a vehicle, behaves like Move command but with ability to send path through list of points. Accepts array of arrays (3 or 4 elements). Either (x,y,z) or (x,y,z,wantedSpeed)


[[Category:Arma 3: Vehicle Configuration]]
 
{{GameCategory|arma3|Vehicle Configuration}}

Latest revision as of 16:31, 11 February 2024

Config

class AICarSteeringComponent
{
	// controls working parameters of steering PID controller (Kp, Ki, Kd)
	steeringPIDWeights[] = { 1.2, 0.1, 0.2 };
	// controls working parameters of speed PID controller (Kp, Ki, Kd)
	speedPIDWeights[] = { 0.7, 0.2, 0.0 };

	// remapping of maxSpeed of vehicle, for fast vehicles we want to lower the used speed
	doRemapSpeed = true;
	remapSpeedRange[] = { 30.0, 70.0 };
	remapSpeedScalar[] = { 1.0, 0.35 };

	// prediction ahead is used for both steering and analysing of shape to modify the speed
	doPredictForward = true;
	predictForwardRange[] = { 1, 20 };
	// steer ahead is a point to steer to, saturated down to given range, in meters
	steerAheadSaturation[] = { 0.01, 0.4 };

	// set method of predicting safe speed
	 
	speedPredictionMethod = 2;
	// 0 - three angles method
	// 1 - wheel direction method
	// 2 - combined method
	// three coef's to determine how much given angle should influence slowing down
	wheelAngleCoef = 0.7;
	forwardAngleCoef = 0.7;
	steeringAngleCoef = 1.0;
	differenceAngleCoef = 1.0;

	// for how long we allow to be not moving, before we consider us stuck
	stuckMaxTime = 3.0;
				 
	// overtaking is part of collision avoidance
	allowOvertaking = true;
	allowCollisionAvoidance = true;
	// allow using movement vector as direction
	allowDrifting = false;

	// parameters of predictionMethod = 1
	maxWheelAngleDiff = 0.2616;
	minSpeedToKeep = 0.1;

	// how strong AI will turn when commanded left/right
	commandTurnFactor = 1.0;
};

Scripting commands

useAISteeringComponent true/false

  • enable or disable new ai driving across all vehicles driven locally on the machine.


vehicle forceFollowRoad true/false

  • forces AI driver to stick to immediate road, as long as the path is near the road


vehicle setConvoySeparation 20

  • sets distance between following vehicles, should be set for all vehicles in convoy with the same value.


vehicle setDriveOnPath [[1000,10,1000],[1100,10,1000]]

  • sets a custom path for a vehicle, behaves like Move command but with ability to send path through list of points. Accepts array of arrays (3 or 4 elements). Either (x,y,z) or (x,y,z,wantedSpeed)