Skip to content

CoreSimServer.h#

ROS/acres_core_sim/include/acres_core_sim/CoreSimServer.h Generated

ACRES Core behind the game's local protocols: the Polaris of ACRES Core (Core/Source, FAcresBatch with one environment per agent) served on the same three kinds of socket the packaged game opens, so the ROS 2 bridge (ROS/acres_sim sim_bridge) and every other client of those sockets talk to it unchanged:

  • per agent, the binary sensor stream (AcresSensorStream.h, -SensorStream=): hello, a clock frame every physics step, INS epochs at 100 Hz (CoreSimIns.h), the Helios cloud at 10 Hz from the Core's ray-cast LiDAR (AcresCoreLidar.h, 1800 x 32 organized, x y z intensity), lockstep barriers; no camera frames (no renderer);
  • per agent, the JSON RL / drive-by-wire bridge (AcresRlBridge.h, -RlPort=): the ds_dbw commands and resets in (CoreSimDbw.h), 50 Hz "dbw_report" lines and barriers out;
  • the simulator-control channel (AcresSimControl.h, Documentation/Reference/sim-control.md, -SimControl=): state, lockstep steps with progress events and barriers, resets, entities and props, named poses, conditions (soil water; the clock and weather are recorded but the Core has no sky), vehicle shifts, the episode log (the game's writer through Core's FAcresEpisodeLog), farm state and field queries from the Core's crop and rut accounting.

Modes: free-running at Rate times real time (1 = real time; 0 = as fast as the CPU allows), the physics clock paced against CLOCK_MONOTONIC with the game's frame clamp (at most 12 steps at once; a simulation that falls behind slows down rather than catching up); or held (paused) and advanced only by step requests (lockstep). Commands map onto the physics steps by their arrival time as in the game (AcresCommandTiming.h), in lockstep onto the next step.

Threads: one simulation thread runs the loop, every step and every control operation; each port has its own I/O and sender threads (CoreSimNet.h); LiDAR scans run on a small pool and are sent in order (a step request waits for the scans that fell due in it before its barrier).

FServerOptions#

struct FServerOptions

Command-line options of core_sim.

Name Type Unit Default Description
Root std::string Repository root (Acres/Content/Simulation, Core/Data).
Agents std::vector<std::string> Agents (one Polaris each) and their ports; ControlPort 0: no control channel.
Spawns std::vector&lt;std::string> Spawn of each agent: "place:<id>" (places.json), "utm:<easting>:<northing>:<heading deg>" (heading clockwise from UTM grid north, as the game's -Vehicles=polaris@utm:...), "enu:<x>:<y>:<yaw deg>"; empty: the ICSC garage.
bLockstep bool false Start held (lockstep); free-run rate (1 real time, 0 unlimited); largest number of steps one pass may run.
PolarisSet std::string Polaris parameter overrides "key=value;key=value" (the game's -PolarisSet=).
bLidar, bSensorNoise bool LiDAR on, its worker threads; sensor noise (the game's -SensorNoNoise turns it off).
EpisodeLog std::string Episode log from the start ("": none).
CommandLine std::string The command line, for the episode log's metadata.

FCoreSimServer#

class FCoreSimServer

The server. See the file comment.

Name Type Unit Default Description
Dt static constexpr double 1. / 120 Physics step, s (1/120).

FCoreSimServer::Init#

Loads the world, places the agents, opens the ports.

bool Init(const FServerOptions& Options, std::string* Error);

FCoreSimServer::Run#

Runs the simulation loop until RequestStop (or a set_state 3).

void Run();

FCoreSimServer::RequestStop#

Stops Run (any thread; async-signal-safe).

void RequestStop() ;