Open
Conversation
ci/setup ci pipeline
* feat(pybind11): add initial Pybind11 integration and Python build setup - Added .gitmodules to include pybind11 as a submodule - Updated CMakeLists.txt to support Pybind11 bindings - Implemented initial C++ bindings in bindings/bindings.cpp - Added pyproject.toml and setup.py for Python packaging * Update to include bindings for junction, lane, lane section * Add binding for several modules * Remove unneeded for-loop * Updates required to enable test script to work * Minor fix with binding module name * Update README to include instructions on how to install Python bindings with pybind11
Author
|
@pageldev I recall there’s been interest in making |
Author
|
@pageldev updated to be in synch with the main branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces initial Python bindings for libOpenDRIVE using Pybind11, enabling Python access to the core data structures and mesh representations. The following key components were added or updated:
Pybind11 Integration
Bindings Coverage
Tests
Miscellaneous
Test
Test results below,
python -m pytest -v tests/test_opendrivemap.py===================================================================== test session starts =====================================================================
platform darwin -- Python 3.11.5, pytest-8.2.2, pluggy-1.5.0 -- /Users/christiancontrerascampana/anaconda3/bin/python
cachedir: .pytest_cache
rootdir: /Users/christiancontrerascampana/Desktop/project/pybind_libOpenDRIVE/baseline/libOpenDRIVE
configfile: pyproject.toml
plugins: anyio-4.3.0
collected 1 item
tests/test_opendrivemap.py::test_basic_opendrivemap_check PASSED [100%]
====================================================================== 1 passed in 0.03s ======================================================================
python -m pytest -v tests/test_binding.py===================================================================== test session starts =====================================================================
platform darwin -- Python 3.11.5, pytest-8.2.2, pluggy-1.5.0 -- /Users/christiancontrerascampana/anaconda3/bin/python
cachedir: .pytest_cache
rootdir: /Users/christiancontrerascampana/Desktop/project/pybind_libOpenDRIVE/baseline/libOpenDRIVE
configfile: pyproject.toml
plugins: anyio-4.3.0
collected 9 items
tests/test_binding.py::test_opendrive_map_attributes PASSED [ 11%]
tests/test_binding.py::test_roads PASSED [ 22%]
tests/test_binding.py::test_junctions PASSED [ 33%]
tests/test_binding.py::test_road_network_mesh PASSED [ 44%]
tests/test_binding.py::test_lanes_mesh PASSED [ 55%]
tests/test_binding.py::test_roadmarks_mesh PASSED [ 66%]
tests/test_binding.py::test_road_objects_mesh SKIPPED (No vertices in road_objects_mesh) [ 77%]
tests/test_binding.py::test_road_signals_mesh SKIPPED (No vertices in road_signals_mesh) [ 88%]
tests/test_binding.py::test_routing_graph PASSED [100%]
================================================================ 7 passed, 2 skipped in 0.59s =================================================================
(bas
Output
Once pip is installed can import as follows:
['ContactPoint', 'Crossfall', 'CrossfallSide', 'CubicSpline', 'End', 'EulerAnglesToMatrix', 'HeightOffset', 'Junction', 'JunctionConnection', 'JunctionController', 'JunctionLaneLink', 'JunctionPriority', 'Lane', 'LaneKey', 'LaneSection', 'LaneValidityRecord', 'LanesMesh', 'Line3D', 'Mat3D', 'MatVecMultiplication', 'Mesh3D', 'None', 'OpenDriveMap', 'ROADMARK_WEIGHT_BOLD_WIDTH', 'ROADMARK_WEIGHT_STANDARD_WIDTH', 'RefLine', 'Road', 'RoadLink', 'RoadLinkType', 'RoadMark', 'RoadMarkGroup', 'RoadMarksLine', 'RoadNeighbor', 'RoadNetworkMesh', 'RoadObject', 'RoadObjectCorner', 'RoadObjectCornerType', 'RoadObjectOutline', 'RoadObjectRepeat', 'RoadObjectsMesh', 'RoadSignal', 'RoadSignalsMesh', 'RoadmarksMesh', 'RoadsMesh', 'RoutingGraph', 'RoutingGraphEdge', 'Side_Both', 'Side_Left', 'Side_Right', 'SpeedRecord', 'Start', 'Type_Junction', 'Type_Local_AbsZ', 'Type_Local_RelZ', 'Type_None', 'Type_Road', 'Vec1D', 'Vec2D', 'Vec3D', 'WeightedLaneKey', 'XmlNode', 'XmlParseResult', 'doc', 'file', 'loader', 'name', 'package', 'spec', 'add', 'crossProduct', 'euclDistance', 'mut', 'norm', 'normalize', 'sign', 'squaredNorm', 'sub']