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

Spring-damper prismatic joint system plugin #2520

Closed
damanikjosh opened this issue Aug 7, 2024 · 2 comments
Closed

Spring-damper prismatic joint system plugin #2520

damanikjosh opened this issue Aug 7, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@damanikjosh
Copy link

Desired behavior

Simulating spring-damper physics on prismatic joint. https://en.wikipedia.org/wiki/Mass-spring-damper_model. In Gazebo classic it was implemented by modifying ODE parameters https://github.com/arpg/Gazebo/blob/master/test/worlds/spring_damper_test.world, but I can't get it to work on gz-sim. A similar issue was posted in #1961, but instead of modifying the physics, I suggest adding a system plugin to simulate this.

Implementation suggestion

  1. Create JointPosition and JointVelocity for prismatic joint
  2. Send JointForceCmd to the joint entity with spring-damper equation
  3. Add plugin on sdf file similar like below
<plugin filename="libSpringSystem.so" name="spring_system::SpringSystem">
      <spring_constant>1200.0</spring_constant>
      <damping_constant>150.0</damping_constant>
      <joint_name>left_front_shock</joint_name>
      <joint_name>right_front_shock</joint_name>
      <joint_name>left_rear_shock</joint_name>
      <joint_name>right_rear_shock</joint_name>
</plugin>
@damanikjosh damanikjosh added the enhancement New feature or request label Aug 7, 2024
@azeey
Copy link
Contributor

azeey commented Aug 7, 2024

Have you tried using the damping and spring_stiffness parameters in the <dynamics> tag of a joint axis (http://sdformat.org/spec?ver=1.11&elem=joint#axis_dynamics)? I believe those work for prismatic joints, so I don't see the value of adding a separate system to simulate this.

@azeey azeey moved this from Inbox to In progress in Core development Aug 7, 2024
@damanikjosh
Copy link
Author

I finally solved this. The problem was the model loaded using URDF and I found out that URDF doesn't support spring_stiffness parameter natively (http://wiki.ros.org/urdf/XML/joint). But this one works (https://github.com/gazebosim/sdf_tutorials/blob/master/urdf/sdf_extensions.md)

<gazebo>
    <springStiffness>1200</<springStiffness>
</gazebo>

I will close this issue, thank you.

@github-project-automation github-project-automation bot moved this from In progress to Done in Core development Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests

2 participants