Ask Your Question
0

how to get the pressure of the models link which touch the ground

asked 2019-06-19 02:42:48 -0500

ugluo gravatar image

I want to use the 'Darwin' robots from github repository to analysis the robot's walking with AI methods,but the feedback data is not enough in gazebo.

How to get the pressure of the models link which touch the ground using URDF?

attaching the Darwin description in gazebo darwin.urdf description repository

edit retag flag offensive close merge delete

Comments

I add FT sensor in the foot link

<xacro:gazebo_pressure prefix="left" parent="left_m6" num="0" x="-0.03" y="-0.03" z="-0.034"/> <xacro:gazebo_pressure prefix="left" parent="left_m6" num="1" x="0.03" y="-0.03" z="-0.034"/> <xacro:gazebo_pressure prefix="left" parent="left_m6" num="2" x="-0.03" y="0.03" z="-0.034"/> <xacro:gazebo_pressure prefix="left" parent="left_m6" num="3" x="0.03" y="0.03" z="-0.034"/>

<xacro:gazebo_pressure prefix="right" parent="right_m6" num="0" x="-0.03" y="-0.03" z="-0.034"/> <xacro:gazebo_pressure prefix="right" parent="right_m6" num="1" x="0.03" y="-0.03" z="-0.034"/> <xacro:gazebo_pressure prefix="right" parent="right_m6" num="2" x="-0.03" y="0.03" z="-0.034"/> <xacro:gazebo_pressure prefix="right" parent="right_m6" num="3" x="0.03" y="0.03" z="-0.034"/>

ugluo gravatar image ugluo  ( 2019-06-20 02:41:56 -0500 )edit

I add ft_sensor in the foot

<xacro:macro name="gazebo_pressure" params="prefix parent num x y z"> <gazebo> <plugin name="ft_sensor" filename="libgazebo_ros_ft_sensor.so"> <updaterate>100.0</updaterate> <topicname>/${prefix}_foot_sensor_m${num}</topicname> <jointname>${prefix}_foot_sensor_m${num}_j</jointname> </plugin> </gazebo>

<gazebo reference="${prefix}_foot_sensor_m${num}"> <material>Gazebo/Blue</material> <mu1>9000</mu1> <mu2>9000</mu2> <kp>1000000.0</kp> <kd>10.0</kd> <mindepth>0.001</mindepth> <maxcontacts>100</maxcontacts> </gazebo>

</xacro:macro>

<xacro:gazebo_pressure prefix="left" parent="left_m6" num="0" x="-0.03" y="-0.03" z="-0.034"/> <xacro:gazebo_pressure prefix="left" parent="left_m6" num="1" x="0.03" y="-0.03" z="-0.034"/> <xacro:gazebo_pressure prefix="left" parent="left_m6" num="2" x="-0.03" y="0.03" z="-0.034"/>

ugluo gravatar image ugluo  ( 2019-06-20 02:44:43 -0500 )edit

python call rosservice to reset_simulation,but the topic publisher nomal pub late about 100 s, what parameters should i change?

self.subscriber = rospy.Subscriber('/left_foot_sensor_m0', WrenchStamped, self.pressure_callback) rospy.wait_for_service('/gazebo/reset_simulation') self.f_reset_simulation = rospy.ServiceProxy('/gazebo/reset_simulation', Empty)

ugluo gravatar image ugluo  ( 2019-06-20 02:52:52 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-06-20 22:58:15 -0500

ugluo gravatar image

updated 2019-06-21 07:12:18 -0500

gvdhoorn gravatar image

I have solved it

1) urdf I add ft_sensor in the foot

 <xacro:macro name="gazebo_pressure" params="prefix parent num x y z">
    <link name="${prefix}_foot_sensor_m${num}" >
    <inertial>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <mass
        value="0.01" />
      <inertia
        ixx="0.000"
        ixy="0.000"
        ixz="0.000"
        iyy="0.000"
        iyz="0.000"
        izz="0.000" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <box size="0.025 0.025 0.002"/>
      </geometry>
      <material
        name="">
        <color
          rgba="0.75294 0.75294 0.75294 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <box size="0.025 0.025 0.002"/>
      </geometry>
    </collision>
  </link>
<joint 
    name="${prefix}_foot_sensor_m${num}_j"
    type="revolute">
    <origin
      xyz="${x} ${y} ${z}"
      rpy="0 0 0" />
    <parent
      link="${parent}" />
    <child
      link="${prefix}_foot_sensor_m${num}" />
    <axis
      xyz="0 1 0" />
    <limit effort="0" velocity="0" lower="-0.001" upper="0.001" />
  </joint>
  <gazebo reference="${prefix}_foot_sensor_m${num}_j">
    <provideFeedback>true</provideFeedback>
  </gazebo>

  <gazebo>
    <plugin name="ft_sensor" filename="libgazebo_ros_ft_sensor.so">
      <always_on>true</always_on>
      <updateRate>100.0</updateRate>
      <topicName>/leap_one/${prefix}_foot_sensor_m${num}</topicName>
      <jointName>${prefix}_foot_sensor_m${num}_j</jointName>
    </plugin>
  </gazebo>

  <gazebo reference="${prefix}_foot_sensor_m${num}">
        <material>Gazebo/Blue</material>
        <mu1>9000</mu1>
        <mu2>9000</mu2>
        <kp>1000000.0</kp>
        <kd>10.0</kd>
        <minDepth>0.001</minDepth>
        <maxContacts>100</maxContacts>
    </gazebo>

  </xacro:macro>

  <xacro:gazebo_pressure prefix="left"  parent="left_m6" num="0" x="-0.03" y="-0.03" z="-0.034" />
  <xacro:gazebo_pressure prefix="left"  parent="left_m6" num="1" x="0.03" y="-0.03" z="-0.034" />
  <xacro:gazebo_pressure prefix="left"  parent="left_m6" num="2" x="-0.03" y="0.03" z="-0.034" />
  <xacro:gazebo_pressure prefix="left"  parent="left_m6" num="3" x="0.03" y="0.03" z="-0.034" />

  <xacro:gazebo_pressure prefix="right"  parent="right_m6" num="0" x="-0.03" y="-0.03" z="-0.034" />
  <xacro:gazebo_pressure prefix="right"  parent="right_m6" num="1" x="0.03" y="-0.03" z="-0.034" />
  <xacro:gazebo_pressure prefix="right"  parent="right_m6" num="2" x="-0.03" y="0.03" z="-0.034" />
  <xacro:gazebo_pressure prefix="right"  parent="right_m6" num="3" x="0.03" y="0.03" z="-0.034" />

2) modify ros source code clone gazebo_ros_pkgs repository in github add one line in the gazebo_plugins/src/gazebo_ros_ft_sensor.cpp

////////////////////////////////////////////////////////////////////////////////
// Update the controller
void GazeboRosFT::UpdateChild()
{
#if GAZEBO_MAJOR_VERSION >= 8
  common::Time cur_time = this->world_->SimTime();
#else
  common::Time cur_time = this->world_->GetSimTime();
#endif

  // rate control
  if (this->update_rate_ > 0 &&
      (cur_time-this->last_time_).Double() < (1.0/this->update_rate_))
  {
**+++      if(cur_time.Double() >= 5) // ignore it when reset_simulation** 
      return;
  }

  if (this->ft_connect_count_ == 0)
    return;

  physics::JointWrench wrench;
  ignition::math::Vector3d torque;
  ignition::math::Vector3d force;

  // FIXME: Should include options for diferent frames and measure directions
  // E.g: https://bitbucket.org/osrf/gazebo/raw/default/gazebo/sensors/ForceTorqueSensor.hh
  // Get force ...
(more)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-06-19 02:42:48 -0500

Seen: 130 times

Last updated: Jun 21 '19