Robotics StackExchange | Archived questions

How to simulate a compression spring

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?

Asked by Cerin on 2015-04-09 19:48:54 UTC

Comments

Answers

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>

Asked by scpeters on 2015-04-12 23:57:46 UTC

Comments

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

Asked by jacknlliu on 2017-11-09 00:07:48 UTC

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)

Asked by josephcoombe on 2018-06-12 13:08:53 UTC