gazebo_ros碰撞传感器仿真:
1. 使用的插件:filename="libgazebo_ros_bumper.so"
相关链接:
Gazebo contact sensor added to a robot link in urdf file is not working as expected? - Gazebo: Q&A Forum有效:注意在urdf的link中如果给collision起名为例如contact_link_collision(并且必须以_collision结尾),则gazebo文件中的sensor里的<contact>标签需要填写contact_link_collision_collision。
最重要的是,被当做传感器的link与整个tf tree不能是fixed形式的joint连接!!
成功输出以下格式信息
gazebo_msgs/ContactsState
其中只有在当做传感器的link真正与其他物体碰撞时,states才不是空值,且contact_positions只能返回接触点的绝对坐标信息;
如需要可进一步开发,返回接触点的相对坐标信息。
2. 在编译本地版本的bumper插件时,遇到如下错误:
error: #error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer headers. Please regenerate this file with a newer version of protoc.
经搜索是个protoc版本的老问题了,相似问题和解决办法:
$ cd /usr/local/include/google
sudo rm -rf protobuf
- Go, download
protobuf-2.6.1
from here and extract the contents. (I downloadedprotobuf-2.6.1.tar.gz
) -
I followed the installation instructions given here. Which are:
$ ./autogen.sh
$ ./configure
$ make
$ make check
$ sudo make install
$ sudo ldconfig
-
Right now I'm able to compile my workspace without a problem.
3. 安装FreeCAD,画出想要模拟碰撞传感器的部件形状:比如两个四分之一圆的弧形代表扫地机器人的碰撞传感器部件(两个是因为有两个触发点),在两个弧形部件上分别插入一个bumper插件即可模拟两个碰撞传感器。