Robotics StackExchange | Archived questions

Help with Micro-ros, CMakefiles, and directory configuration

Hi,

In my repo, under the microros_ws directory, I would like to move the assemblies and components directory under a src directory.

When I try to do this and fix up all my include directory references, it compiles but does not link in Microros libs any more.

to recap:

I want to change

microros_ws/assemblies
microros_ws/compoents

to

microros_ws/src/assemblies 
microros_ws/src/components

I am fairly sure this is a fix in one of my CMakeLists.txt files but it is completely eluding me and I am not super familiar with CMake./Ninjia

Here is the link to the repo, https://github.com/gentijo/RosBots/tree/main/microros_ws

Thank you in advance for any help -John

Asked by gentijo on 2022-11-20 01:17:56 UTC

Comments

I forgot to mention:

 - This is the ESP_IDF flavor of Microros  
 - I run idf.py build from microros_ws/assemblies/esp32-range-buggy
 - When I change any of the CMakeLists.txt, I run idf.py fullclean && idf.py reconfigure. 
 - I run the build process in a Docker container defined in /docker/microros-espidf

Asked by gentijo on 2022-11-20 14:24:31 UTC

Answers

I think I found it,

The ESP IDF CMake build system will include the CMakeLists.txt file that is the EXTRA_COMPONENTS_DIR.

This variable is set in the main CMakeLists.txt file in the project with set (EXTRA_COMPONENT_DIRS "./../../.")

This is how the CMakelists.txt file is included that processes the ROS source code which is done by calling calling in the Makefile libmocroros.mk.

If I want to push my source code to a different directory level, I needed to update my EXTRA_COMPONENTS_DIR, I didn't have any extra ESP components so I didn't think it was important.

The Microros build system is leveraging the fact that the extra component directory where it expects the CMakeLists.txt file to exist. This allows the ROS build system to be in a different location than your ROS app.

-John

Asked by gentijo on 2022-12-04 13:13:02 UTC

Comments