Pressure sensor implementation [closed]

asked 2013-03-17 03:02:51 -0500

Giacomo gravatar image

updated 2014-01-28 17:15:45 -0500

ngrennan gravatar image

I'm implementing a tape pressure sensor (like this: http: // in gazebo as a small link with attached a bumper to keep track of the contacts and measure the total_wrench acting on it (in particular to the z-axis component). This is my urdf:

<robot name="pressure_sensor">

  <link name="base_link">
      <mass value="0.001"/>
      <origin xyz="0 0 0.0005"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
      <origin xyz="0 0 0" rpy="0 0 0"/>
        <box size="0.1 0.5 0.1"/>
      <origin xyz="0 0 0" rpy="0 0 0"/>
        <box size="0.1 0.5 0.001"/>

  <gazebo reference="base_link">
    <sensor:contact name="contact_sensor">
    <controller:gazebo_ros_bumper name="gazebo_ros_bumper_controller" plugin="">
          <interface:bumper name="bumper_iface" />


and this is the callback function of the bumper topic "weight" subscriber node:

void pressureCallback(const gazebo_msgs::ContactsState::ConstPtr& msg){
    if(msg != NULL && msg->states.size()>0) {
        for(i=0;i<msg->states.size(); i++){
            if((msg->states[i].geom2_name).compare("[MY_LINK_GEOM]")==0) {
                if(msg->states[i].total_wrench.force.z >= 0) sum+=msg->states[i].total_wrench.force.z;
                else sum-=msg->states[i].total_wrench.force.z;
        ROS_INFO("Weight detected: %f Kg", sum);

where [MY_LINK_GEOM] is the name of the link - of the object I want to measure the weight - that touches my pressure sensor.

It seems to work but I cannot understand why the weight measurements vary in such a different way with the time passing as shown in the figure: https: // Is there in your opinion a better implementation for that?

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2015-12-12 01:14:54.415646