ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Are both of c++ and python necessary together

asked 2018-05-26 03:29:33 -0500

bear234 gravatar image

updated 2018-05-26 03:37:50 -0500

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:

├── actionlib
│   ├──
│   ├──
│   ├──
│   ├──
│   ├──
│   ├──
│   ├──
│   ├──
│   ├──
│   └──
├── 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?

edit retag flag offensive close merge delete



Perhaps a good first question would be: why would you want to do this?

gvdhoorn gravatar image gvdhoorn  ( 2018-05-26 05:07:23 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2018-05-26 05:06:59 -0500

gvdhoorn gravatar image

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.

edit flag offensive delete link more

Question Tools



Asked: 2018-05-26 03:29:33 -0500

Seen: 223 times

Last updated: May 26 '18