I finally figure out how to do this. Basicly, I added the ft_sensor plugin to my urdf.
Following my code:
<gazebo reference="${name}_fixed_base_joint">
<provideFeedback>true</provideFeedback>
</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>schunk_wsg50_fixed_base_joint</jointName>
</plugin>
</gazebo>
some remarks:
- this plugin works with a joint, in my case
"${name}_fixed_base_joint"
is the name of the joint connecting the robot to the end-effector and it is fixed type
- have look at the plugin implementation to figure out the reference frame in which the wrench is given
Hope this can help. :)
Originally posted by mrslvgg with karma: 191 on 2016-05-14
This answer was ACCEPTED on the original site
Post score: 3
Original comments
Comment by mizu_lily on 2016-06-17:
I always get an error that the joint I want to cope with does not exist. Did you have the same problem before? And can you tell me how you define the inertial parameters to get a right measurement? Thanks a lot!
Comment by mrslvgg on 2016-06-17:
Sounds like probably you misspelled the joint name in the URDF. Consider that in my example code the parameter name
contains the string schunk_wsg50. To be sure, fill both gazebo reference, and jointName tags with the correct joint name. All the inertial parameters of my robot remained untouched.
Comment by SorinV on 2017-07-20:
What type of joint are you using?
Comment by AlanSixth on 2019-05-24:
Sometimes I get the jointName: joint does not exist error too. It's certainly not a typo and I find that it depends on which specific joint on choose for a robot arm model with a mobile base.
A potential solution: http://answers.gazebosim.org/question/13109/cant-find-specific-joint-when-using-gazebo-model-plugin-libgazebo_ros_ft_sensorso/
Comment by JoshuaElliott on 2020-12-09:
This worked for me, below is the macro for the entire joint that I add the sensor to
<xacro:macro name="fixed_joint_macro" params="xyz name parent child limit">
<joint name="${name}" type="prismatic">
<parent link="${parent}"/>
<child link="${child}"/>
<origin rpy="0 0 0" xyz="${xyz}"/>
<axis xyz="1 0 0"/>
<limit effort="1000" lower="-0.0001" upper="0.0001" velocity="10"/>
</joint>
<gazebo reference="${name}">
<provideFeedback>true</provideFeedback>
</gazebo>
<!-- The ft_sensor plugin -->
<gazebo>
<plugin name="ft_sensor" filename="libgazebo_ros_ft_sensor.so">
<updateRate>100.0</updateRate>
<topicName>sensor_${name}</topicName>
<jointName>${name}</jointName>
</plugin>
</gazebo>
</xacro:macro>