Gazebo | Ignition | Community
Ask Your Question

how to use gazebo_ros_f3d contact sensor

asked 2017-06-05 10:24:35 -0500

shawnysh gravatar image

updated 2017-06-10 23:10:03 -0500

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">
                <plugin name="contact_sensor_controller" filename="">

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/ __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/", line 224, in meth
 23     return getattr(self._sock,name)(*args)
 24 error: [Errno 111] Connection refused
 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!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-06-11 19:27:42 -0500

shawnysh gravatar image

I look through this code of PR2 and found the solution.

gazebo_ros_f3d plugin must be put directly in gazebo tag rather than under sensor tag. The link which plugin is attached to is specified by child element of plugin, which is bodyName

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-06-05 10:24:35 -0500

Seen: 6,408 times

Last updated: Jun 11 '17