AcresSession.h#
Acres/Source/Acres/AcresSession.h Generated
A simulation session as configured in the front-end menu, and how it becomes a running simulation.
Every value the menu can edit is described once, in a parameter table in AcresSession.cpp: which tab shows it, its label and display unit, its physical limits, and the JSON path it overrides in one of the shipped configuration files (environment.json, sensors.json, tractor.json in Content/Simulation) or a launch flag. The menu UI, validation, saving and session start-up all read that one table, so adding a setting is one line.
Starting a session (Prepare) writes per-session copies of the configuration files into Saved/Sessions/<stamp>-<mode>/ and returns extra command-line arguments. The menu then reloads the map with those arguments; the simulation itself only ever reads files and flags, it never talks to the menu.
Parameter ids look like "trac:vehicle.mass_kg": a prefix for the file ("env", "sen", "trac"), or "flag", "npc" and "opt" for values that are not in a file, then the JSON path inside that file.
EAcresSessionMode#
Which kind of session the menu is configuring.
| Value | Description |
|---|---|
Simulation |
Full simulation: sensors and session logging on. |
Pilot |
Free drive: no sensors, no logging. |
Replay |
Drive a recorded session or command file (see AcresReplay.h). |
Optimizer |
Run Optimizer: planning only, no simulation is started directly. |
EAcresParamKind#
How a parameter is edited in the menu.
| Value | Description |
|---|---|
Number |
Spin box with decimals. |
Integer |
Spin box, whole numbers. |
Toggle |
Check box; stored as 0 or 1. |
Choice |
Drop-down list; stored as a string. |
FAcresParam#
One editable setting: one row of the menu's parameter table.
The table is a static array of these in AcresSession.cpp. All strings are static literals (TCHAR is Unreal's character type, wide on Windows).
| Name | Type | Unit | Default | Description |
|---|---|---|---|---|
Tab |
const TCHAR* |
Tab: menu tab name ("Weather"). Group: heading within the tab. Id: parameter id ("env:wind.speed_mps"). Label: text shown to the user. Unit: display unit ("km/h"). | ||
Kind |
EAcresParamKind |
Editor widget type. | ||
Min |
double |
See above. | ||
Max |
double |
Allowed range in display units. | ||
Step |
double |
Spin-box increment in display units. | ||
Scale |
double |
Display value = file value x Scale (for example 3.6 turns m/s in the file into km/h in the menu). | ||
Choices |
const TCHAR* |
For Choice: "value=Label|value=Label|..." (the label part is optional). | ||
EnabledBy |
const TCHAR* |
Condition for the row to apply: a toggle id ("sen:lidar.enabled"), "id=value" or "id!=value" for choices, or nullptr for always. | ||
Help |
const TCHAR* |
Tooltip / hint text, or nullptr. |
FAcresSessionIssue#
A validation finding shown under the menu's tabs.
| Name | Type | Unit | Default | Description |
|---|---|---|---|---|
bError |
bool |
True for an error (blocks Start), false for a warning. | ||
Message |
FString |
Message for the user, starting with the area ("Tractor: ..."). |
FAcresSession#
The menu's configuration: parameter values, per-field setup, replay choice.
Values are kept in display units (what the user sees). They start from the shipped JSON files (ResetToDefaults), change as the user edits, and are written back into file units when a session starts.
Example
FAcresSession Session;
Session.ResetToDefaults();
Session.Set(TEXT("env:temperature.high_c"), 31); // degrees C
Session.SetChoice(TEXT("env:clouds"), TEXT("overcast"));
FString Cmd, Dir, Error;
if (Session.Prepare(EAcresSessionMode::Simulation, Cmd, Dir, Error))
AcresMenu::StartSession(World, Cmd); // reload the map with the new arguments
| Name | Type | Unit | Default | Description |
|---|---|---|---|---|
Fields |
FAcresFieldSetup |
Fields tab: per-field crop, soil and wetness overrides and terrain edits. | ||
ReplayFile |
FString |
A session folder, tractor.csv or command CSV to replay. | ||
ReplayMode |
FString |
TEXT("commands") |
"commands" or "path". |
FAcresSession::Params#
The full parameter table, in menu order.
FAcresSession::Find#
Looks up a parameter by id.
Returns: The table row, or nullptr if the id is unknown.
FAcresSession::ChoiceValues#
The stored values of a Choice parameter ("clear", "fair", ...), in table order.
FAcresSession::ChoiceLabels#
The display labels of a Choice parameter, same order as ChoiceValues.
FAcresSession::ResetToDefaults#
Loads every value from the shipped JSON files and makes them the defaults.
Also clears the field setup. Values that are not in a file (flags, NPC and optimizer settings) get fixed defaults from AcresSession.cpp.
FAcresSession::Get#
Current value of a Number, Integer or Toggle parameter, in display units (0 if unknown).
FAcresSession::GetChoice#
Current value of a Choice parameter (empty if unknown).
FAcresSession::GetToggle#
True when a Toggle parameter is on.
FAcresSession::Set#
Sets a numeric parameter.
| Argument | Description |
|---|---|
Id |
Parameter id. |
DisplayValue |
New value in display units. Clamped to the table's range; rounded for Integer and Toggle. |
FAcresSession::SetChoice#
Sets a Choice parameter to one of its stored values (not validated here).
FAcresSession::IsDefault#
True when the parameter still has its shipped default (the menu shows changed values in green).
FAcresSession::IsActive#
True when the row's EnabledBy condition holds (and its parent's, recursively).
FAcresSession::Validate#
Checks the configuration before a session starts.
Covers range limits and physics consistency: engine power vs torque x speed, static stability, front-axle load with a mounted implement, implement draft vs traction, rain intensity, dates, sensor throughput, custom soil ordering, replay file readability, optimizer slip band and work hours.
| Argument | Description |
|---|---|
Mode |
Session type; sensor checks are skipped for Pilot and Optimizer. |
Returns: Every finding; any entry with bError blocks the Start button.
FAcresSession::Save#
Saves all values and the field setup as a named preset in Saved/Configs/<Name>.json (terrain edits in <Name>.terrain.f32).
Returns: False with Error set if the name is empty or the file cannot be written.
FAcresSession::Load#
Loads a preset saved with Save. Unknown ids are ignored, so presets from older versions still load.
FAcresSession::SavedNames#
Names of the saved presets (without extension), sorted.
FAcresSession::ToJson#
All values and the field setup as JSON (the format Save writes).
FAcresSession::Prepare#
Validates the configuration and writes a session folder, ready for the simulation to read.
Writes environment.json, sensors.json and tractor.json (shipped files with this session's overrides), session-config.json and the field setup into Saved/Sessions/<stamp>-<mode>/, and builds the command-line arguments that make the simulation use them (-VehicleDemo, -EnvConfig=..., -SensorRecord, ...).
| Argument | Description |
|---|---|
Mode |
Session type; decides logging and sensor flags. |
OutCommandLine |
Extra arguments to append to the launch command line (no map name). |
OutDir |
Absolute path of the new session folder. |
Error |
Set when validation fails or a file cannot be written. |
Returns: True when the folder is complete.
FAcresSession::LoadFromSessionFolder#
Loads the settings a logged session ran with (its session-config.json and field setup), keeping the current replay choice.
Returns: False with Error set if the folder has no session-config.json.
FAcresSession::RecentSessions#
Session folders under Saved/Sessions that contain a tractor.csv, newest first.
| Argument | Description |
|---|---|
Max |
Maximum number of folders to return. |