5

cartographer_frontier_detection

 2 years ago
source link: https://charon-cheung.github.io/2022/05/13/%E8%87%AA%E4%B8%BB%E6%8E%A2%E7%B4%A2/cartographer_frontier_detection/%E7%BC%96%E8%AF%91%20cartographer_frontier_detection/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

编译 cartographer_frontier_detection

编译 cartographer_frontier_detection
2022-05-13|自主探索cartographer_frontier_detection|
Word count: 386|Reading time: 1 min

这个作者是真懒,放到github就不管了,几个人在issue提出编译失败,他也不回复,我给他发邮件,他也不回复

删除cartographer/cmake/modules/FindAbseil.cmake

我对CMakeLists进行了修改,主要是absl相关,比如cartographer_frontier_detection\cartographer_frontier_detection\cartographer\CMakeLists.txt

find_package(Abseil REQUIRED) 改为 find_package(absl REQUIRED)

target_link_libraries(${PROJECT_NAME} PUBLIC ${PROTOBUF_LIBRARY} standalone_absl)改为

target_link_libraries(${PROJECT_NAME} PUBLIC ${PROTOBUF_LIBRARY} 
absl::algorithm
absl::base
absl::debugging
absl::flat_hash_map
absl::memory
absl::meta
absl::numeric
absl::str_format
absl::strings
absl::synchronization
absl::time
absl::utility
)

最终仍然是这个报错
br317RsOhotmKIH.png

然后将cartographer-config.cmake.in中的find_package(Abseil ${QUIET_OR_REQUIRED_OPTION}) 改为 find_package(absl REQUIRED)。 作者用absl库的一些函数替代了carto::common的函数,比如absl::MutexLock代替carto::common::MutexLocker

如果是新安装的ubuntu,一般能编译通过了。如果之前已经装过cartographer了,cartographer_rviz会出问题,Rviz插件Submaps不正常。因为这次的插件和之前的安装的Submaps插件是不同的,终端会报错:

[/rviz] wants topic /submap_list to have datatype/md5sum [cartographer_ros_msgs/SubmapList/73b1e412208f0787050395996f6143db], but our version has [cartographer_ros_msgs/SubmapList/853a6fd3598626d65ab60752cc4a6117]. Dropping connection

在Rviz里看不到地图,使用rostopic echo也看不到。 看上去这个报错的是cartographer_ros_msgs没有编译好,其实编译已经成功,问题是Rviz插件
14__11_06_09.png

只要执行
source ~/frontier_detection/devel_isolated/cartographer_ros_msgs/setup.zsh

然后使用echo就能看到submap_list的消息了,但是Rviz插件仍然失败,所以应该把这个插件改名称和类型,相当于编译新插件

最终我在虚拟机上(刚装完ROS)运行成功了,红色的边界就是话题frontier_marker

9q3B1stuDJn2rSl.png

参考:编译cartographer


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK