Build ACRES Core#
This page builds ACRES Core, runs its tests and steps one Polaris from Python. The build does not use Unreal Engine or ROS 2.
Before You Start#
Make sure that you have the repository. Install gives the procedure. The build needs the items of this table.
| Item | Requirement | Source |
|---|---|---|
| Compiler | A C++20 compiler | The system package of GCC or clang. The test workstation uses GCC 15.3.1. |
| CMake | Version 3.20 or later | The PATH, or the package cmake of the Python environment. |
| Ninja | A current version | The PATH, or the package ninja of the Python environment. |
| Python | Python 3 with its header files | A conda environment. The test record uses Python 3.12 and Python 3.13. |
pybind11 |
A current version | The Python environment. The build of the Python module uses it. |
numpy |
A current version | The Python environment. The Python module uses it at run time. |
mcap, mcap-ros2-support |
A current version | The Python environment. Only the Python test of the episode log uses them. |
The build compiles the model sources of Acres/Source/Acres and the sources of Core/Source.
It reads no asset of the game. The tests read the map products in Acres/Content/Simulation.
Note
The Python module is valid only for the Python version of the build. Build ACRES Core again when you change the Python environment.
Build and Test#
-
Activate the Python environment.
-
Install the Python packages of the build.
Expected Result
The command
python -m pip listshows the six packages. The test record usespybind113.1.0,numpy2.4.4,mcap1.5.0,cmake4.4.3 andninja1.13. -
Build ACRES Core and run the tests. Do this step in the repository root.
Expected Result
The build has 49 steps. Each test program prints its results and a summary line.
[48/49] Linking CXX shared module acres_core.cpython-313-x86_64-linux-gnu.so built /home/user/ACRES/Core/Build ACRES Core world, farm, vehicle and batch tests (/home/user/ACRES) == 1. World load (ACRE content) == [PASS] world counts: 521 surface polygons, 706104 crop patches, 59 fields (47 planted), 7 places, 7073 obstacles; loaded in 0.49 s ... 35 passed, 0 failed ACRES Core LiDAR and scene tests ... 13 passed, 0 failed acres_core Python API tests ... 13 passed, 0 failed PASS selftest: Core against itself through a session: speed RMSE 0.0001 m/s, end error 0.0087 m, 10 s windows p90 0.0636 m (5 windows) PASS selftest: 585 of 585 messages after 22 hold messages, send lag max 36 ms, reset handshake seen 2 passed, 0 failedOn the test workstation (AMD Ryzen 7 9700X, 16 threads) the build takes 6 s and the tests take 23 s.
-
Examine the build folder.
Expected Result
The folder contains the files of the table Build Products.
First Run from Python#
The Python module is the file acres_core.*.so in the build folder. Python finds it through PYTHONPATH.
-
Write this script into the file
first_core.pyin the repository root.import numpy as np import acres_core as ac b = ac.Batch(".") b.reset(None, np.array([[-38.71, -140.513, np.pi / 2, 0.0]])) # the ICSC garage, heading north for _ in range(50): # 5 s at 0.1 s for each call state = b.step_curvature_speed(np.array([0.0]), np.array([3.0])) print({name: round(float(value), 3) for name, value in zip(ac.STATE_COLUMNS[:4], state[0])}) print("speed", round(float(state[0, ac.STATE_COLUMNS.index("speed")]), 2), "m/s") -
Run the script with the build folder on the module path.
The script loads the ACRE tile, puts one Polaris at the ICSC garage and commands a speed of 3 m/s.
Each call of step_curvature_speed advances the simulation by 0.1 s, that is 12 physics steps.
The first argument of Batch is the repository root. The module reads the configuration and the map from this folder.
Python API gives all functions and all array columns.
Options of the Build#
| Name | Type | Unit | Default | Description |
|---|---|---|---|---|
--no-tests |
flag | off | Builds only. The script does not run the tests. | |
BUILD_DIR |
environment variable | Core/Build |
The folder of the build products. | |
PYTHON |
environment variable | python3 on the PATH |
The interpreter of the Python module and of the Python tests. | |
ACRES_CORE_PYTHON |
CMake option | ON |
OFF builds the libraries, the tests and the tools without the Python module. |
|
CMAKE_BUILD_TYPE |
CMake variable | Release |
The build type. The sources compile with -O2. |
The script uses cmake and ninja from the PATH.
When the PATH does not contain them, the script uses the programs in the folder of the Python interpreter.
Build Products#
| File | Function |
|---|---|
libacres_core.so |
The shared library for C++ programs. |
libacres_core_static.a |
The static library. The tests, the tools and the Python module link it. |
acres_core.cpython-<version>-x86_64-linux-gnu.so |
The Python module acres_core. |
core_tests |
The tests of the world, the farm, the Polaris, the batch and the episode log. |
lidar_tests |
The tests of the terrain ray casts, the obstacle scene and the LiDAR. |
core_replay |
A tool that replays a recorded drive-by-wire log through ACRES Core. |
lidar_compare |
A tool that makes LiDAR scans at a list of poses. |
C++ API gives the libraries, the tools and the scripts in Core/Scripts.
Tests#
Core/build.sh runs four test programs. A failed check makes the exit code of the script 1.
| Program | Checks | Scope |
|---|---|---|
Core/Build/core_tests |
35 | The world, the terrain, the surfaces, the soil water, the crop marks, the Polaris, the energy ledger, the batch, the collisions and the episode log. |
Core/Build/lidar_tests |
13 | The terrain ray casts, the obstacle scene, the Helios pattern, the planar pattern and the scan rate. |
Core/Tests/test_core.py |
13 | The Python module: the array shapes, the commands, the LiDAR, the soil water, the parameters, the zones and the episode log. |
Core/Tests/test_harness.py |
2 | The scripts that compare ACRES Core with the game. The test uses a substitute for the game. |
Run one test program alone with the repository root as its argument.
Problems#
| Message | Cause | Correction |
|---|---|---|
pybind11 not found for <python>: pip install pybind11 |
The Python environment has no pybind11. |
Do step 2 of the build again in the environment of PYTHON. |
Could NOT find Python3 (missing: Python3_INCLUDE_DIRS Development.Module) |
The Python interpreter has no header files. A system Python without its development package gives this error. | Use the Python of a conda environment. |
Core/build.sh: line 22: .../cmake: No such file or directory |
CMake is not on the PATH and not in the Python environment. |
Install the packages cmake and ninja into the Python environment. |
ModuleNotFoundError: No module named 'acres_core' |
PYTHONPATH does not contain the build folder, or the Python version is different from the build. |
Set PYTHONPATH=Core/Build. Use the interpreter of the build. |
RuntimeError: acres_core: cannot read .../Acres/Content/Simulation/tractor.json |
The first argument of Batch is not the repository root. |
Give the path of the repository root. |
Next Steps#
- Headless Core Runs: a batch of environments, the LiDAR, the episode log and ROS 2.
- Python API: the reference of the module
acres_core. - C++ API: the library
libacres_core, the tools and the scripts. - Time Stepping and Determinism: the physics step and the agreement of ACRES Core with the game.
- Build the ROS 2 Workspace: the package
acres_core_simputs ACRES Core on ROS 2.