ContactSensor in Gazebo/Fuerte

Create issue
Issue #13 closed
ugocupcic created an issue

from: http://answers.ros.org/question/41765/contactsensor-in-gazebofuerte/

I am trying to get the Shadow-hand running in Fuerte, both the real one (EtherCAT) and the simulated one. For grasp planning, information about contacts/collision is obviously kind of important, and the Shadow hand simulation URDF model includes Gazebo bumpers (contact sensors) on all fingers. The sensors were working fine in Electric, and we got nice approximated wrenches from Gazebo.

In Fuerte, everything compiles, and the "deprecated" parser looks like it is doing the right thing of mapping the urdf <sensor:contact><geom> tag to the <contact><collision> conversions as required by newest SDF.

Problem is, the first subscriber to one of the bumper topics triggers a ContactSensor.GetContacts() call, which in turn detects that the "contacts" data-structure is read but was NEVER initialized...

Please don't blaim this on the Shadow-Hand stack. We also tried using the Gazebo contact-sensors on the PR2 gripper (vanilla Fuerte install on Ubuntu 12.04), and the same error message from "ContactSensor.cc:237" results. Simply broken in Fuerte, and possibly never tested before?

Comments (14)

  1. Thomas Koletschka

    The problem is that ContactSensor::GetCollisionName returns just the name of the collision object/geometry and not the scoped name while ContactSensor::OnContact uses the scoped name to fill the contacts map. This is easily fixed by replacing result = this->collisions[_index]->GetName(); with result = this->collisions[_index]->GetScopedName(); in line 177 of src/sensors/ContactSensor.cc (in 1.0.x the "src" folder is called "gazebo" ... thanks for renaming that btw, it was kinda confusing)

  2. ugocupcic reporter

    Would it be possible to have an update on this? The concact sensor are still broken in 1.6.16, when can we expect the 1.6.17 release to be pushed to users?

  3. Thomas Koletschka

    Newer gazebo releases are available as tags at https://code.ros.org/svn/ros-pkg/stacks/simulator_gazebo/tags/ for you to install as overlay ... 1.6.17 does not seem to be tagged as such but 1.7.0 uses r 7e81d745eb07 as well and any later version should do as well. The groovy beta release seems to still use 1.6.16 as well.

    What's not included in those versions however is the fix for #141 but as a user of the ros bumper plugin which makes use of the public ContactSensor API you don't want to use that fix anyway until #244 has been resolved.

    The contact sensor works the way it is in r 7e81d745eb07 in terms of detecting contacts, but you will be spammed with a lot of error messages until the sensor has its first contact. Upon releasing contact the ros bumper plugin will continue to show the same contact because it's not deleted until the next contact occurs but the contacts will correctly show 0 force and torque after losing contact.

  4. Jose Escobar

    Hey, i'm trying to fix it by replacing the lines that Thomas said but i don'y finf the directory, colud you help me with this? i look for a gazebo directory inside simulator_gazebo, but only found a ConstactSensors.hh in /simulator_gazebo/gazebo/gazebo/include/gazebo-1.0.2/gazebo/sensors/

  5. Thomas Koletschka

    Jose, it's fairly complicated to apply a patch to gazebo within the ros gazebo package manually and you don't need to fix it yourself. It's easier if you simply create an overlay for the simulator_gazebo stack using the latest tag ... i.e. do a "svn co https://code.ros.org/svn/ros-pkg/stacks/simulator_gazebo/tags/simulator_gazebo-1.7.6/ simulator_gazebo" in a directory that's in your ROS_PACKAGE_PATH before the root installation and compile it (which will take some time because it will download and compile the appropriate gazebo version with the fix for ContactSensors).

    If you need further help regarding getting the latest gazebo version please ask a question on answers.gazebosim.org

  6. Jose Escobar

    i did what you said, but now the gazebo doesn't spawn the shadow_hand and the gazebo runs too slow... any idea?? i installed the version 1.6.7...

  7. Thomas Koletschka

    1.6.7 is a pretty old version. Install 1.7.0 or newer (1.7.6 is the latest tagged version).

  8. Log in to comment