Error: ‘tf’ has not been declared

When compiling the function package, an error is reportedError: ‘tf’ has not been declared

/home/lyp/Documents/gitee/path_ws/src/fixed_route/src/my_global_planner.cpp:30:2: error: ‘tf’ has not been declared
  tf::Quaternion goal_quat = tf::createQuaternionFromYaw(1.54);
  ^~
/home/lyp/Documents/gitee/path_ws/src/fixed_route/src/my_global_planner.cpp:35:32: error: ‘goal_quat’ was not declared in this scope
  new_goal.pose.orientation.x = goal_quat.x();
                                ^~~~~~~~~
fixed_route/CMakeFiles/my_global_planner_lib.dir/build.make:81: recipe for target 'fixed_route/CMakeFiles/my_global_planner_lib.dir/src/my_global_planner.cpp.o' failed
make[2]: *** [fixed_route/CMakeFiles/my_global_planner_lib.dir/src/my_global_planner.cpp.o] Error 1
CMakeFiles/Makefile2:4341: recipe for target 'fixed_route/CMakeFiles/my_global_planner_lib.dir/all' failed
make[1]: *** [fixed_route/CMakeFiles/my_global_planner_lib.dir/all] Error 2
Makefile:159: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j12 -l12" failed

Solution: add header file

#include <tf/transform_broadcaster.h>

Guess you like

Origin blog.csdn.net/qq_41821678/article/details/125760858