background
in OEM’s ADS team, there are bunch of model-based design engineers, who build the ADAS features based on Matlab/Simulink tools, which is good to build quick demos, when comes to massive data verification, we can’t really depends on Matlab solver, which is so slow and licensed.
so a common idea is to recompile the Matlab/Simulink model to C/C++ code, which can further embedded to more open envs, e.g. python or C++.
as previously mentioned, we had designed a rq based massive data driven test framework, so the gap from C++ ADAS code to this python test framework is fixed in this blog.
there are a few wasy to integrate C++ code to Python, one is Boost.Python
:
setup
python env : 3.6 (from conda env aeb)
gcc: 4.5.0
|
|
user-config.jam
|
|
- error fixing
|
|
need export CPATH=~/anaconda/envs/aeb/include/python3.6m/
, where located pyconfig.h
and other headers
finally report: boost.python build successfully !
demo run
the following is simple sample of how to use boost_python wrapper to wrapping an AEB model(in c++) to python
aeb.h
|
|
wrap_aeb.cpp
|
|
- test
|
|
summary
this blog gives the basic idea how to use boost.python
to integrate c++ to python test framework. there are plenty details need fixed, e.g. nested structures, share_pointers. maybe share in next blog.