std_msgs/msg/header.h: No such file or directory
Unable to compile examples
- ESP32 Thing Plus
- Installation type: simply following the build instructions
- Version or commit hash: galactic, humble, or main all tried.
ESP-idf version 4.2 username@dev0:~/esp-idf$ git checkout v4.2 HEAD is now at c40f2590bf Merge branch 'featrue/remove_esp32-S2_preview_v4.2' into 'release/v4.2'
Either with or without clean build env per install instructions:
"If you encounter issues during the build process, ensure that you are running in a clean shell environment _without_ the ROS 2 setup script sourced."
Steps to reproduce the issue
First try with "clean shell environment" Simply follow the instructions on a fresh Ubunutu 20 install. https://github.com/micro-ROS/micro_ros_espidf_component/blob/galactic/README.md?plain=1#L35 leads to:
user@dev0:~$ cd ~/micro_ros_espidf_component/examples/ping_pong/
user@dev0:~/micro_ros_espidf_component/examples/ping_pong$ idf.py build
...
[100%] Linking CXX static library liblibsodium.a
[100%] Built target __idf_libsodium
Scanning dependencies of target __idf_main
[100%] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj
/home/username/micro_ros_espidf_component/examples/ping_pong/main/main.c:15:10: fatal error: std_msgs/msg/header.h: No such file or directory
#include <std_msgs/msg/header.h>
^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [esp-idf/main/CMakeFiles/__idf_main.dir/build.make:63: esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:4664: esp-idf/main/CMakeFiles/__idf_main.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
make failed with exit code 2
Expected behavior
Expect a clean compile!
Actual behavior
make failed with exit code 2
Additional information
Manually adding missing path's helps, but gets exhausting...
diff --git a/examples/ping_pong/CMakeLists.txt b/examples/ping_pong/CMakeLists.txt
index 9377dad..f983620 100644
--- a/examples/ping_pong/CMakeLists.txt
+++ b/examples/ping_pong/CMakeLists.txt
@@ -3,5 +3,6 @@ cmake_minimum_required(VERSION 3.5)
set (EXTRA_COMPONENT_DIRS "./../../.")
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
+include_directories(/home/kfinisterre/ros_ws/ros2-linux/include)
project(ping_pong)
you wind up chasing more and more header files... ...
[100%] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj
/home/kfinisterre/micro_ros_espidf_component/examples/ping_pong/main/main.c:18:10: fatal error: rclc/rclc.h: No such file or directory
#include <rclc/rclc.h>
^~~~~~~~~~~~~
It is unclear what relationship micro_ros_setup has to this repo, but for anyone else, this was how to be successful in this task:
user@dev0:~$ source /opt/ros/galactic/setup.bash
user@dev0:~$ echo $ROS_DISTRO
user@dev0:~/microros_ws$ mkdir -p ~/microros_ws/src/
user@dev0:~/microros_ws$ cd ~/microros_ws/src/
user@dev0:~/microros_ws/src$ git clone -b $ROS_DISTRO https://github.com/micro-ROS/micro_ros_setup.git
user@dev0:~/microros_ws/src$ cd ~/microros_ws/
user@dev0:~/microros_ws$ sudo apt update && rosdep update
user@dev0:~/microros_ws$ rosdep install --from-path src --ignore-src -y
user@dev0:~/microros_ws$ sudo apt-get install python3-pip
user@dev0:~/microros_ws$ colcon build
user@dev0:~/microros_ws$ source install/local_setup.bash
user@dev0:~/microros_ws$ ros2 run micro_ros_setup create_firmware_ws.sh freertos esp32
user@dev0:~/microros_ws$ nmcli con | grep wifi
user@dev0:~/microros_ws$ ifconfig <device from above>
user@dev0:~/microros_ws$ ros2 run micro_ros_setup configure_firmware.sh ping_pong -t udp -i <ip from above> -p 8888
user@dev0:~/microros_ws$ ros2 run micro_ros_setup build_firmware.sh menuconfig
Edit "micro-ROS Transport Settings" set your wifi password
user@dev0:~/microros_ws$ ros2 run micro_ros_setup build_firmware.sh
user@dev0:~/microros_ws$ sudo chmod 777 /dev/ttyUSB0
user@dev0:~/microros_ws$ ros2 run micro_ros_setup flash_firmware.sh
user@dev0:~/microros_ws$ ros2 run micro_ros_setup build_firmware.sh monitor
In a new window
user@dev0:~/microros_ws$ docker run -it --rm --net=host microros/micro-ros-agent:foxy udp4 --port 8888 -v6