Skip to content

AcresPathObjects.h#

Acres/Source/Acres/AcresPathObjects.h Generated

Objects on the path that are not in the map: a truck, a tractor and a car (each a box) and a person (an upright cylinder), the objects of ACRES Core (Core/Source/AcresCoreBatch.h, FAcresObject; Documentation/Models/farm-traffic.md), in the game.

The control channel places them (operation "objects": set, list, clear, load), and the command line loads a scenario file (-PathObjects=<file>, written by Learning/acres_learn/envs/objects.py, ObjectSet.scenario). An object is an actor with a kinematic collision box (the profile BlockAll: the vehicle hits it and PlanBoxOverlaps finds it; the box is 0.15 m smaller on each side than the object, so that the contact rule is true first), the meshes that the simulated LiDAR sees (a truck: the motorhome of the NPC cars scaled to the box, tag ACREVehicle; a person: the engine cylinder, tag ACREPerson), no physics of its own. In each frame it moves with its velocity, as ACRES Core moves it in each physics step. A tractor is the tractor of the level (the parts with the tags VehicleBody and VehicleWheel<n>, as the tractors of the farm life) and a car is the pick-up of the farm life, each scaled to the box of its row, with the tag ACREVehicle. A contact of the plan box of the vehicle with an object uses the rule of ACRES Core (PlanBoxTouchesObject of AcresCoreBatch.h, the same code), not a Chaos overlap, so that the game and ACRES Core log the same collision event. The episode log gets the objects after each frame on the topic /sim/objects (AcresLog::FPathObjects), with the events enter, leave and collision.

With a scenario file the game runs the scripts of the objects (static, temporary, crossing, along) as envs/objects.py runs them. The place of the vehicle on the leg of an object (the trigger of crossing and along) is the station of the vehicle along the path (FAcresPathObjects::TrackVehicle): the legs in sequence, and on a leg the largest arc length so far, found in a window about the last station as the mission tracker finds its progress point. The game has no mission automaton: a leg ends when the station is in its last 2 m. The cross-check of a mission pushes the rows of the Python scripts in lockstep (objects set) and does not use the scripts of the game.

Name#

The name of a kind ("truck", "person", "tractor", "car"); "truck" for a number that is not a kind.

const TCHAR* Name(int Kind);

Of#

The kind of a name; -1 for a name that is not a kind.

int Of(const FString& Name);

DefaultSize#

The default size of a kind (the sizes of path_objects_v1.json), m.

void DefaultSize(int Kind, double& LengthM, double& WidthM, double& HeightM);

Snapshot#

The boxes of the objects that are in the world now. Any thread.

void Snapshot(TArray<FAcresPathObjectBox>& Out);

Ray#

The ray from OriginM along the unit vector Dir against a box.

Returns: True when the ray enters the box before LimitM. OutT is the distance, m, and OutNormal is the normal of the face.

bool Ray(const FAcresPathObjectBox& Box, const FVector& OriginM, const FVector& Dir, double LimitM, double& OutT, FVector& OutNormal);

FAcresPathObjectRow#

struct FAcresPathObjectRow

One object as the control channel and the log name it: the row of ACRES Core with its id.

enum#

enum : int

The kinds of an object, with the numbers of the library (skills.h, AcresRtActorKind).

Value Description
Truck
Person
Tractor
Car
Count

FAcresPathObjectBox#

struct FAcresPathObjectBox

The full box of one object in the world, for the CPU LiDAR. The physics box of the object does not block the trace channel of the CPU LiDAR (the wheels use that channel too), thus the LiDAR tests its rays against this box.

FAcresPathObjectScript#

struct FAcresPathObjectScript

The script of an object of a scenario file (envs/objects.py, PathObject and ObjectSet.step).

AAcresPathObject#

class AAcresPathObject : public AActor

One object on the path in the world.

AAcresPathObject::Setup#

Builds the collision box and the meshes for the row, and places the object.

void Setup(const FAcresPathObjectRow& InRow);

AAcresPathObject::Apply#

Takes the pose and the velocity of a row (the size stays) and places the object.

void Apply(const FAcresPathObjectRow& InRow);

AAcresPathObject::Move#

Moves the object with its velocity.

void Move(double Dt);

AAcresPathObject::Place#

Puts the actor at the row: the base on the ground at the centre, upright, the yaw of the row.

void Place();

AAcresPathObject::BaseZ#

The ground under the centre, m.

double BaseZ() const;

AAcresPathObject::SetPresent#

Shows or hides the object, with its collision and its box for the CPU LiDAR.

void SetPresent(bool bPresent);

AAcresPathObject::SetSolid#

Sets the collision of the physics box. The replay shows an object without collision.

void SetSolid(bool bSolid);

FAcresPathObjects#

class FAcresPathObjects

The objects on the path of the session. Owned by FAcresSimControl; game thread.

FAcresPathObjects::Set#

Replaces the objects: an object that keeps its id keeps its actor, its size and its contact state.

bool Set(const TArray<FAcresPathObjectRow>& Rows, FString& Error);

FAcresPathObjects::Clear#

Removes every object.

void Clear();

FAcresPathObjects::List#

The objects now.

TArray<FAcresPathObjectRow> List() const;

FAcresPathObjects::SetSolid#

Sets the collision of each object (AAcresPathObject::SetSolid).

void SetSolid(bool bSolid);

FAcresPathObjects::ResetLog#

Forgets the rows of the last frame: the next frame writes an enter event for each object in the world (the start of a recording).

void ResetLog() ;

FAcresPathObjects::NeedsTick#

True while a frame has work: an object in the world, or the leave events of the last objects.

bool NeedsTick() const ;

FAcresPathObjects::LoadScenario#

Loads a scenario file (ObjectSet.scenario of envs/objects.py): the objects and their scripts.

bool LoadScenario(const FString& Path, FString& Error);

FAcresPathObjects::StepScripts#

Step the loaded scripts with an external vehicle observation. Subsequent ticks only apply their poses.

bool StepScripts(double Dt, double X, double Y, double Yaw, double Speed, int Leg, double Station, FString& Error);

FAcresPathObjects::Tick#

One frame: the scripts (with the vehicle), the motion, the contact, the log.

Argument Description
Dt The simulation time since the last call, s (the physics step in lockstep).
Vehicle Agent 0 (its base_footprint after the step).
Log The episode log, or null. TimeS, Step: The world time and the step key of the frame for the log.
void Tick(double Dt, const AAcresVehiclePawn* Vehicle, AcresLog::FEpisodeWriter* Log, double TimeS, uint64 Step);