Ask Your Question
0

Are both of c++ and python necessary together

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

bear234 gravatar image

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

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?

edit retag flag offensive close merge delete

Comments

1

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

gvdhoorn gravatar imagegvdhoorn ( 2018-05-26 05:07:23 -0600 )edit

1 Answer

Sort by » oldest newest most voted
2

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 49 times

Last updated: May 26 '18