ROSのcostmapに関して下記のコードをcatkin_makeしたところエラーが発生しました。
ROSのバージョンはmelodic、OSはUbuntu18.04です。
cpp
1#include <ros/ros.h> 2#include <tf/transform_listener.h> 3#include <costmap_2d/costmap_2d_ros.h> 4 5int main(int argc, char** argv){ 6 ros::init(argc, argv, "costmap"); 7 tf2_ros::Buffer tfBuffer(ros::Duration(10)); 8 tf2_ros::TransformListener tfListener(tfBuffer); 9 costmap_2d::Costmap2DROS costmap("my_costmap", tfBuffer); 10 ros::NodeHandle n; 11 costmap.start(); 12 ros::spin(); 13 return 0; 14}
エラーメッセージ等。
CMakeFiles/costmap.dir/src/costmap_test.cpp.o: In function `main': costmap_test.cpp:(.text+0x150): undefined reference to `costmap_2d::Costmap2DROS::Costmap2DROS(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, tf2_ros::Buffer&)' costmap_test.cpp:(.text+0x20f): undefined reference to `costmap_2d::Costmap2DROS::start()' costmap_test.cpp:(.text+0x237): undefined reference to `costmap_2d::Costmap2DROS::~Costmap2DROS()' costmap_test.cpp:(.text+0x329): undefined reference to `costmap_2d::Costmap2DROS::~Costmap2DROS()' collect2: error: ld returned 1 exit status TestPkg/CMakeFiles/costmap.dir/build.make:117: recipe for target '~/catkin_ws/devel/lib/TestPkg/costmap' failed make[2]: *** [~/catkin_ws/devel/lib/TestPkg/costmap] Error 1 CMakeFiles/Makefile2:567: recipe for target 'TestPkg/CMakeFiles/costmap.dir/all' failed make[1]: *** [TestPkg/CMakeFiles/costmap.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [100%] Built target move_base_node Makefile:140: recipe for target 'all' failed make: *** [all] Error 2
原因がわからず困っております。対処方法をご存じの方がいっらしゃればご教授頂きたく。
以上、宜しくお願い致します。

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。