前言
机器人仿真中使用力传感器,因此需要gazebo添加相应的传感器
URDF编辑
力传感器需要添加到关节上,虽然声称可以添加到杆上,但会报告错误。 http://gazebosim.org/tutorials?tut=force_torque_sensor&cat=sensors#Addingaforce/torquesensortoalink
<gazebo reference="sensor_joint2"> <provideFeedback>true</provideFeedback> <disableFixedJointLumping>true</disableFixedJointLumping> </gazebo>
其中, disableFixedJointLumping
使用标签fixed使用关节。如果不使用,会报错。
gazebo_ros_ft_sensor plugin error: jointName: sensor_joint2 does not exist
若不使用disableFixedJointLumping
标签,关节设置revolute,关节活动的上下限为0. https://answers.ros.org/question/251231/gazebo-tag-disablefixedjointlumping-didnt-work/
gazebo插件编辑
<!-- The ft_sensor plugin --> <gazebo> <plugin name="ft_sensor" filename="libgazebo_ros_ft_sensor.so"> <updateRate>100.0</updateRate> <topicName>ft_sensor_topic</topicName> <jointName>sensor_joint2</jointName> </plugin> </gazebo>
可以添加一些参数,如噪声,可以通过原始代码查看。 https://github.com/ros-simulation/gazebo_ros_pkgs/blob/kinetic-devel/gazebo_plugins/include/gazebo_plugins/gazebo_ros_ft_sensor.h