File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed
Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
22
33project (cloe_plugin_basic LANGUAGES CXX)
44
5+ find_package (pybind11 CONFIG REQUIRED)
56set (CLOE_FIND_PACKAGES ON CACHE BOOL "Call find_package() for cloe packages" )
67if (CLOE_FIND_PACKAGES)
78 find_package (cloe-runtime REQUIRED)
@@ -22,6 +23,17 @@ cloe_add_plugin(
2223 PROJECT_SOURCE_DIR =\"${CMAKE_CURRENT_SOURCE_DIR} \"
2324)
2425
26+ pybind11_add_module(_basic_bindings
27+ src/basic_bindings.cpp
28+ )
29+ target_include_directories (_basic_bindings PRIVATE src/)
30+ target_link_libraries (_basic_bindings PUBLIC cloe::runtime cloe::models cloe::databroker-bindings)
31+ set_target_properties (_basic_bindings PROPERTIES
32+ CXX_STANDARD 17
33+ CXX_STANDARD_REQUIRED ON
34+ )
35+ install (TARGETS _basic_bindings LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} /cloe/python)
36+
2537include (CTest)
2638if (BUILD_TESTING)
2739 find_package (GTest REQUIRED)
Original file line number Diff line number Diff line change @@ -83,3 +83,7 @@ def package_info(self):
8383 if not self .in_local_cache : # editable mode
8484 libdir = os .path .join (self .build_folder , "lib" )
8585 self .runenv_info .append_path ("LD_LIBRARY_PATH" , libdir )
86+
87+ # todo editable mode
88+ self .runenv_info .prepend_path ("CLOE_PYTHON_BINDINGS" ,
89+ str (Path (self .package_folder ) / 'lib' / 'cloe' / 'python' ))
Original file line number Diff line number Diff line change 1+ #include " basic.hpp"
2+ #include < cloe/python/python_data_broker_adapter.hpp>
3+ #include < pybind11/pybind11.h>
4+
5+ PYBIND11_MODULE (_basic_bindings, m) {
6+
7+ pybind11::class_<cloe::controller::basic::AccConfiguration>(m, " AccConfiguration" )
8+ .def_readonly (" ego_sensor" , &cloe::controller::basic::AccConfiguration::ego_sensor)
9+ .def_readonly (" world_sensor" , &cloe::controller::basic::AccConfiguration::world_sensor)
10+ .def_readonly (" latlong_actuator" , &cloe::controller::basic::AccConfiguration::latlong_actuator)
11+ .def_readonly (" limit_deceleration" , &cloe::controller::basic::AccConfiguration::limit_deceleration)
12+ .def_readonly (" derivative_factor_speed_control" , &cloe::controller::basic::AccConfiguration::kd)
13+ .def_readonly (" proportional_factor_speed_control" , &cloe::controller::basic::AccConfiguration::kp)
14+ .def_readonly (" integral_factor_speed_control" , &cloe::controller::basic::AccConfiguration::ki)
15+ .def_readonly (" derivative_factor_dist_control" , &cloe::controller::basic::AccConfiguration::kd_m)
16+ .def_readonly (" proportional_factor_dist_control" , &cloe::controller::basic::AccConfiguration::kp_m)
17+ .def_readonly (" integral_factor_dist_control" , &cloe::controller::basic::AccConfiguration::ki_m);
18+
19+ m.def (" declare" , [](cloe::py::PythonDataBrokerAdapter &adapter) {
20+ adapter.declare <cloe::controller::basic::AccConfiguration>();
21+ });
22+
23+ }
You can’t perform that action at this time.
0 commit comments