Standards for Mixing C++ and Python Nodes in same Package

asked 2017-03-22 15:29:05 -0500

nckswt gravatar image

updated 2017-03-22 15:38:04 -0500

I'm looking for best practices for using both Python and C++ in a ROS package. Both Packages documentation and the PyStyleGuide provide a basis for directory structures, but not within the context of both C++ and Python simultaneously.

For example, imagine I have a package foo with a C++ node bar and a python-based node baz. Let's say both nodes are complex enough to require separate library source files. I'd put together a directory structure like this:

├── include
│   └── bar.h
├── launch
│   ├── bar.launch
│   ├── baz.launch
│   └── foo.launch
├── msg
│   └── bar.msg
├── nodes
│   └──
├── src
│   ├── foo
│   │   ├──
│   │   └──
│   ├── bar_node.cpp
│   └── bar.cpp
├── srv
│   └── baz.msg
├── CMakeLists.txt
├── package.xml

I'm not a fan of mixing both C++ and python code under src, but not sure whether there are any standards/examples associated with this kind of code layout. Can anyone point me towards better solutions? Thanks!

edit retag flag offensive close merge delete



Most of the ROS packages that I've seen use a directory structure like this.

ahendrix gravatar image ahendrix  ( 2017-03-22 17:20:02 -0500 )edit

I've seen lots of packages like this, and not a fan of this too. I usually create a scripts folder beside the src folder for .py files.

Orhan gravatar image Orhan  ( 2020-07-09 16:52:23 -0500 )edit