how to use gazebo_ros_f3d contact sensor
Goal: I would like to add a contact sensor gazebo plugin to robot in Gazebo, which can connect to ROS (indigo + gazebo7+ubuntu14). Specifically, adding gazebo_ros_f3d contact sensor to grasping_frame link.
I learn from Tutorial: Using Gazebo plugins with ROS
I add the below script to source code of MODEL.xacro, in the meanwhile reference to the source code of gazebo_ros_f3d for contact message and Camera section
<!-- modify the script of Camera section to corresponding contact plugin according to gazebo_ros_f3d.cpp API--->
<gazebo reference="grasping_frame">
<sensor type="contact" name="my_contact">
<update_rate>30.0</update_rate>
<contact>
<collision>grasping_frame_collision</collision>
</contact>
<plugin name="contact_sensor_controller" filename="libgazebo_ros_f3d.so">
<robotNamespace>/seven_dof_arm</robotNamespace>
<bodyName>grasping_frame</bodyName>
<topicName>grasping_frame_contact_fb</topicName>
<frameName>grasping_frame</frameName>
</plugin>
</sensor>
</gazebo>
Then I
roslaunch seven_dof_arm_gazebo seven_dof_arm_world.launch
gazebo crash:
[ INFO] [1496675172.098873708, 0.022000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[ INFO] [1496675172.124006178, 0.047000000]: Physics dynamic reconfigure ready.
[INFO] [WallTime: 1496675172.168461] [0.089000] Calling service /gazebo/spawn_urdf_model
Service call failed: transport error completing service call: unable to receive data from sender, check sender's logs for details
Segmentation fault (core dumped)
[gazebo-2] process has died [pid 8635, exit code 139, cmd /opt/ros/indigo/lib/gazebo_ros/gzserver -e ode /home/shawn/catkin_ws/src/gazebo_ros_demos/rrbot_gazebo/worlds/rrbot.world __name:=gazebo __log:=/home/shawn/.ros/log/827c11a8-4a00-11e7-bf24-e4a4716f540f/gazebo-2.log].
log file: /home/shawn/.ros/log/827c11a8-4a00-11e7-bf24-e4a4716f540f/gazebo-2*.log
[gazebo_gui-3] process has died [pid 8659, exit code 255, cmd /opt/ros/indigo/lib/gazebo_ros/gzclient __name:=gazebo_gui __log:=/home/shawn/.ros/log/827c11a8-4a00-11e7-bf24-e4a4716f540f/gazebo_gui-3.log].
log file: /home/shawn/.ros/log/827c11a8-4a00-11e7-bf24-e4a4716f540f/gazebo_gui-3*.log
[urdf_spawner-4] process has finished cleanly
log file: /home/shawn/.ros/log/827c11a8-4a00-11e7-bf24-e4a4716f540f/urdf_spawner-4*.log
I open spawner-4*.log file to check:
[rosout][INFO] 2017-06-05 23:02:20,171: Loading model xml from ros parameter
14 [rosout][INFO] 2017-06-05 23:02:20,177: Waiting for service /gazebo/ spawn_urdf_model
15 [rospy.internal][INFO] 2017-06-05 23:02:20,373: topic[/rosout] adding connection to [/rosout], count 0
16 [rospy.internal][INFO] 2017-06-05 23:02:20,675: topic[/clock] adding connection to [http://evashawn:35881/], count 0
17 [rosout][INFO] 2017-06-05 23:02:20,783: Calling service /gazebo/ spawn_urdf_model
18 [rospy.core][INFO] 2017-06-05 23:02:21,011: signal_shutdown [atexit]
19 [rospy.internal][WARNING] 2017-06-05 23:02:21,012: Unknown error initiating TCP/IP socket to evashawn:33521
(http://evashawn:35881/): Traceback (most recent call last):
20 File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/impl/tcpros_base. py", line 555, in connect
21 self.socket.connect((dest_addr, dest_port))
22 File "/usr/lib/python2.7/socket.py", line 224, in meth
23 return getattr(self._sock,name)(*args)
24 error: [Errno 111] Connection refused
25
26 [rospy.internal][INFO] 2017-06-05 23:02:21,012: topic[/clock] removing connection to http://evashawn:35881/
27 [rospy.internal][INFO] 2017-06-05 23:02:21,013: topic[/rosout] removing connection to /rosout
28 [rospy.impl.masterslave][INFO] 2017-06-05 23:02:21,013: atexit
What's going on? Thanks!