首先给出问题描述
最初的问题是希望在gazebo中设置一个动态行走的人,然后能被激光雷达扫描到,这里参考的链接
https://robkin.blog.csdn.net/article/details/128203687
作者给的教程非常完整,但是其中我所遇到的BUG非常难受
编译碰撞插件error
编译报错主要是包括
error: #error This file was generated by an older version of protoc which is
error: #error This file was generated by a newer version of protoc which is
这两种
让我非常不理解,版本过高与版本过低同时出现是什么鬼,但是当我现在完全解决以后,我发现我直接参考这个链接就行了
https://blog.csdn.net/lc740390316/article/details/86493220
简单来说,就是更改Protobuf的版本
Protobuf版本问题
在知道是版本问题以后,我需要知道我的Ubuntu20.04 + gazebo11现在应该对应哪个版本,这个Protobuf版本具体参考这个链接,简单来说就是进入gazebo库文件,随便找个头文件打开,会有要求Protobuf的版本的句子,我的是
#if GOOGLE_PROTOBUF_VERSION < 3006001
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
意思就是需要3.6.1及以上的Protobuf版本
但是我这里犯了一个严重的错误
我自己系统里面本身存在的3.4.0版本的Protobuf是源码的下载的,而我更新的3.6.1版本的Protobuf是二进制下载的(图方便了),导致出现下面的错误:
This program was compiled against version 3.4.0 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.6.1). Contact the program author for an update. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library.
意思就是两个版本的Protobuf产生了冲突,运行 gazebo actor_collisions.world 这一步就会出错
最后我恍然大悟,卸载了二进制的3.6.1版本的Protobuf,删除了3.4.0版本的Protobuf是源码,按照链接
https://blog.csdn.net/m0_49448331/article/details/107734989
的方式老老实实安装,最终终于运行成功!