ROS CPP Wrapper for existing Python
Hi All,
I have a package that contains a couple of python files that provides utilities functionality and some defines.
A class from this can then be "imported" into another python project and used as required.
I would like to provide the same functionality for C++ projects.
What would be the best way to do this with minimum code duplication?
Thanks
Asked by GGabria on 2015-04-27 16:01:02 UTC
Answers
Exposing python code inside a c++ is not recommended. Most people trying to do this will do something like exec'ing a child process and parsing the command line output if really necessary. But that's very brittle.
The ROS style approach would be to create messages which provide the "defines" or constants to all languages. And expose the functionality as a ROS service or matching pub/sub topics which can then transition from c++ to python and back.
Asked by tfoote on 2015-08-28 03:00:26 UTC
Comments