1、这个代码不要通过git 下载(其他的我仿真过程直接git源码是ok的,不晓得这个是啥子原因),直接去github 中下载这个包的压缩包,这个下载时编译文件会缺失部分代码。我当时是sdf_tools 同级的cmake 文件缺失代码。
2、如果遇到报错nlopt相关,先安装,如果我们环境中已经安装了,还是报错,那么将src下的CMakeLists.txt 文件下使用查找和替换将NLopt改为nlopt。很大可能是这个原因。
3、如果遇到某些库没有安装,
比如报错 Could not find a package configuration file provided by "moveit_core" with any of the following names:
moveit_coreConfig.cmake
moveit_core-config.cmake
sudo apt-get install ros-melodic-moveit-core
对于其他库,也是使用这个命令,注意替换后面的包的名字。
4、以下报错一定会存在,第三章的内容已经是17年的代码了,由于OpenCV的版本从 opencv2 到 opencv3 再到 opencv4 的升级过程中,对于 cv::Mat, CvMat 和 IplImage 之间的相互转换关系操作一直在变化中。源码编译的时候,需要根据实际的编译环境 opencv 的版本来调整相应的代码。
解决办法:将/home/cora/catkin_ws/src/third_party/sdf_tools/src/sdf_tools .cpp文件中的第第79行开始的
boost::shared_ptr<urdf::Model> urdf_model(new urdf::Model());
urdf_model->initString(GenerateSDFComputeBotURDFString());
// Make the SRDF model
boost::shared_ptr<srdf::Model> srdf_model(new srdf::Model());
srdf_model->initString(*urdf_model, GenerateSDFComputeBotSRDFString());
// Make the planning scene
planning_scene_ptr_.reset();
planning_scene_ptr_ = std::shared_ptr<planning_scene::PlanningScene>(new planning_scene::PlanningScene(urdf_model, srdf_model));
代码改为新的标准方式:
auto urdf_model = std::make_shared<urdf::Model>();
urdf_model->initString(GenerateSDFComputeBotURDFString());
// Make the SRDF model
auto srdf_model = std::make_shared<srdf::Model>();
srdf_model->initString(*urdf_model, GenerateSDFComputeBotSRDFString());
// Make the planning scene
planning_scene_ptr_ = std::make_shared<planning_scene::PlanningScene>(urdf_model, srdf_model);
5、现在编译已经是可以通过了。接下来可以按照github中的仿真命令进行仿真。
本文参考了在OpenCV-3.4.9的环境中编译 Prometheus 和prometheus_px4(填坑实录)_beegreen的博客-CSDN博客感谢vslam专栏文章。