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

Velocity decay for links not working #635

Open
vbalaji21 opened this issue May 8, 2024 · 6 comments
Open

Velocity decay for links not working #635

vbalaji21 opened this issue May 8, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@vbalaji21
Copy link

vbalaji21 commented May 8, 2024

Environment

  • OS Version: Ubuntu 20.04
  • Source or binary build? Ignition Fortress

Description

  • Expected behavior: Damping action of links based on velocity decay tags
  • Actual behavior: Damping does not happen

Steps to reproduce

  1. Make a simple 2 link manipulator (base link and another free link at an intial pose to enable free falling under gravity.
  2. Add velocity decay tag for each link (both linear and angular with a nice coefficent eg:- 0.04)
  3. On pressing play simulation the free link should fall down under the effect of gravity and come to rest position equilibrium, It does not happen as it is always moving nothing to damp this motion.

Output

I have attached a video and SDF file for this.

free_swinging_motion_pendulum.mp4
<?xml version="1.0" encoding="UTF-8"?>

<sdf version="1.6">
   <world name="multicopter">
      <physics name="4ms" type="ignored">
         <max_step_size>0.004</max_step_size>
         <real_time_factor>1.0</real_time_factor>
      </physics>
      <plugin filename="ignition-gazebo-physics-system" name="gz::sim::systems::Physics" />
      <plugin filename="ignition-gazebo-scene-broadcaster-system" name="gz::sim::systems::SceneBroadcaster" />
      <plugin filename="ignition-gazebo-user-commands-system" name="gz::sim::systems::UserCommands" />
      <plugin filename="ignition-gazebo-sensors-system" name="gz::sim::systems::Sensors">
         <render_engine>ogre2</render_engine>
      </plugin>
      <light type="directional" name="sun">
         <cast_shadows>true</cast_shadows>
         <pose>0 0 10 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>-0.5 0.1 -0.9</direction>
      </light>
      <model name="ground_plane">
         <static>true</static>
         <link name="link">
            <collision name="collision">
               <geometry>
                  <plane>
                     <normal>0 0 1</normal>
                     <size>100 100</size>
                  </plane>
               </geometry>
            </collision>
            <visual name="visual">
               <geometry>
                  <plane>
                     <normal>0 0 1</normal>
                     <size>100 100</size>
                  </plane>
               </geometry>
               <material>
                  <ambient>0.8 0.8 0.8 1</ambient>
                  <diffuse>0.8 0.8 0.8 1</diffuse>
                  <specular>0.8 0.8 0.8 1</specular>
               </material>
            </visual>
         </link>
      </model>
      <model name="connected_system">
         <include>
            <name>pole_1</name>
            <pose>0 0 1.5 0 0 0</pose>
            <uri>/home/vignesh/.ignition/fuel/custom_models/pole</uri>
         </include>

         <link name="link1">
            <pose>0.0 -0.1 3.0 1.57 0 0</pose>
            <velocity_decay>
               <linear>2.1</linear>
               <angular>2.1</angular>
            </velocity_decay>
            <inertial>
               <inertia>
                  <ixx>0.3358e-03</ixx>
                  <ixy>0.0</ixy>
                  <ixz>0.0</ixz>
                  <iyy>0.3358e-03</iyy>
                  <iyz>0.0</iyz>
                  <izz>5.0e-06</izz>
               </inertia>
               <mass>0.001</mass>
            </inertial>
            <collision name="collision">
               <geometry>
                  <cylinder>
                     <length>0.2</length>
                     <radius>0.01</radius>
                  </cylinder>
               </geometry>
            </collision>
            <visual name="visual">
               <geometry>
                  <cylinder>
                     <length>0.2</length>
                     <radius>0.01</radius>
                  </cylinder>
               </geometry>
               <material>
                  <script>
                     <uri>file://media/materials/scripts/gazebo.material</uri>
                     <name>Gazebo/Black</name>
                  </script>
               </material>
            </visual>
         </link>
         
         <joint type="ball" name="hinge_1">
            <pose>0 0 1.5 0 0 0</pose>
            <parent>link1</parent>
            <child>pole_1::p1</child>
            <axis>
               <use_parent_model_frame>true</use_parent_model_frame>
               <xyz>1 1 1</xyz>
               <dynamics>
                  <damping>10.04</damping>
               </dynamics>
            </axis>
         </joint>         

      </model>
   </world>
</sdf>
@vbalaji21 vbalaji21 added the bug Something isn't working label May 8, 2024
@azeey
Copy link
Contributor

azeey commented May 8, 2024

Thanks for the SDF file, but as is, we won't be able to try it because it references a file ( <uri>/home/vignesh/.ignition/fuel/custom_models/pole</uri>) that we won't have. Do you mind simplifying it, so it's all in just one model. Alternatively, paste the contents of the referenced file where the <include> is?

@vbalaji21
Copy link
Author

vbalaji21 commented May 8, 2024

@azeey Yes, I have simplified and added the entire contents of the sdf in a simple way (I have also tested it again to reproduce it). I have attached it as a txt file as the code command pasting was not formatting well.

pendulum.txt

@iche033
Copy link
Contributor

iche033 commented May 8, 2024

I think the <velocity_decay> param is not be supported in gz yet? I don't see it in sdf's Link DOM or any references to it in gz-physics.

Gazebo-classic reads the SDF element and applies linear / angular damping to the links. We would just need to do the same here.

@vbalaji21
Copy link
Author

@iche033 can you please let me know when it will be implemented. My project is struck on it as I cannot do velocity decay for links or joints. I can also help you in the implementation and looking forward to get it done in a week. please let me know

@iche033
Copy link
Contributor

iche033 commented May 14, 2024

Do you need to use a ball joint? If you can use a revolute joint (or universal joint), the joint <damping> param should have an effect and make the free link come to a rest:

         <joint type="revolute" name="hinge_1">
            <pose>0 0 1.5 0 0 0</pose>
            <parent>link1</parent>
            <child>p1</child>
            <axis>
               <use_parent_model_frame>true</use_parent_model_frame>
               <xyz>1 0 0</xyz>
               <dynamics>
                  <damping>0.0001</damping>
               </dynamics>
            </axis>
         </joint>

@vbalaji21
Copy link
Author

@iche033 I tried the universal joint, it did not work and also saw the source code in gz-physics it did not support it. The revolute joint works for damping but my requirement is to have 3 DOF rotational joint so I need a ball joint. I tried a work around suggested by @azeey by having 2 dummy links to have it as 3 DOF rotational joint between the links. The movement is not the way I intended it to and shows a different motion. Since there is no damping in the links or joints, this is becoming a constraint and affecting my project. Is it possible to bring the changes done in Gazebo classic here ? It would be very helpful for my project

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

3 participants