rst-tu-dortmund / teb_local_planner

An optimal trajectory planner considering distinctive topologies for mobile robots based on Timed-Elastic-Bands (ROS Package)
http://wiki.ros.org/teb_local_planner
BSD 3-Clause "New" or "Revised" License
992 stars 546 forks source link

Build fails for foxy-devel/ros2-master/dashing-devel with g2o related incompatibilities #313

Closed saadehmd closed 2 years ago

saadehmd commented 3 years ago

Tried building teb_local_planner in all 3 branches and it always ends up giving these errors in common:

/home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp: In static member function ‘static void teb_local_planner::TebOptimalPlanner::registerG2OTypes()’: /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:126:40: *error: cannot convert ‘g2o::HyperGraphElementCreator’ to ‘const std::shared_ptr&**’ 126 factory->registerType("VERTEX_POSE", new g2o::HyperGraphElementCreator); ^~~~~~~~~~~~~
g2o::HyperGraphElementCreator*
In file included from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/include/teb_local_planner/optimal_planner.h:56, from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:42: /usr/local/include/g2o/core/factory.h:63:78: note: initializing argument 2 of ‘void g2o::Factory::registerType(const string&, const std::shared_ptr&)’ 63 const std::shared_ptr& c); ~~~~~~~~~~~~~^ /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:127:44: error: cannot convert ‘g2o::HyperGraphElementCreator*’ to ‘const std::shared_ptr&’ 127 factory->registerType("VERTEX_TIMEDIFF", new g2o::HyperGraphElementCreator); ^~~~~~~~~~~~~
g2o::HyperGraphElementCreator*
In file included from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/include/teb_local_planner/optimal_planner.h:56, from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:42: /usr/local/include/g2o/core/factory.h:63:78: note: initializing argument 2 of ‘void g2o::Factory::registerType(const string&, const std::shared_ptr&)’ 63 const std::shared_ptr& c); ~~~~~~~~~~~~~^ /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:129:46: error: cannot convert ‘g2o::HyperGraphElementCreator*’ to ‘const std::shared_ptr&’ 129 factory->registerType("EDGE_TIME_OPTIMAL", new g2o::HyperGraphElementCreator); ^~~~~~~~~~~~~~
g2o::HyperGraphElementCreator*
In file included from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/include/teb_local_planner/optimal_planner.h:56, from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:42: /usr/local/include/g2o/core/factory.h:63:78: note: initializing argument 2 of ‘void g2o::Factory::registerType(const string&, const std::shared_ptr&)’ 63 const std::shared_ptr& c); ~~~~~~~~~~~~~^ /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:130:47: error: cannot convert ‘g2o::HyperGraphElementCreator*’ to ‘const std::shared_ptr&’ 130 factory->registerType("EDGE_SHORTEST_PATH", new g2o::HyperGraphElementCreator); ^~~~~~~~~~~
g2o::HyperGraphElementCreator*
In file included from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/include/teb_local_planner/optimal_planner.h:56, from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:42: /usr/local/include/g2o/core/factory.h:63:78: note: initializing argument 2 of ‘void g2o::Factory::registerType(const string&, const std::shared_ptr&)’ 63 const std::shared_ptr& c); ~~~~~~~~~~~~~^ /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:131:42: error: cannot convert ‘g2o::HyperGraphElementCreator*’ to ‘const std::shared_ptr&’ 131 factory->registerType("EDGE_VELOCITY", new g2o::HyperGraphElementCreator); ^~~~~~~~~~~
g2o::HyperGraphElementCreator*
In file included from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/include/teb_local_planner/optimal_planner.h:56, from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:42: /usr/local/include/g2o/core/factory.h:63:78: note: initializing argument 2 of ‘void g2o::Factory::registerType(const string&, const std::shared_ptr&)’ 63 const std::shared_ptr& c); ~~~~~~~~~~~~~^ /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:132:52: error: cannot convert ‘g2o::HyperGraphElementCreator*’ to ‘const std::shared_ptr&’ 132 factory->registerType("EDGE_VELOCITY_HOLONOMIC", new g2o::HyperGraphElementCreator); ^~~~~~~~~~~~
g2o::HyperGraphElementCreator*
In file included from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/include/teb_local_planner/optimal_planner.h:56, from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:42: /usr/local/include/g2o/core/factory.h:63:78: note: initializing argument 2 of ‘void g2o::Factory::registerType(const string&, const std::shared_ptr&)’ 63 const std::shared_ptr& c); ~~~~~~~~~~~~~^ /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:133:46: error: cannot convert ‘g2o::HyperGraphElementCreator*’ to ‘const std::shared_ptr&’ 133 factory->registerType("EDGE_ACCELERATION", new g2o::HyperGraphElementCreator); ^~~~~~~~~~~
g2o::HyperGraphElementCreator*
In file included from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/include/teb_local_planner/optimal_planner.h:56, from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:42: /usr/local/include/g2o/core/factory.h:63:78: note: initializing argument 2 of ‘void g2o::Factory::registerType(const string&, const std::shared_ptr&)’ 63 const std::shared_ptr& c); ~~~~~~~~~~~~~^ /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:134:52: error: cannot convert ‘g2o::HyperGraphElementCreator*’ to ‘const std::shared_ptr&’ 134 factory->registerType("EDGE_ACCELERATION_START", new g2o::HyperGraphElementCreator); ^~~~~~~~~~~~
g2o::HyperGraphElementCreator*
In file included from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/include/teb_local_planner/optimal_planner.h:56, from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:42: /usr/local/include/g2o/core/factory.h:63:78: note: initializing argument 2 of ‘void g2o::Factory::registerType(const string&, const std::shared_ptr&)’ 63 const std::shared_ptr& c); ~~~~~~~~~~~~~^ /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:135:51: error: cannot convert ‘g2o::HyperGraphElementCreator*’ to ‘const std::shared_ptr&’ 135 factory->registerType("EDGE_ACCELERATION_GOAL", new g2o::HyperGraphElementCreator); ^~~~~~~~~~~~~~~
g2o::HyperGraphElementCreator*
In file included from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/include/teb_local_planner/optimal_planner.h:56, from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:42: /usr/local/include/g2o/core/factory.h:63:78: note: initializing argument 2 of ‘void g2o::Factory::registerType(const string&, const std::shared_ptr&)’ 63 const std::shared_ptr& c); ~~~~~~~~~~~~~^ /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:136:56: error: cannot convert ‘g2o::HyperGraphElementCreator*’ to ‘const std::shared_ptr&’ 136 factory->registerType("EDGE_ACCELERATION_HOLONOMIC", new g2o::HyperGraphElementCreator); ^~~~~~~~~~~~~~~~
g2o::HyperGraphElementCreator*
In file included from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/include/teb_local_planner/optimal_planner.h:56, from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:42: /usr/local/include/g2o/core/factory.h:63:78: note: initializing argument 2 of ‘void g2o::Factory::registerType(const string&, const std::shared_ptr&)’ 63 const std::shared_ptr& c); ~~~~~~~~~~~~~^ /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:137:62: error: cannot convert ‘g2o::HyperGraphElementCreator*’ to ‘const std::shared_ptr&’ 137 factory->registerType("EDGE_ACCELERATION_HOLONOMIC_START", new g2o::HyperGraphElementCreator); ^~~~~~~~~~~~~~~~~
g2o::HyperGraphElementCreator*
In file included from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/include/teb_local_planner/optimal_planner.h:56, from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:42: /usr/local/include/g2o/core/factory.h:63:78: note: initializing argument 2 of ‘void g2o::Factory::registerType(const string&, const std::shared_ptr&)’ 63 const std::shared_ptr& c); ~~~~~~~~~~~~~^ /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:138:61: error: cannot convert ‘g2o::HyperGraphElementCreator*’ to ‘const std::shared_ptr&’ 138 factory->registerType("EDGE_ACCELERATION_HOLONOMIC_GOAL", new g2o::HyperGraphElementCreator); ^~~~~~~~~~~~~~~~
g2o::HyperGraphElementCreator*
In file included from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/include/teb_local_planner/optimal_planner.h:56, from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:42: /usr/local/include/g2o/core/factory.h:63:78: note: initializing argument 2 of ‘void g2o::Factory::registerType(const string&, const std::shared_ptr&)’ 63 const std::shared_ptr& c); ~~~~~~~~~~~~~^ /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:139:55: error: cannot convert ‘g2o::HyperGraphElementCreator*’ to ‘const std::shared_ptr&’ 139 factory->registerType("EDGE_KINEMATICS_DIFF_DRIVE", new g2o::HyperGraphElementCreator); ^~~~~~~~~~~~~~
g2o::HyperGraphElementCreator*
In file included from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/include/teb_local_planner/optimal_planner.h:56, from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:42: /usr/local/include/g2o/core/factory.h:63:78: note: initializing argument 2 of ‘void g2o::Factory::registerType(const string&, const std::shared_ptr&)’ 63 const std::shared_ptr& c); ~~~~~~~~~~~~~^ /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:140:52: error: cannot convert ‘g2o::HyperGraphElementCreator*’ to ‘const std::shared_ptr&’ 140 factory->registerType("EDGE_KINEMATICS_CARLIKE", new g2o::HyperGraphElementCreator); ^~~~~~~~~~~~
g2o::HyperGraphElementCreator*
In file included from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/include/teb_local_planner/optimal_planner.h:56, from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:42: /usr/local/include/g2o/core/factory.h:63:78: note: initializing argument 2 of ‘void g2o::Factory::registerType(const string&, const std::shared_ptr&)’ 63 const std::shared_ptr& c); ~~~~~~~~~~~~~^ /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:141:42: error: cannot convert ‘g2o::HyperGraphElementCreator*’ to ‘const std::shared_ptr&’ 141 factory->registerType("EDGE_OBSTACLE", new g2o::HyperGraphElementCreator); ^~~~~~~~~~~
g2o::HyperGraphElementCreator*
In file included from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/include/teb_local_planner/optimal_planner.h:56, from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:42: /usr/local/include/g2o/core/factory.h:63:78: note: initializing argument 2 of ‘void g2o::Factory::registerType(const string&, const std::shared_ptr&)’ 63 const std::shared_ptr& c); ~~~~~~~~~~~~~^ /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:142:51: error: cannot convert ‘g2o::HyperGraphElementCreator*’ to ‘const std::shared_ptr&’ 142 factory->registerType("EDGE_INFLATED_OBSTACLE", new g2o::HyperGraphElementCreator); ^~~~~~~~~~~~~~~
g2o::HyperGraphElementCreator*
In file included from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/include/teb_local_planner/optimal_planner.h:56, from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:42: /usr/local/include/g2o/core/factory.h:63:78: note: initializing argument 2 of ‘void g2o::Factory::registerType(const string&, const std::shared_ptr&)’ 63 const std::shared_ptr& c); ~~~~~~~~~~~~~^ /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:143:50: error: cannot convert ‘g2o::HyperGraphElementCreator*’ to ‘const std::shared_ptr&’ 143 factory->registerType("EDGE_DYNAMIC_OBSTACLE", new g2o::HyperGraphElementCreator); ^~~~~~~~~~~~~~
g2o::HyperGraphElementCreator*
In file included from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/include/teb_local_planner/optimal_planner.h:56, from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:42: /usr/local/include/g2o/core/factory.h:63:78: note: initializing argument 2 of ‘void g2o::Factory::registerType(const string&, const std::shared_ptr&)’ 63 const std::shared_ptr& c); ~~~~~~~~~~~~~^ /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:144:43: error: cannot convert ‘g2o::HyperGraphElementCreator*’ to ‘const std::shared_ptr&’ 144 factory->registerType("EDGE_VIA_POINT", new g2o::HyperGraphElementCreator); ^~~~~~~~~~~
g2o::HyperGraphElementCreator*
In file included from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/include/teb_local_planner/optimal_planner.h:56, from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:42: /usr/local/include/g2o/core/factory.h:63:78: note: initializing argument 2 of ‘void g2o::Factory::registerType(const string&, const std::shared_ptr&)’ 63 const std::shared_ptr& c); ~~~~~~~~~~~~~^ /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:145:47: error: cannot convert ‘g2o::HyperGraphElementCreator*’ to ‘const std::shared_ptr&’ 145 factory->registerType("EDGE_PREFER_ROTDIR", new g2o::HyperGraphElementCreator); ^~~~~~~~~~~
g2o::HyperGraphElementCreator*

In file included from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/include/teb_local_planner/optimal_planner.h:56, from /home/saad/navigation2_ws/src/navigation2/teb_local_planner/teb_local_planner/src/optimal_planner.cpp:42: /usr/local/include/g2o/core/factory.h:63:78: note: initializing argument 2 of ‘void g2o::Factory::registerType(const string&, const std::shared_ptr&)’ 63 | const std::shared_ptr& c); | ~~~~~~~~~~~~~^ make[2]: [CMakeFiles/teb_local_planner.dir/build.make:63: CMakeFiles/teb_local_planner.dir/src/timed_elastic_band.cpp.o] Error 1 make[2]: [CMakeFiles/teb_local_planner.dir/build.make:102: CMakeFiles/teb_local_planner.dir/src/visualization.cpp.o] Error 1 make[2]: [CMakeFiles/teb_local_planner.dir/build.make:141: CMakeFiles/teb_local_planner.dir/src/homotopy_class_planner.cpp.o] Error 1 make[2]: [CMakeFiles/teb_local_planner.dir/build.make:76: CMakeFiles/teb_local_planner.dir/src/optimal_planner.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:78: CMakeFiles/teb_local_planner.dir/all] Error 2 make: [Makefile:141: all] Error 2

jamestkpoon commented 2 years ago

I had the same problem. What fixed it for me was making this fn:

template < typename T> void register_type(g2o::Factory* factory, const std::string name) { std::uniqueptr<g2o::HyperGraphElementCreator> ptr(new g2o::HyperGraphElementCreator()); std::sharedptr<g2o::HyperGraphElementCreator> shared(std::move(ptr_));

factory->registerType(name, shared_); }

and then e.g. factory->registerType("EDGE_PREFER_ROTDIR", new g2o::HyperGraphElementCreator); becomes register_type< EdgePreferRotDir>(factory, "EDGE_PREFER_ROTDIR");

spok7 commented 8 months ago

template < typename T> void register_type(g2o::Factory* factory, const std::string name) { std::uniqueptr ptr(new g2o::HyperGraphElementCreator()); std::sharedptr shared(std::move(ptr_));

factory->registerType(name, shared_); }

I'm not a c++ guy, so it took me a few hours before realizing the \<T> got formatted away because of markdown. For fellow copy-pasters struggling on Melodic/Noetic, here's the corrected code:

template <typename T>
void register_type(g2o::Factory* factory, const std::string name)
{
  std::unique_ptr<g2o::HyperGraphElementCreator<T>> ptr_(new g2o::HyperGraphElementCreator<T>());
  std::shared_ptr<g2o::HyperGraphElementCreator<T>> shared_(std::move(ptr_));

  factory->registerType(name, shared_);
}

...or better yet, just look at the commit below the comment I'm quoting.