Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prismatic joint always goes to minimum position when given a lower position in Z than its current position. #2785

Open
fnndyl opened this issue Feb 19, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@fnndyl
Copy link

fnndyl commented Feb 19, 2025

Environment

  • OS Version:
    Ubuntu 22.04
  • Source or binary build?
    Harmonic 8.8.0

Description

  • Expected behavior: A prismatic joint drives a platform up and down relative to a fixed link. The base link has a fixed joint with the world.
  • Actual behavior: Publishing to the prismatic joint controller plugin works as intended when moving UPWARDS in z, however whenever a command is given that is lower than the current Z height of the platform, the platform descends to the minimum value for the prismatic joint and stays there no matter what further commands are given.

Steps to reproduce

  1. Run this .sdf file with gz sim:
<?xml version="1.0" ?>
<sdf version="1.6">
  <world name="default">
    <scene>
      <ambient>0.4 0.4 0.4</ambient>
      <grid>false</grid>
    </scene>

    <!--              -->
    <!-- Illumination -->
    <!--              -->

    <light type="directional" name="sun">
      <cast_shadows>false</cast_shadows>
      <pose>5 5 5 0 0 0</pose>
      <diffuse>0.8 0.8 0.8 1</diffuse>
      <specular>0.2 0.2 0.2 1</specular>
      <attenuation>
        <range>1000</range>
        <constant>0.9</constant>
        <linear>0.01</linear>
        <quadratic>0.001</quadratic>
      </attenuation>
      <direction>-1 -1 -1</direction>
    </light>
 
    <!--        -->
    <!-- Models -->
    <!--        -->

    <model name="barge">
      <pose>0 0 0 0 0 0</pose>

      <!-- Fix To World -->
      <joint name="foundation" type="fixed">
        <parent>world</parent>
        <child>root</child>
      </joint>

      <!-- LINKS  -->

      <link name="root">
        <visual name="root_debug_visual">
          <geometry>
            <sphere>
              <radius>0.025</radius>
            </sphere>
          </geometry>
          <material>
            <ambient>0 0.5 0.5 1</ambient>
            <diffuse>0 0.8 0.8 1</diffuse>
            <specular>0.8 0.8 0.8 1</specular>
          </material>
        </visual>
      </link>

      <link name='base'>
        <pose relative_to='root'>0 0 0 0 0 0</pose>
        <visual name='base_visual'>
          <geometry>
            <box>
              <size>0.5 0.5 0.05</size>
            </box>
          </geometry>
          <material>
            <diffuse>1 1 1 1</diffuse>
            <specular>0.4 0.4 0.4 1</specular>
          </material>
        </visual>
        <collision name='base_collision'>
          <geometry>
            <box>
              <size>0.5 0.5 0.05</size>
            </box>
          </geometry>
          <surface>
            <friction>
              <ode>
                <mu>1.0</mu>
                <mu2>1.0</mu2>
              </ode>
            </friction>
            <bounce>
              <restitution_coefficient>0.1</restitution_coefficient>
              <threshold>1.0</threshold>
            </bounce>
          </surface>
        </collision>
      </link>

      <!-- JOINTS -->
      <joint name="heave" type="prismatic">
        <parent>root</parent>
        <child>base</child>
        <pose>0 0 0 0 0 0</pose>
        <axis>
          <xyz>0 0 1</xyz>
          <limit>
            <lower>-2</lower>
            <upper>2</upper>
            <velocity>1</velocity>
            <effort>500</effort>
          </limit>
          <dynamics>
            <damping>3</damping>
          </dynamics>
        </axis>
      </joint>

      <!-- PLUGINS -->
    
      <plugin
        filename="gz-sim-joint-position-controller-system"
        name="gz::sim::systems::JointPositionController">
        <joint_name>heave</joint_name>
        <use_velocity_commands>true</use_velocity_commands>
        <topic>heave_ctrl</topic>
      </plugin>

      <plugin
        filename="gz-sim-joint-state-publisher-system"
        name="gz::sim::systems::JointStatePublisher">
        <joint_name>heave</joint_name>
      </plugin>

    </model>
  </world>
</sdf>
  1. Set the base position to higher than 0m in z:
    gz topic -t "/heave_ctrl" -m gz.msgs.Double -p "data: 0.5"

  2. Set the base position to lower than 0.5m:
    gz topic -t "/heave_ctrl" -m gz.msgs.Double -p "data: 0"

  3. The platform does not return to zero but sinks to -2m as defined as the minimum in the prismatic joint.

@fnndyl fnndyl added the bug Something isn't working label Feb 19, 2025
@fnndyl
Copy link
Author

fnndyl commented Feb 20, 2025

Have confirmed this doesnt work in Gazebo Ionic 9.1.0. Would love to know if this is simply something I have configured incorrectly.

@azeey
Copy link
Contributor

azeey commented Feb 20, 2025

I have confirmed this locally. It appears to be a bug only in the DART implementation. The example runs without any issues with the bullet-featherstone physics engine. I've also noticed that the issue seems to be related to the velocity limit. Removing the position limits and setting the effort limit to infinity shows that the low velocity limit is the culprit.

      <joint name="heave" type="prismatic">
        <parent>root</parent>
        <child>base</child>
        <pose>0 0 0 0 0 0</pose>
        <axis>
          <xyz>0 0 1</xyz>
          <limit>
            <velocity>1</velocity>
            <effort>inf</effort>
          </limit>
        </axis>
      </joint>

I suspect this is a bug in DART itself.

@fnndyl
Copy link
Author

fnndyl commented Feb 20, 2025

Thank you so much! Feel free to close this if its out of gz-sim scope, but that workaround will sort me out. Will link to this issue on the various other forums I raised this on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Inbox
Development

No branches or pull requests

2 participants