Closed CasCard closed 1 year ago
Hello @CasCard, the folder structure you show is not generated by micro_ros_espidf_component
. Could you please use micro_ros_espidf_component
, so the integration of your library will be as usual in ESP-IDF.
I was finally able to solve this issue. If someone looking to integrate Arduino libraries into your project here are the steps to follow.
View
->ESP-IDF examples
->sample project
components
folder is where the additional libraries including micro_ros_espidf_component
reside.If you want to specifically follow the format usually followed for Arduino includes setup
and loop
format you have to include a library called arduino-esp32 in the components folder as shown in the above image.
Now if you want to include Arduino libraries you can directly clone them into the components
folder. Here is an example where I am including the Adafruilt VL6180X library.
Now you have to additionally add CMakeLists.txt
in the library so that IDF will be able to find them while building.You can keep the header files in the include
folder. You might need to add additional supporting libraries for your core libraries.
For example Adafruilt VL6180X requires arduino-esp32 and Adafruit_BusIO libraries.
So the CMakeLists.txt of Adafruilt VL6180X library should look like as follows:
idf_component_register(SRCS "Adafruit_VL6180X.cpp" INCLUDE_DIRS "include" REQUIRES arduino Adafruit_BusIO)
Now for writing arduino ide like code you can follow this reference.
Note that if you want to use setup
and loop
your file should be in .cpp
format and changes need to be made in the CMakeLists.txt
file as well. In the case of ESP-IDF app format, it should be a .c
file.
Hope this helps.
Issue template
I am having Adafruit VL6180X ToF sensor, but it uses a custom library with Adafruit headers. I would like to know how can I include this library when creating the FreeRTOS micro-ros application. My application is to publish the sensor data from ESP32 using micro-ros , which can be subscribed by raspberry pi with ROS2 running.
This file structure format.