Below we provide two example scripts that display a typical usage of freneticlib. The first one uses an executor featuring a bicycle model (:class:`.BicycleExecutor`), while the second one executes using the BeamNG.tech executor (:class:`.BeamNGExecutor`).
.. literalinclude:: ../../example.py :language: python
Our second example is rather similar to the first one, except that it uses a different simulator. However, to use the BeamNG.tech simulator, we first have to perform some extra steps.
- First, request a free researcher license from https://register.beamng.tech.
- Then, download and install the BeamNG.tech according to the instructions emailed to you.
- Next, download or clone the SBFT 2023 CPS tool competition pipeline, which we use as an interface to BeamNG.tech.
- Specify the required arguments
cps_pipeline_path
,beamng_home
andbeamng_user
in the initialisation of the :class:`.BeamNGExecutor`, like so
BeamNGExecutor(
representation=...,
objective=...,
cps_pipeline_path="~/cps-tool-competition",
beamng_home="~/Downloads/BeamNG.tech.v0.26.2.0",
beamng_user="~/BeamNG.tech",
)
The rest of the code is exactly the same as in the :class:`.BicycleExecutor` example.
Note
Currently, we tested frenetic-lib on Windows using BeamNG.tech v0.26.2.0 In case you use it on Linux and/or another version of BeamNG.tech, please share your experience with us.
.. literalinclude:: ../../example_beamng.py :language: python