Are both of c++ and python necessary together
I've found that in many ROS packages, there two kinds files: c++ files and python files.
For example, here is the architecture of src
of the package actionlib
:
src/
├── actionlib
│ ├── action_client.py
│ ├── action_server.py
│ ├── exceptions.py
│ ├── goal_id_generator.py
│ ├── handle_tracker_deleter.py
│ ├── __init__.py
│ ├── server_goal_handle.py
│ ├── simple_action_client.py
│ ├── simple_action_server.py
│ └── status_tracker.py
├── connection_monitor.cpp
└── goal_id_generator.cpp
I'm asking if all of them are necessary? Or do they work together?
Saying that I delete all of python scripts of actionlib
, can I still compile the package actionlib
with cmake && make
and use this package as expected? Or can I delete all of c++ files of actionlib
and use its pythons scripts as expected?
Asked by bear234 on 2018-05-26 03:29:33 UTC
Answers
I don't think there is a generic answer to this, as it will depend on how the package's author(s) have designed and implemented things.
Note also that there is no special reason that it's Python and C++, it could just as well be some other programming language.
There are packages where the Python and C++ code implements the same / similar functionality for both languages, so it makes sense to keep them together (saves adding yet another package). For those it may be possible to separate them (or remove one of the two).
Other packages actually implement Python wrappers around C++ functionality, and the Python side my be necessary during compile time.
Again others may be scripts used during code generation - another phase of the build. Removing the scripts / modules would then lead to failure to build the package.
As to your specific example: iirc, the actionlib
package provides a Python and a C++ implementation of the Action concept in ROS. It could be possible to remove the Python side without affecting the C++ side, but no guarantees.
Asked by gvdhoorn on 2018-05-26 05:06:59 UTC
Comments
Perhaps a good first question would be: why would you want to do this?
Asked by gvdhoorn on 2018-05-26 05:07:23 UTC