Run-Time Library#
The run-time library libacres_runtime.so is the vehicle software of ACRES. It plans the missions, drives the vehicle and checks each command. The simulators and the vehicle node use the same compiled code. The library contains ACRES Core.
The Python package is acres_fleet (acres_fleet). The ROS 2 node is vehicle_node (ROS 2 Workspace).
Folders#
| Folder | Content |
|---|---|
Vehicle/Runtime/Include/acres_runtime |
The C interface: api.h, planner.h, routes.h, skills.h, proposal.h, vehicle.h, sensors.h, scenario.h, identity.h and others. |
Vehicle/Runtime/Source |
The C++ code. |
Vehicle/Runtime/Python |
The binding module _acres_runtime (pybind11). |
Vehicle/Runtime/Lean |
The C code that the Lean proofs generate, and the checker plug-in. |
Vehicle/Runtime/Tools |
The command-line tools acres_runtime_* (Simulation Commands). |
Tests/Runtime |
The tests and their golden files. |
Vehicle/Runtime/Reference |
The simulation version (sim_version.txt) and the tools of the recorded reference. |
Config |
The configuration files that the library reads (Files and Formats). |
The Units#
| Unit | Source | Function |
|---|---|---|
| Mission planner | Vehicle/Runtime/Source/planner.cpp |
An exact dynamic program over the sets of fields. It finds the cheapest route from the home pose H through the fields, from the cost tables. |
| Routes | Vehicle/Runtime/Source/route_*.cpp |
The path of a mission on the map: the transit graph, the scout loops, the entries and the turns. |
| Default driver | Vehicle/Runtime/Source/driver.cpp |
Pure pursuit on the mission path with its speed profile, and the projection onto the active leg. |
| Shield | Vehicle/Runtime/Source/shield.cpp, sweep.cpp |
Limits each command: the actuator limits, the corridor and the obstacle distances from the scan. |
| Command chain | Vehicle/Runtime/Source/command_chain.cpp |
The speed envelope, the mission automaton, the scan of the shield, the launch hold, the gear logic and the command row of one control step. |
| Trajectory checker | Vehicle/Runtime/Source/checker.cpp, Vehicle/Runtime/Lean |
Checks a proposed path chunk against the corridor and the limits. The checker is the compiled form of a Lean model. |
| Skills | Vehicle/Runtime/Source/skills.cpp |
The skills goto, scout, return_home, wait, stop and continue of each vehicle of a world. |
| Fleet | Vehicle/Runtime/Source/fleet.cpp |
Many missions in parallel slots, with their scores. |
| Vehicle handle | Vehicle/Runtime/Source/vehicle_*.cpp |
The chain with the inputs of a real or a recorded vehicle. |
| Scenario generator | Vehicle/Runtime/Source/scenario_gen.cpp |
Other actors (persons, trucks, tractors, cars) on the path of a mission, from a seed. |
| Identity | Vehicle/Runtime/Source/identity.cpp |
The map hash and the simulation version of a result. |
One Control Step#
A control step is 0.1 s. In each control step of a driving skill, the library does these steps:
- The tracker moves to the pose of the last command.
- The default driver makes its command from the mission path.
- A proposed path chunk replaces the command of the driver only when the checker accepts the chunk.
- The command chain applies the launch hold, the shield with the scan, and the gear logic.
- The physics of ACRES Core (or the real vehicle) runs.
A skill request or a proposed chunk cannot go around the command chain. The chain keeps the launch hold, the shield, the gear rules and the limits.
The Chain#
Default Driver#
The default driver is pure pursuit (driver.cpp). It aims at the path point one look-ahead distance ahead of the nearest path point.
\(L_{min} = 4\) m, \(k_L = 0.6\) s and \(L_{max} = 9\) m (scouting.json). In reverse, the look-ahead is a constant. \(\kappa_{max}\) is 0.2 1/m, the curvature limit of the shield. The speed command is the lowest value of the speed profile between the vehicle and a preview point. At the end of a path the command decreases to 0 before the last point. Thus the vehicle comes to a stand at the end.
Corridor and Trajectory Checker#
The route and the ground-class raster of the map give the corridor (corridor.cpp). Lane and verge cells can join it. Other classes join it only with the class of the route and the local reach rules. Obstacle cells never join it. Each cell stores a lower bound \(d_c\) of the distance from its center to excluded ground. A query at the point \(p\) takes the largest valid bound of the cells \(c\) near it:
The distance function changes by at most the distance between two points. Thus each term stays a lower bound. The stored values round down to float32. corridor_query.h gives the queries. Vehicle/Proofs/AcresVerification/Trajectory/Raster.lean has the proof of the bound.
A proposer gives chunks: offsets from the route and speeds at fixed stations along the route. The library converts a chunk into the input of the checker. The C types are in Vehicle/Runtime/Include/acres_runtime/types.h. A chunk keeps the current start state and ends with a possible stop. A change of direction needs separate parts.
The checker gives a verdict, a reason and the first failing index for each chunk. The limits are in Config/trajectory.json.
| Reason | Check |
|---|---|
malformed |
Shape, finite values, sample count and station step |
step, direction |
Distance between samples, one direction of travel |
speed |
Configured and ground-class speed limits |
start, stop |
Start pose, heading and speed. Stop distance from the planned speeds and from the measured speed at the start. |
acceleration, deceleration |
Speed change between samples |
curvature, curvature_rate, steering_rate, start_curvature |
Turn geometry, the curvature change and the steering response |
lateral_acceleration |
Lateral acceleration limit |
obstacle, point, corridor |
Obstacle distance and footprint containment |
The shield adds an obstacle margin to the stopping distance:
The trajectory checker uses the distance after removing the obstacle margin from this formula. It accounts for clearance in its box checks. The bounds assume sound localization, geometry, perception and braking.
Shield#
The shield (shield.cpp) limits the command of each control step with four rules: the actuator limits, the geofence, the corner rule and the obstacle rule. It changes a command only when the command breaks a rule. It never increases the speed and never reverses it.
Obstacle rule. The shield measures the free distance \(d_{obs}\) to the nearest return of the scan in the swept corridor. It takes the smallest of three distances:
- along the arc of the command curvature,
- along the arc of the reference curvature,
- along the reference path, or along the line of an accepted chunk.
A chunk that ends in a bend goes on along the curvature of its end, at most a quarter turn. It goes on as far as the stop distance at the fastest speed of the step, with the response distance and the plan box. A chunk that ends straight goes on straight along its last segment, as far as the sweep reaches.
The speed limit is the largest speed that stops inside that distance:
The response distance \(\lvert v \rvert \times\) corridor.response_s (0.5 s) shortens the free distance. Thus the speed cap accounts for the delay and the rate of the brake.
Swept corridor. The half width of the corridor of the obstacle rule grows with the measured speed (sweep.cpp):
\(m_v = 0.8\) m is the vehicle margin, \(G = 0.3\) m the geofence margin and \(E = 0.32\) m the extra side margin. \(t_n = 0.075\) s and \(f = 0.1\) m (control.json). The full side margin of 0.62 m comes at 4 m/s. A narrow lane gives a lower speed, not a stop. The geofence rule keeps the margin \(G\).
On the vehicle the cross-track error widens the corridor on the side of the vehicle only. Thus a vehicle that runs wide in a bend does not widen the corridor over the inside of the bend. The simulator and the training keep the corridor of the Python chain, widened on both sides.
Corner rule. The shield limits added speed using the lateral acceleration cap at the output curvature. The rule can preserve the higher base speed.
Scan. The shield reads a planar scan of 360 beams with a configured reach of 40 m. The envelope proof uses 40 m of free distance when the scan gives no return (no_return_is_safe).
Shield of the Tractor#
The Case Maxxum 150 has its own shield parameters for each implement and each state of an implement (a pairing, Config/shield_tractor.json). Vehicle/Runtime/Tools/shield_tractor_values.py makes the file. The rules R6a to R10 are in Formal Verification.
Function (sensors.h) |
Use |
|---|---|
acres_runtime_load_shield_tractor |
The shield parameters of a pairing. A refused pairing gives ACRES_RT_ERROR_ARGUMENT. |
acres_runtime_load_sweep_tractor |
The swept corridor of the obstacle rule for a pairing. The plan box holds the tractor and its loader, its mounted implement or its trailer (the hitch straight). The LiDAR mount is that of the Maxxum. The other values come from Config/control.json. |
acres_runtime_implement_input |
The one definition of an engaged implement. These states are engaged: no known state, the hitch below the auto-PTO lift angle, the PTO on, a work flow on. A NaN lift angle counts as lowered. |
Bodies with sides. Since 19 November 2026 (ABI 6) the shield parameters have the extent of the body to each side of the vehicle (body_left_m, body_right_m). The fence of rule R6a uses the extent on the side of the vehicle that faces each side of the path. The pairings mower_left, mower_right, cutter_left_raised and cutter_right_raised have different extents (for example 4.6 m to the left and 1.3 m to the right). The other pairings have the vehicle margin on both sides. The obstacle rule keeps the vehicle margin, the larger extent, on both sides.
Transport speed caps. Since 19 November 2026 the top speed of each pairing (speed_max_mps) is the cap of the table of 14 November 2026. It is the cap of the same vehicle and implement state in the fast simulator (SPEED_CAPS of Fast/acres_batch/vehicle.py), at most 7.8 m/s. Examples: the tractor alone 6.7 m/s, the sprayer 4.0 m/s, the round baler 3.0 m/s. The owner approved the table on 19 November 2026.
The distance of no return keeps the top speed of 7.8 m/s (the owner kept the 40 m): no_return_speed_mps of the block sweep. test_transport_caps_of_the_shield_are_the_fast_simulators compares the two caps for each pairing.
The command to lower. The definition of "engaged" counts the command to lower the implement as a work flow (work). The owner accepted this on 19 November 2026: it is the conservative side. T2 gives this command.
The Python module has the same functions: ShieldTools(config_dir, pairing) with engaged and shield_scan (the arguments lift_rad, pto, work, hitch_angle_rad). T2, T3 and T6 use it (Benchmark/acres_bench/tractor/shield.py).
Distance of no return. A beam with no return gives an infinite distance only if a stop from the top speed ends inside the reach of the scan. The tractor does not satisfy this condition. A stop from 7.8 m/s needs 51.2 m (the brake 0.8 m/s², the latency 1.0 s, the response time 0.5 s). Thus no_return_m is the reach (40 m). A scan with no return limits the speed of the tractor alone to 6.7 m/s.
| Pairing (examples) | front_m |
rear_m |
Source |
|---|---|---|---|
| The tractor alone | 3.4 | 1.0 | TRACTOR_BOX of Fast/acres_batch/vehicle.py |
| The loader | 5.6 | 1.0 | LOADER_BOX (the tips of the spears) |
| The chisel plow | 3.4 | 2.6 | IMPLEMENT_BOXES |
| The square baler | 3.4 | 7.48 | TRAILERS: the pin 0.98 m behind the axle, 3.885 m to the axle of the baler, 2.615 m to its rear |
The LiDAR mount is (1.15 m, 0 m) from the rear axle for each pairing (sensors_maxxum.json, assumed). A towed implement is in line behind the tractor in the plan box. In a turn the trailer goes inside the path of the tractor, and the half width of the corridor does not include this off-tracking. Rule R6b limits the off-tracking to the room of the trailer.
Speed Envelope#
The speed envelope gives the shield and the checker their limits for each ground class (Config/envelope.json). The limits are a speed, a deceleration, an obstacle margin and a lateral limit. A measurement of the simulated Polaris in ACRES Core gives the limits (speed_envelope.py of the private Polaris calibration tools).
The table shows the grip level unknown: the worst value of each limit over all ground states of the model. It is the default, because the vehicle has no soil sensor.
| Class | Speed Command (m/s) | Speed of the Vehicle (m/s) | Deceleration \(a\) (m/s²) | Obstacle Margin \(d_m\) (m) | Lateral Limit (m/s²) |
|---|---|---|---|---|---|
| Asphalt, concrete | 6.9 | 7.8 | 1.2 | 2.5 | 1.5 |
| Gravel | 6.9 | 7.8 | 1.2 | 2.4 | 1.5 |
| Grass lane | 6.9 | 7.8 | 1.2 | 2.6 | 1.5 |
| Dirt | 7.1 | 7.8 | 1.2 | 2.1 | 1.5 |
| Grass | 4.9 | 5.6 | 1.2 | 2.6 | 1.5 |
| Field | 5.0 | 5.6 | 1.2 | 2.6 | 1.5 |
The grip level dry gives 0 m/s to 0.1 m/s more speed command. A path point with no known class gets the worst value of each limit over the classes. The limits come from these rules:
- Deceleration. 0.8 of the lower of the measured stop deceleration and the limit of the speed controller (1.5 m/s²). This gives 1.2 m/s² for each class.
- Stop time. \(T = 1.0\) s: the latency of a stop (0.5 s) and the response of the speed controller (0.5 s).
- Obstacle margin. 1.5 m, plus the longest measured tail of a stop, plus the addition that a follow test needs to keep 1.5 m from a wall.
- Speed. The lowest of three values:
- the speed cap of the project: 7.8 m/s on roads and lanes, 5.6 m/s on soft ground,
- the largest speed with \(d_{stop} \le 40\) m,
- the largest speed with no wheel lift in a steering step.
- Speed command. The speed of the vehicle less the largest overshoot of the speed controller.
Stop and Hold on a Slope#
A stop command (a speed command of 0) brings the vehicle to a stand also on a slope. Two parts of the model do this.
- End of a commanded stop. The speed command and the speed reference are 0. The brake demand of the ULC then gets an integral of the speed that is left (
dbw.ulc.stop_integral_per_s, 2.0). The brake stays while the vehicle stands, and not below the stop brake of 20 %. - Standstill hold. The tire model has no static friction at zero speed. Below
dbw.ulc.hold_speed_mps(0.05 m/s), while the ULC holds the stop brake, the hold removes the horizontal velocity of the chassis (Polaris Ranger).
Worked Example#
Stop distance on asphalt. The fastest entry of the envelope is 7.8 m/s with \(d_m = 2.5\) m, \(T = 1.0\) s and \(a = 1.2\) m/s²:
This is inside the reach of 40 m of the scan, with 4.35 m to spare.
Speed cap for an object. On gravel (\(d_m = 2.4\) m) an object is 20 m ahead. The cap solves \(2.4 + v + v^2/2.4 = 20\):
Corridor half width. At 2 m/s: \(w = 0.8 + \min(0.62,\ \max(0.1,\ 0.155 \times 2)) = 1.11\) m. At 4 m/s and faster: \(w = 1.42\) m.
Pure pursuit. At 5 m/s the look-ahead is \(L_d = 4 + 0.6 \times 5 = 7\) m. A look-ahead point at \((x_b, y_b) = (6.9, 1.0)\) m gives:
Validation#
- Formal proofs. The rules of the shield, the speed envelope and the checker have Lean proofs (Formal Verification). The proofs are about the command, not about the motion of the vehicle.
- Stop on a slope. The test
hold_testsstarts at 3 m/s and keeps the stop command for 45 s. It uses planes of 3.2 %, 5 % and 8 %, uphill and downhill, and 16 steep windows of the lanes of the map (to 9.0 %). Each of the 114 runs in the three condition sets is at rest in 3.7 s or less. It moves 9 mm or less in the 30 s after it. - Measured stops. In ACRES Core a stop from 7 m/s takes 14.4 m to 18.4 m on all classes and ground states. The grip does not limit a stop: the speed controller limits the deceleration to 1.5 m/s².
- Steering step. A curvature step to 0.2 1/m at the held speed rolls the vehicle over at 7.8 m/s on each class. With the corner rule of the shield no step rolls the vehicle over. The largest lateral acceleration is then 3.9 m/s².
Limits of the Chain#
- The shield has no model of a moving object. At the speeds of the envelope, the default driver collides with a crossing person in 12 of 30 scenarios. It collides with an oncoming vehicle in 1 of 30.
- The distance along the reference path supposes that the vehicle follows its path. An object that moves into the path has no such guarantee.
- No component makes a live grip estimate. The chain uses the conservative grip level
unknown. - Some reference loops of the map have more than the curvature limit of 0.2 1/m. A proposer needs a feasible trajectory inside the corridor. Do not increase the checker limits to accept a reference path.
- The end of a commanded stop uses an estimated gain. No recording of the real speed controller gives it.
- A fit to drives on roads gives the vehicle model. No recording gives the grip of wet grass or of a water film on a road.
References: Coulter, R. C. (1992), Implementation of the Pure Pursuit Path Tracking Algorithm, Technical Report CMU-RI-TR-92-01, Robotics Institute, Carnegie Mellon University. Dataspeed Inc., Drive-by-Wire System Overview: the control modes of the Polaris Ranger and the ULC.
Fleet and Skill World#
A fleet has one batch of ACRES Core with N environments. One environment is one slot with a mission, the state of the command chain, the tracker and a ring of the last scans (fleet.cpp). acres_runtime_fleet_step does these steps:
- The scan, the base command and the command chain of each slot (one task for each slot).
- The physics step (one task for each environment).
- The tracker (one task for each slot).
- Serially, the scores and the next missions of the queue.
The score of mission k of the queue has the index k for each order, each number of threads and each number of slots.
A caller proposes chunks with acres_runtime_fleet_propose: a side offset from the mission path and a speed at up to 64 stations. The compiled Lean checker decides each chunk. The first accepted chunk drives the next control step, through the command chain. The default driver drives when no chunk is accepted, when the answer is late (ACRES_RT_REASON_LATE), or when no checker is loaded (ACRES_RT_REASON_NO_CHECKER).
A skill world is one batch with its slots. One slot is one vehicle with its own clock, objects, mission plan, events and results (skills.cpp, skill_slot.h, object_scripts.cpp).
| Skill | Arguments | Function |
|---|---|---|
goto |
place, speed_cap_mps |
Go to the entry of a field, or to H. |
scout |
field, speed_cap_mps |
Go to the entry of a field if necessary, then drive its Scout loop. |
return_home |
speed_cap_mps |
Go to H and stop there. |
wait |
seconds |
Stand for a mission time. |
stop, continue |
Stop the vehicle. Continue the skill that ended with stopped or blocked. |
The result codes are done, blocked (the shield held the vehicle at a stop for blocked_s, 10 s), refused_plan, refused_limit, refused_request, stopped and failed. A blocked result has a counterexample: the shield rules, the obstacle distance, the hold time and the stop pose. The events are those of Config/schemas/skills.json.
corridor.scan_source of control.json sets the scan of the shield in the simulators (shield_sweep.h):
scan_source |
Scan | Time of a Control Step |
|---|---|---|
sweep (default) |
The simulated Helios sweep through the scan filter of the vehicle (scan_filter.json) |
20 ms to 30 ms for each slot |
planar |
The planar ring of ACRES Core at the LiDAR height (2.05 m). A thing lower than the mount gives no return. | Below 1 ms |
An object on the path has a script: static, temporary, crossing, along, walk, stand, emerge, headland, back_out, lead or pull_out. An object with reactive 1 gives way. A contact during a driving skill ends the skill with failed. Each contact has a class: vehicle, actor, both or rest (acres_runtime_contact_class).
Routes and Planner#
The routes (routes.h) make the prepared path of a mission from the scouting map and a plan. The route of a mission is a function of the map, the plan and the request. A request has the plan, the edge costs, the U-turn cost (default 500), the grip level, the permission to reverse, a start pose (a pose within 5 m and 45 degrees of H is a start at home) and a reverse stretch. Destroy a route handle with threads above 0 before you create a fleet, else the fleet gets ACRES_RT_ERROR_BUSY.
The planner (planner.h) reads cost tables. One .npz file for each condition set (dry, wet, shift), with 12 metrics for each directed edge and each direction of each Scout loop. The object meta of a file states the map hash, the simulation version and the slow edges. The fleet drives the tables (acres_runtime_cost_tables_drive_segments): each path has a straight lead-in of 15 m and a lead-out of 10 m. The exact program over the sets of fields takes 12 fields at most. A tie goes to the option with the lower number.
acres_runtime_plan_check applies the plan rules of the Lean model (checkProposal, Mission.checkWellFormed). When the checker plug-in is in the process, the plug-in also decides each plan, and a difference is a refusal with ACRES_RT_ERROR_INTERNAL. Simulation Commands gives the programs acres_runtime_planner and acres_runtime_baseline_all.
Vehicle Handle#
The vehicle handle (vehicle.h) is the control step of one vehicle whose pose, speed, rates and scan come from outside. The game link and the vehicle node use it. acres_runtime_vehicle_start takes a mission text and a pose: F56, F53,F12 (the planner selects the order), home (a Return alone) or goto:F53. The planner makes the plan, the plan checker is the gate (refused_plan), and the limits of the run are the last gate (refused_limit).
Call acres_runtime_vehicle_step each 0.1 s. A pose older than odom_max_age_s gives no command and the finding odom_stale. The chain runs the launch hold, the shield and the gear logic. Then the limits of the run decrease the speed: the speed cap, the lateral acceleration cap, no reverse and the operating area. The findings odom_stale, scan, area, mission, driver_error and blocked stop each run.
A model gives chunks to acres_runtime_vehicle_propose in the order of its preference. The first accepted chunk drives the next step.
Rear rule. The LiDAR of the Polaris does not see the ground behind the vehicle. The rule permits backward motion only on ground that the vehicle drove over in this run (rear of Config/reverse_test.json). The rule has these limits:
- The rear edge of the plan box stays in a plan box of the trace (
slack_m0.15 m at each side). - A trace pose is valid for 60 s.
- The longest backward stretch is 10 m, at a backward speed of at most 0.5 m/s.
- The vehicle stops 0.3 m before the end of the trace.
Config/kturn_test.json selects the observed-space mode (rear.rule=observed_or_trace). It permits a three-point turn when a grid of observed ground (cells of 0.2 m) clears the full swept body of the planned reverse.
Scan of a vehicle. connection.real_scan of control.json selects the scan of the obstacle rule. level_rings (the default) takes the returns within 1 degree of the horizontal. height_band takes the scan filter of sensors.h with the stale-scan rule. A scan that is not usable has NaN in each beam, and the shield stops the vehicle. The crop mask of the scan filter (off in scan_filter.json) drops points in standing crop of the map.
The Checker Plug-In#
The checker is a plug-in that the library loads at the first use. Without the plug-in, each verdict has the reason "no checker", and the default driver keeps the control. Runtime ABI 7 uses checker plug-in ABI 2. Rebuild both together.
| Build | Plug-in |
|---|---|
Vehicle/Runtime/build.sh |
No plug-in. |
ACRES_RUNTIME_LEAN=1 Vehicle/Runtime/build.sh |
libacres_runtime_lean.so from the Lean model. It needs the Lean tool chain of Vehicle/Proofs/. |
ACRES_RUNTIME_LEAN=generated Vehicle/Runtime/build.sh |
The plug-in from the C code in Vehicle/Runtime/Lean/Generated, with the system compiler. It needs only libleanshared.so of the Lean release. |
The plug-in has a second model: the shield (Shield.shield of the Lean model). A program that calls acres_runtime_checker_load at its start gets it. Then acres_runtime_shield and acres_runtime_shield_curvature give the answer of the Lean code, and the C++ shield of the library is the cross-check. The library writes a difference to the standard error and counts it (acres_runtime_shield_differences). It then uses the Lean answer. The load at the first use of the checker does not take the shield.
A call of the shield loads nothing. The shield of a process does not change while it runs. Without the plug-in the C++ shield decides.
| Shield call (oats5, one core, 100,000 calls) | Median | 99.9th percentile | Maximum |
|---|---|---|---|
| The C++ shield alone | 0.08 µs | 0.27 µs | 0.03 ms to 0.3 ms |
| The Lean shield with the C++ cross-check | 1.8 µs | 6.8 µs | 0.33 ms to 2.0 ms |
The maximum is noise of the operating system on a loaded computer (two clock reads alone reach 8 µs). It is below 10 % of the control period of 0.1 s. acres_runtime_shield_timing measures it.
Formal Verification describes the proofs.
A feasibility test of 8 October 2026 came before the plug-in. Its prototype folder (Vehicle/Proofs/Runtime/) was removed on 18 November 2026. These are its results.
| Question | Answer |
|---|---|
| Does it build and link? | Yes. A static link into a C++ program (4.2 MB), and a shared library (0.17 MB) that needs libleanshared.so of the tool chain (234 MB). It ran on Ubuntu 22.04 with no Lean installation. |
| Is it the same checker? | Yes, on each input of the test: 353,224 recorded trajectory checks of 28 missions and 152,410 changed copies. No difference. |
| Is it fast enough? | The model as it is: no (5 ms to 27 ms for each check). The fast form with a proof of equality: yes for the vehicle (0.27 ms to 0.52 ms for each check). The corridor queries limit the speed. |
| Cost of a port by hand | About 700 lines of C++, 4 to 5 days, and a third copy of the rules. The project did not make the port. |
Rules of the C Interface#
Source: Vehicle/Runtime/Include/acres_runtime/api.h.
- The interface has plain structures, pointers, sizes and opaque handles. No C++ type and no exception goes through it.
- Each function that can fail returns a status. After an error,
acres_runtime_last_errorgives a sentence for the thread of the call. acres_runtime_abi_version()givesACRES_RT_ABI_VERSION. Compare it with the value of your headers.acres_runtime_struct_sizesgives the size of each structure.- One process has one thread pool. Thus one process has one fleet at a time. A second fleet gets the status "busy".
- A fleet or a skill world owns the pool. A route handle with
threadsabove 0 owns it when the process has no fleet.acres_runtime_thread_count()gives its size. - Call the functions of one fleet from one thread at a time.
- A parallel loop gives one task to each slot, mission or sweep. A task writes only its own values, and no sum crosses tasks. Thus a result has the same bits for each number of threads.
- A step that needs the result of the step before it is serial.
- The math functions that are not correctly rounded in each C library go through
rt_math.h. Thus two builds give the same numbers. - The functions of
Vehicle/Runtime/Source/internal.hare not a part of the interface. The library exports them for its tests. - The ABI version
ACRES_RT_ABI_VERSIONofapi.his separate from the release number and the simulation version. Keep the public function names, arguments, meanings and structure layouts compatible with it. A breaking change of the interface needs a new ABI version.
| Status | Value | Meaning |
|---|---|---|
ACRES_RT_OK |
0 | The call is complete. |
ACRES_RT_ERROR_ARGUMENT |
1 | A null pointer, a size or an index that is not usable. |
ACRES_RT_ERROR_NOT_IMPLEMENTED |
2 | The function or the option is not available. |
ACRES_RT_ERROR_LOAD |
3 | A file of the world or of the configuration did not load. |
ACRES_RT_ERROR_BUSY |
4 | The process has a fleet or a skill world already. |
ACRES_RT_ERROR_STATE |
5 | The call is not permitted in the state of the handle. |
ACRES_RT_ERROR_INTERNAL |
6 | An error of the library. |
C++ Headers has the generated text of each declaration.
Game Link#
The library drives the packaged game, or the ACRES Core server core_sim, through two local channels on 127.0.0.1 (game.h):
- The simulator control channel (
-SimControl=<port>, Simulator Control Channel). - The JSON drive-by-wire bridge of the Polaris (
-RlPort=<port>, Vehicle Bridge).
The vehicle handle drives a mission through this client in lockstep. One control step has this order:
- The client reads the pose (
get_entity_state) and the last drive-by-wire report. - The vehicle handle makes the control step: the default driver, the launch hold, the shield and the gear logic.
- The client sends
SteeringCmd(curvature),UlcCmd(velocity) and, when the step has one,GearCmd. - The client asks for 12 physics steps (0.1 s) and waits for the barrier of the bridge.
The client holds the simulator between the control steps. Thus one program drives the game and ACRES Core, and a run gives the same numbers each time.
Note
The control channel has no LiDAR scan. The shield then gets a free scan (40 m in each beam). A mission with objects needs the LiDAR scan. Use the ROS 2 bridge and the Vehicle Node for it.
Function of game.h |
Use |
|---|---|
acres_runtime_game_connect, acres_runtime_game_close |
The client of one vehicle. It connects to 127.0.0.1 only. |
acres_runtime_game_call |
One request of the control channel as a JSON object. The reply is a JSON line. |
acres_runtime_game_send, acres_runtime_game_ok |
One message on the bridge, and the check of a reply. |
acres_runtime_game_state |
The pose, the speed, the yaw rate and the report of the vehicle. |
acres_runtime_game_advance, acres_runtime_game_barriers |
Physics steps in lockstep, to the barrier of the bridge. |
acres_runtime_game_inputs, acres_runtime_game_command, acres_runtime_game_command_text |
The inputs of a control step from a state, and the commands of a step on the bridge. |
acres_runtime_game_drive, acres_runtime_game_drive_options_default |
One mission from a world reset to its end, with the episode log and a trace. |
acres_runtime_log_measures |
The fuel, the ground loss and the path length of an agent in an episode log. |
The program acres_runtime_game_crosscheck uses these functions. These tools start it:
| Tool | Use |
|---|---|
Tools/SimControl/game_crosscheck.py |
Drives single-field missions in core_sim and in the game, then compares the results. |
Tools/SimControl/crosscheck_missions.py |
The same with the regional ground and the measures of the two episode logs. |
Tools/SimControl/check_planner_support.py |
The skill list, the clock, the observation, the events and the episode log of the game. |
The result is <folder>/crosscheck.json and a table. Two results are equal when the success, the stop findings and the order of the milestones are equal. The table gives the other measures as differences.
Identity of a Result#
Each result has the map hash of the tree and the simulation version of the build (acres_fleet.identity()). The cost tables have the same two values. The planner refuses tables of a different map.
Only Vehicle/Runtime/Reference/refresh.sh changes the simulation version, after a deliberate change of the drives (Build and Test Commands).
The build uses -O2 -ffp-contract=off -fno-fast-math, as ACRES Core does. The results are equal for each number of threads.
Build and Test#
PYTHON=$(command -v python) Vehicle/Runtime/build.sh # build, then the default tests
ctest --test-dir Vehicle/Runtime/Build -L unit # the unit tests only
The test labels are unit, static, integration and nightly. Build and Test Commands gives the options.