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

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

nckswt gravatar image

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

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:

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

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

Comments

5

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 -0600 )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 -0600 )edit