Implement std_msgs in C++ programs (ros2)
Hallo everyone, I am trying to write a simple C++ Subscriber, who listen to a python program, which publishes x-, and y values. Therefore i am using std_msgs/msg/Float64MultiArray and fill the array with received x-, y values. This is already working and when i echo the topic i can see the values being published. Unfortunately moveit2 can currently only be used with C++. That's why i have to write the subscribe in c++ to get the values and based on them, doing the motion planning to move to the received values. I have tried to follow the ros2 Simple-Cpp-Publisher-And-Subscriber instruction, which worked fine. I also tried to include the floatarray into my c++ file as followed:
#include "std_msgs/msg/Float64MultiArray.hpp"
But when i try to build my package i get the following message:
Starting >>> motion_planning
--- stderr: motion_planning
/home/ubuntu-20041/ros2_ws/src/motion_planning/src/obj_dect_sub.cpp:7:10: fatal error: std_msgs/msg/Float64MultiArray.hpp: No such file or directory
7 | #include "std_msgs/msg/Float64MultiArray.hpp"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/obj_dect_sub.dir/build.make:63: CMakeFiles/obj_dect_sub.dir/src/obj_dect_sub.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:78: CMakeFiles/obj_dect_sub.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
i also included the std_msgs into my package (CMake, package.xml file). I am not good with c++, so i hope you guys can tell me, what i am missing. If there are any informations missing please let me now.