Vehicle/Steering Constants

Default values of constants for vehicles and steering behaviours.

These values are automatically imported by steering.py and used in the demos.

steering_constants.SPEED_EPSILON_SQ = 1e-09

A BasePointMass2d has velocity-aligned heading. However, if the speed is almost zero (squared speed is below this threshold), we skip alignment in order to avoid jittery behaviour.

steering_constants.POINTMASS2D_MASS = 1.0

Vehicle mass for rectilinear motion.

steering_constants.POINTMASS2D_MAXSPEED = 8.0

Maximum vehicle speed per rectilinear motion update.

steering_constants.POINTMASS2D_MAXFORCE = 6.0

Maximum force/budget per rectilinear motion update.

steering_constants.RIGIDBODY2D_INERTIA = 1.0

Rotational Inertia for rigid-body physics

steering_constants.RIGIDBODY2D_MAXOMEGA = 90.0

Maximum angular velocity per rigid-body update.

steering_constants.RIGIDBODY2D_MAXTORQUE = 75.0

Maximum torque per rigid-body update.

steering_constants.ARRIVE_DECEL_TWEAK = 10.0

larger values give more gradual deceleration.

Type

ARRIVE global tweaking

steering_constants.ARRIVE_DEFAULT_HESITANCE = 2.0

Default ARRIVE hesitance on a per-instance basis

steering_constants.WANDER_DISTANCE = 30.0

Default forward distance to center of WANDER circle

steering_constants.WANDER_RADIUS = 25.0

Default radius of WANDER circle

steering_constants.WANDER_JITTER = 15.0

Default jitter of WANDER circle

steering_constants.OBSTACLEAVOID_MIN_LENGTH = 35.0

This controls the size of an object detection box for AVOID obstacles. Length in front of vehicle is 100%-200% of this.

steering_constants.OBSTACLEAVOID_BRAKE_WEIGHT = 0.01

Tweaking constant for braking force of AVOID obstacles.

steering_constants.OBSTACLE_REACT_TIME = 200.0

Some kind of tweak currently used by OBSTACLESKIM

steering_constants.TAKECOVER_ARRIVE_HESITANCE = 1.0

ARRIVE at the hiding spot with this hesitance.

Type

TAKECOVER

steering_constants.TAKECOVER_OBSTACLE_PROXIMITY = 2.0

To avoid obstacle jitter, our effective bounding radius is multiplied by this factor when determining a hiding spot.

steering_constants.TAKECOVER_EVADE_MULT = 1.5

Instances of TAKECOVER use a maximum distance for the hiding spot. If no suitable spot can be found, evade the target using a panic radius equal to this constant times the given maximum distance.

steering_constants.TAKECOVER_STALK_COS = -0.5

For stalking, set this to cos(theta), where theta is the a maximum angle from target’s front vector; this vehicle will hide only when within the target’s given angle of view and close enough (see STALK_DSQ below)

steering_constants.TAKECOVER_STALK_DSQ = 90000.0

For stalking, hide only when within a certain distance; see above.

steering_constants.PURSUE_POUNCE_DISTANCE = 100.0

If prey is “close enough” and coming right at us, just SEEK.

Type

PURSUE

steering_constants.PURSUE_POUNCE_COS = 0.966

Cosine of pounce angle; this is approximately cos(10 degrees).

steering_constants.FOLLOW_ARRIVE_HESITANCE = 1.5

FOLLOW the leader uses ARRIVE with this hesitance, for smooth formations.

steering_constants.EVADE_PANIC_DIST = 160.0

EVADE ignores the predator beyond this distance

steering_constants.GUARD_HESITANCE = 1.0

GUARD uses this hesitance to arrive at the guard point.

steering_constants.PATH_EPSILON_SQ = 100.0

SteeringPath will treat consecutive waypoints that are closer than this as duplicates, and remove them from the path.

steering_constants.WAYPOINT_RADIUS = 10.0

Used by PATHFOLLOW/RESUME to determine when we’re close enough to a waypoint.

steering_constants.PATHRESUME_EXP_DECAY = 0.075

Exponential decay constant for PATHRESUME.

steering_constants.FLOCKING_RADIUS_MULTIPLIER = 5.0

For simplicity, we multiply the vehicle’s bounding radius by this constant to determine the local neighborhood radius for group behaviours.

steering_constants.FLOCKING_SEPARATE_SCALE = 2.1

Scaling factor for SEPERATE group behaviour. Larger values give greater seperation force.

steering_constants.FLOCKING_COHESION_HESITANCE = 3.5

Cohesion essentially ARRIVEs with this hesitance, for smooth flocking.

steering_constants.BASEPOINTMASS2D_DEFAULTS = {'MASS': 1.0, 'MAXFORCE': 6.0, 'MAXSPEED': 8.0}

Point-Mass physics defaults.

steering_constants.SIMPLERIGIDBODY2D_DEFAULTS = {'INERTIA': 1.0, 'MASS': 1.0, 'MAXFORCE': 6.0, 'MAXOMEGA': 90.0, 'MAXSPEED': 8.0, 'MAXTORQUE': 75.0}

Additional Rigid Body physics defaults.

steering_constants.STEERING_DEFAULTS = {'ARRIVE_DECEL_TWEAK': 10.0, 'ARRIVE_DEFAULT_HESITANCE': 2.0, 'EVADE_PANIC_DIST': 160.0, 'FLOCKING_COHESION_HESITANCE': 3.5, 'FLOCKING_RADIUS_MULTIPLIER': 5.0, 'FLOCKING_SEPARATE_SCALE': 2.1, 'FOLLOW_ARRIVE_HESITANCE': 1.5, 'GUARD_HESITANCE': 1.0, 'OBSTACLEAVOID_BRAKE_WEIGHT': 0.01, 'OBSTACLEAVOID_MIN_LENGTH': 35.0, 'OBSTACLE_REACT_TIME': 200.0, 'PATHRESUME_EXP_DECAY': 0.075, 'PATH_EPSILON_SQ': 100.0, 'PURSUE_POUNCE_COS': 0.966, 'PURSUE_POUNCE_DISTANCE': 100.0, 'TAKECOVER_ARRIVE_HESITANCE': 1.0, 'TAKECOVER_EVADE_MULT': 1.5, 'TAKECOVER_OBSTACLE_PROXIMITY': 2.0, 'TAKECOVER_STALK_COS': -0.5, 'TAKECOVER_STALK_DSQ': 90000.0, 'WANDER_DISTANCE': 30.0, 'WANDER_JITTER': 15.0, 'WANDER_RADIUS': 25.0, 'WAYPOINT_RADIUS': 10.0}

Defaults for Steering Behaviours.

steering_constants.PRIORITY_DEFAULTS = ['BRAKE', 'WALLAVOID', 'OBSTACLEAVOID', 'OBSTACLESKIM', 'FLOCKSEPARATE', 'FLEE', 'EVADE', 'SEEK', 'ARRIVE', 'TAKECOVER', 'PURSUE', 'GUARD', 'FOLLOW', 'WAYPATHRESUME', 'WAYPATHVISIT', 'SIDESLIP', 'FLOCKCOHESION', 'FLOCKALIGN', 'FLOWFOLLOW', 'WANDER']

Order in which behaviours are considered when using budgeted force: