Home | Tutorials | Wiki | Issues
Ask Your Question
1

How to simulate a compression spring

asked 2015-04-09 19:48:54 -0600

Cerin gravatar image

How would you model a piston-like compression spring, which would look essentially like a cylinder attached something at either end, but whose length changes by a configurable amount, asserting a force in proportion to Hooke's law?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2015-04-12 23:57:46 -0600

scpeters gravatar image

Drawing from the spring_damper_test.world, here's a model with a single prismatic joint that has the spring_stiffness parameter applied:

<?xml version="1.0" ?>
<sdf version="1.4">
  <model name="model_6_prismatic_sdf">
    <pose>0.0 1.5 0.6  0 0 0</pose>
    <link name="link">
      <inertial>
        <inertia>
          <ixx>0.01</ixx>
          <ixy>0.0</ixy>
          <ixz>0.0</ixz>
          <iyy>0.01</iyy>
          <iyz>0.0</iyz>
          <izz>0.01</izz>
        </inertia>
        <mass>1.0</mass>
      </inertial>
      <visual name="visual">
        <geometry>
          <cylinder>
            <length>0.1</length>
            <radius>0.1</radius>
          </cylinder>
        </geometry>
        <material>
          <script><uri>file://media/materials/scripts/gazebo.material</uri><name>Gazebo/Green</name></script>
        </material>
      </visual>
      <collision name="collision">
        <geometry>
          <cylinder>
            <length>0.1</length>
            <radius>0.1</radius>
          </cylinder>
        </geometry>
      </collision>
    </link>
    <joint name="joint" type="prismatic">
      <parent>world</parent>
      <child>link</child>
      <pose>0.0 0.0 0.5  0 0 0</pose>
      <axis>
        <limit>
          <lower>-1.0</lower>
          <upper>1.0</upper>
        </limit>
        <xyz>0.0 0.0 1.0</xyz>
        <dynamics>
          <spring_stiffness>111.1111</spring_stiffness>
          <spring_reference>0.0</spring_reference>
          <damping>0.0</damping>
          <friction>0.0</friction>
        </dynamics>
      </axis>
    </joint>
  </model>
</sdf>
edit flag offensive delete link more

Comments

not work when set parent link as other link in the gazebo scene

jacknlliu gravatar imagejacknlliu ( 2017-11-08 23:07:48 -0600 )edit

2 follow-up questions: Does the `spring_stiffness` parameter represent the spring constant (Hooke's Law) or is it different? What are the units of the `spring_stiffness` parameter? (Trying to simulating gas spring in Gazebo)

josephcoombe gravatar imagejosephcoombe ( 2018-06-12 13:08:53 -0600 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2015-04-09 19:48:54 -0600

Seen: 2,598 times

Last updated: Apr 12 '15