Skip to content

AcresCorePolaris.h#

Core/Source/AcresCorePolaris.h Generated

The Polaris Ranger in ACRES Core: the game's own drive-by-wire, powertrain, tyre and driveline model (AcresUtvModel.h, compiled unchanged) on a rigid chassis that reproduces what the game does with Chaos in AAcresVehiclePawn::AsyncPhysicsTickActor (AcresVehicle.cpp) and StepPolarisControls (AcresPolaris.cpp):

  • per wheel a ray from the suspension mount down the chassis' up axis, radius + 0.75 m long, against the triangulated terrain; suspension extension = mount-to-contact distance - radius (a corner past full droop hangs free);
  • the contact point's velocity (v + w x r) split along the ground normal, the steered wheel heading projected on the ground and its right; the surface under the contact (FAcresWorld::SurfaceAt: template, soil water, rut, soil class); AcresSim::PrepareUtvWheel, then AcresSim::SolveUtvDriveline for all four;
  • forces N n + Fx forward + Fy right + water drag at the rut bottom, summed into a force and a torque about the centre of mass, with the aerodynamic drag -1/2 rho CdA |v| v;
  • the farm stamps (tyre footprints and the body sweep) on the environment's FAcresFarmState;
  • Chaos' semi-implicit Euler step of the body: v += (F / m + g) dt, w += I_world^-1 T dt, angular damping w *= 1 - 0.08 dt (the chassis' Unreal angular damping), x += v dt, q += dt/2 (0, w) q.

Unlike the game (whose tractor.csv ledger has no chassis side), the Core also closes the energy ledger's chassis side every step (AcresSim::AccountChassis: aero, water, lateral scrub, suspension, kinetic and potential energy) so E_ground = Slip + Lateral + Soil of the scouting task is complete.

Frames: world ENU, body FLU (see AcresCoreMath.h). One environment's thread only.

LoadPolarisParameters#

Loads Content/Simulation/polaris.json into Ranger parameters the way the game does (every "<path>.value", arrays as "<path>[i]", booleans as 0 / 1, through AcresSim::SetUtvParameter), applies overrides (the game's -PolarisSet= keys) and the occupant count (the game's -PolarisOccupants=; negative keeps the file's), then AcresSim::FinalizeUtvParameters. The ground and water drag of the world replace the model's, as the game's LoadPolarisConfiguration does (the Ranger keeps its own 0.2 m sinkage cap).

Argument Description
Path polaris.json.
World The world whose tractor.json soil the Ranger drives on.
Overrides Dotted key -> value.
Occupants 0..6, or negative for the file's.
P Receives the parameters.
Error Why it failed (may be null).

Returns: False on a read error or an unknown override key.

bool LoadPolarisParameters(const std::string& Path, const FAcresWorld& World, const std::map<std::string, double>& Overrides, int Occupants, AcresSim::FUtvParameters& P, std::string* Error = nullptr);

FAcresPolarisStepInfo#

struct FAcresPolarisStepInfo

What one physics step did, for the environment's accounting.

Name Type Unit Default Description
CrushedByWheelsM2, CrushedByBodyM2 double Crop crushed this step by the tyres and by the body, m2.
WheelClass, WheelField int Surface-map class and field (4 m raster) under each wheel's contact (-1 / 0 when airborne).
Grounded int 0 Wheels on the ground.
Stamps FAcresFarmStamp The stamps applied this step (4 tyres, then the body; Count of them valid).

FAcresPolaris#

class FAcresPolaris

One simulated Ranger. See the file comment.

Name Type Unit Default Description
S AcresSim::FUtvState Model state (engine, CVT, wheels, ledger, drive-by-wire reports).
Com, Velocity, AngularVelocity FVec3 Chassis: centre of mass (world, m), orientation (world <- body), centre-of-mass velocity (world, m/s), angular velocity (world, rad/s).
AccelerationBody FVec3 Body-frame acceleration of the centre of mass over the last step (kinematic, gravity excluded), m/s2.
Steps long long 0 Physics steps and time since the reset.
ComBody, MountBody, FootprintBody FVec3 Body-frame geometry: centre of mass relative to the body origin, suspension mounts, base_footprint, m.

FAcresPolaris::Init#

Uses parameters (copied: each vehicle may carry its own hardware shifts) and resets at the origin.

void Init(const AcresSim::FUtvParameters& Parameters);

FAcresPolaris::Reset#

Places the vehicle and resets the model and drive-by-wire state.

Argument Description
World For the terrain height. X, Y: base_footprint (rear-axle midpoint) position, ENU m.
YawRad Heading, rad counter-clockwise from east.
SpeedMps Forward start speed (wheels spun up, CVT and engine as a gripping belt; the game's rolling reset).
bSettled True places the chassis on the terrain plane under its wheels at the static ride height (no transient); false drops it level from 0.2 m above the rest height as the game's reset does.
Gear Gearbox position at the start (AcresSim::EUtvGear; the game's lever default is L).
DriveMode AWD switch (AcresSim::EUtvDriveMode).
void Reset(const FAcresWorld& World, double X, double Y, double YawRad, double SpeedMps = 0, bool bSettled = true, int Gear = AcresSim::UtvGearLow, int DriveMode = AcresSim::UtvDriveAllWheel);

FAcresPolaris::Step#

Advances one physics step.

Argument Description
Dt Step, s (1/120 in the game).
Command This step's drive-by-wire commands and driver inputs (ds_dbw semantics; the ...Fresh flags mark a message arriving this step).
World The static world.
Conditions Soil-water scenario.
Farm This environment's farm marks (null: no crop or ruts).
Info Receives what the step did (may be null).
void Step(double Dt, const AcresSim::FDbwCommand& Command, const FAcresWorld& World, const FAcresConditions& Conditions, FAcresFarmState* Farm, FAcresPolarisStepInfo* Info = nullptr);

FAcresPolaris::Parameters#

Parameters in use.

const AcresSim::FUtvParameters& Parameters() const ;

FAcresPolaris::BaseFootprint#

base_footprint (the rear-axle midpoint on the ground at the static ride height) in the world, m, and its orientation (the body's).

FVec3 BaseFootprint() const;

FAcresPolaris::Yaw#

Heading of the body's forward axis, rad counter-clockwise from east; pitch (nose up positive) and roll (left side up positive), rad.

double Yaw() const;

FAcresPolaris::VelocityBody#

Velocity and angular velocity in the body frame (FLU), m/s and rad/s.

FVec3 VelocityBody() const ;

FAcresPolaris::Speed#

Forward speed (body x), m/s.

double Speed() const ;

FAcresPolaris::KineticEnergy#

Chassis kinetic energy (translation and rotation), J.

double KineticEnergy() const;