From df97d2950c5fb00cf5ea51abef7d53b987335ae4 Mon Sep 17 00:00:00 2001 From: Adam Ivora Date: Tue, 4 Apr 2023 13:04:42 +0200 Subject: [PATCH] Rename `RoadNetworkExporter` to PascalCase, update docs --- CHANGELOG.rst | 48 +++++++++++++++++++++ docs/source/beamngpy.rst | 7 +++ docs/source/conf.py | 2 +- examples/road_network_exporter.py | 4 +- src/beamngpy/tools/__init__.py | 1 + src/beamngpy/tools/road_network_exporter.py | 10 ++--- 6 files changed, 64 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0c2a93ff..eb21f382 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,54 @@ Changelog ========= +Version 1.26 +============ +- RADAR sensor + + - Sensor currently works with static scenery but not vehicles. Will be added in later update. + - Sensor comes with standard Lua API and BeamNGpy API. + - Example scripts `provided `_ in BeamNGpy. +- Vehicle meshes now available in BeamNGpy + + - Can provide data up to 2000 times per second. + - Vehicle nodes and physics triangle data available in BeamNGpy, including for individual vehicle wheels. + - Comes with standard Lua API and BeamNGpy API. + - Post-processing written in BeamNGpy to compute mesh connectivity data and analyse the mesh data (position, mass, force, velocity). + - Example scripts `provided `_ in BeamNGpy. +- IMU sensor + + - Added ability to filter gyroscopic readings (as well as acceleration readings). Separate data filtering is used for each. +- Sensor suite bug fixes + + - Fix: problem when changing the requested update times/priority parameters after various sensors were already created, sensor would not update correctly/quickly. + - Fix: gravity vector was not being applied correctly in IMU sensor. + - Fix: camera images from static sensors were being rendered upside down. + - Fix: LiDAR sensor was not returning the whole point cloud in BeamNGpy +- Export BeamNG maps as .xodr files (OpenDrive) + + - BeamNGpy now provides the option to export our map road networks as .xodr files (OpenDrive). The exported road networks contain elevation and road wideness data, along with junction connectivity. On top of this, BeamNGpy also includes a new `class `_ with which to analyse the road network data oneself, and process it as required. +- BeamNGpy fixes / improvements + + - Optimized the speed of depth camera processing + - Added new API: + + - ``BeamNGpy.env.get_tod`` for getting the information about the time of day + - ``BeamNGpy.env.set_tod`` for setting the time-of-day information, allowing to control the day/night cycle from Python + - ``BeamNGpy.env.get_gravity`` for getting the current value of the strength of gravity in the simulator. + - ``Vehicle.get_center_of_gravity`` for getting the center of gravity of a vehicle. + + - Added option to remove procedural meshes + - Added new option to ``BeamNGpy.open`` called ``crash_lua_on_error`` + + - If ``False`` (the default), then Lua crashes in the simulator will not break the connection between BeamNG.tech and BeamNGpy. Set to ``True`` for getting proper stacktraces and easier debugging. + - Added new option to ``BeamNGpy.scenario.load`` called ``precompile_shaders`` + + - If ``True`` (the default), asynchronous shader compilation is disabled. That means the first loading of a map will take longer time, but all parts of the map will be preloaded. If ``False``, the camera sensor can have issues shortly after starting the scenario. + - Better handling of errors and crashes in the BeamNGpy TCP protocol. + - Fixed ``vehicle.control`` with zero integer arguments being ignored. + - Re-added ``BeamNGpy.scenario.get_vehicle`` (removed by accident in the last release). + - ``BeamNGpy.settings.set_deterministic`` and ``BeamNGpy.settings.set_steps_per_second`` are not persistent anymore and are applied only for a single run of the simulation. + Version 1.25.1 ============== - fixed in BeamNG.tech v0.27.1.0: converted all vehicle rotations sent to BeamNGpy to be consistent with each other diff --git a/docs/source/beamngpy.rst b/docs/source/beamngpy.rst index bc67f238..fe4b9b2b 100644 --- a/docs/source/beamngpy.rst +++ b/docs/source/beamngpy.rst @@ -166,6 +166,13 @@ Logging :members: :undoc-members: +Tools +===== + +.. autoclass:: beamngpy.tools.RoadNetworkExporter + :members: + :undoc-members: + Miscellaneous ============= diff --git a/docs/source/conf.py b/docs/source/conf.py index 470bdac6..ce312a3e 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -18,7 +18,7 @@ # -- Project information ----------------------------------------------------- project = 'BeamNGpy' -copyright = '2022, BeamNG GmbH' +copyright = '2023, BeamNG GmbH' author = 'BeamNG GmbH' diff --git a/examples/road_network_exporter.py b/examples/road_network_exporter.py index fbcfcfda..5e6d5ce9 100644 --- a/examples/road_network_exporter.py +++ b/examples/road_network_exporter.py @@ -1,7 +1,7 @@ from time import sleep -import beamngpy.tools.road_network_exporter as rne from beamngpy import BeamNGpy, Scenario, Vehicle, set_up_simple_logging +from beamngpy.tools import RoadNetworkExporter def main(): @@ -19,7 +19,7 @@ def main(): bng.scenario.start() # Get the road graph data for the map. - graph = rne.Road_Network_Exporter(bng) + graph = RoadNetworkExporter(bng) path_segments = graph.compute_path_segments() graph.plot_path_segments(path_segments) # Plots the road data with Matplotlib. graph.export_xodr('test_od') # export to OpenDrive (.xodr) format. diff --git a/src/beamngpy/tools/__init__.py b/src/beamngpy/tools/__init__.py index e69de29b..aadf84a6 100644 --- a/src/beamngpy/tools/__init__.py +++ b/src/beamngpy/tools/__init__.py @@ -0,0 +1 @@ +from .road_network_exporter import RoadNetworkExporter diff --git a/src/beamngpy/tools/road_network_exporter.py b/src/beamngpy/tools/road_network_exporter.py index b9105b18..f03ba32c 100644 --- a/src/beamngpy/tools/road_network_exporter.py +++ b/src/beamngpy/tools/road_network_exporter.py @@ -19,10 +19,10 @@ if TYPE_CHECKING: from beamngpy.beamng import BeamNGpy -__all__ = ['Road_Network_Exporter'] +__all__ = ['RoadNetworkExporter'] -class explicit_cubic: +class ExplicitCubic: """ A class for representing explicit cubic polynomials of the form: [ p(x) := a + b*x + c*x^2 + d*x^3 ]. """ @@ -96,7 +96,7 @@ def approx_length(self, x0, x1, n=9000) -> float: return sum -class parametric_cubic: +class ParametricCubic: """ A class for representing parametric cubic polynomials of the form: [ u(x) := Bu*x + Cu^2 + Du^3, v(x) := Bv*x + Cv^2 + Dv^3 ]. @@ -178,7 +178,7 @@ def __init__(self, connection_type, id, contact_point): self.contact_point = contact_point -class Road_Network_Exporter: +class RoadNetworkExporter: """ A class for retrieving and exporting BeamNG road network data. """ @@ -347,7 +347,7 @@ def _fit_parametric_cubic(self, p1, p2, t_start, t_end): Cv = (3.0 * y2) - tan.y Dv = tan.y - (2.0 * y2) - return parametric_cubic(Bu, Cu, Du, Cv, Dv) + return ParametricCubic(Bu, Cu, Du, Cv, Dv) def compute_roads(self): """