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

Setting initial velocity #50

Closed
osrf-migration opened this issue Mar 11, 2020 · 4 comments
Closed

Setting initial velocity #50

osrf-migration opened this issue Mar 11, 2020 · 4 comments
Labels
close the gap Features from Gazebo-classic enhancement New feature or request physics Involves Ignition Physics

Comments

@osrf-migration
Copy link

Original report (archived issue) by Til Hoff (Bitbucket: turakar).


I am trying to set the initial velocity of a model in the .sdf file. Therefore I defined a state according to the sdformat spec. This setting seems to be ignored by gazebo. Is there a different way of doing this? Or is there something wrong? The SDF file:

<?xml version="1.0" ?>

<sdf version="1.6">
  <world name="foobar">

    <physics name="1ms" type="ode">
      <max_step_size>0.001</max_step_size>
      <real_time_factor>1.0</real_time_factor>
    </physics>
    <plugin
            filename="libignition-gazebo-scene-broadcaster-system.so"
            name="ignition::gazebo::systems::SceneBroadcaster">
    </plugin>
    <plugin
      filename="libignition-gazebo-physics-system.so"
      name="ignition::gazebo::systems::Physics">
    </plugin>

    <gui fullscreen="0">

      <!-- 3D scene -->
      <plugin filename="GzScene3D" name="3D View">
        <ignition-gui>
          <title>3D View</title>
          <property type="bool" key="showTitleBar">false</property>
          <property type="string" key="state">docked</property>
        </ignition-gui>

        <engine>ogre2</engine>
        <scene>scene</scene>
        <ambient_light>0.4 0.4 0.4</ambient_light>
        <background_color>0.8 0.8 0.8</background_color>
        <camera_pose>-6 0 6 0 0.5 0</camera_pose>
      </plugin>

      <!-- World control -->
      <plugin filename="WorldControl" name="World control">
        <ignition-gui>
          <title>World control</title>
          <property type="bool" key="showTitleBar">false</property>
          <property type="bool" key="resizable">false</property>
          <property type="double" key="height">72</property>
          <property type="double" key="width">121</property>
          <property type="double" key="z">1</property>

          <property type="string" key="state">floating</property>
          <anchors target="3D View">
            <line own="left" target="left"/>
            <line own="bottom" target="bottom"/>
          </anchors>
        </ignition-gui>

        <play_pause>true</play_pause>
        <step>true</step>
        <start_paused>true</start_paused>
        <service>/world/foobar/control</service>
        <stats_topic>/world/foobar/stats</stats_topic>

      </plugin>

      <!-- World statistics -->
      <plugin filename="WorldStats" name="World stats">
        <ignition-gui>
          <title>World stats</title>
          <property type="bool" key="showTitleBar">false</property>
          <property type="bool" key="resizable">false</property>
          <property type="double" key="height">110</property>
          <property type="double" key="width">290</property>
          <property type="double" key="z">1</property>

          <property type="string" key="state">floating</property>
          <anchors target="3D View">
            <line own="right" target="right"/>
            <line own="bottom" target="bottom"/>
          </anchors>
        </ignition-gui>

        <sim_time>true</sim_time>
        <real_time>true</real_time>
        <real_time_factor>true</real_time_factor>
        <iterations>true</iterations>
        <topic>/world/foobar/stats</topic>
      </plugin>

    </gui>

    <light type="directional" name="sun">
      <cast_shadows>true</cast_shadows>
      <pose>0 0 10 0 0 0</pose>
      <diffuse>1 1 1 1</diffuse>
      <specular>0.5 0.5 0.5 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>

    <gravity>0 0 0</gravity>

    <model name="probe">
      <link name="link">
        <inertial>
          <mass>30</mass>
          <inertia>
            <ixx>12</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>12</iyy>
            <iyz>0</iyz>
            <izz>12</izz>
          </inertia>
        </inertial>
        <visual name="visual">
          <geometry>
            <sphere>
              <radius>1</radius>
            </sphere>
          </geometry>
          <material>
            <ambient>0.5 0.5 1.0 1</ambient>
            <diffuse>0.5 0.5 1.0 1</diffuse>
            <specular>0.0 0.0 1.0 1</specular>
          </material>
        </visual>
        <collision name="collision">
          <geometry>
            <sphere>
              <radius>1</radius>
            </sphere>
          </geometry>
        </collision>
      </link>
    </model>

    <state world_name="foobar">
      <model name="probe">
        <pose>0 0 0 0 -0 0</pose>
        <link name="link">
          <pose>0 0 0 0 0 0</pose>
          <velocity>10 0 0 0 0 0</velocity>
        </link>
      </model>
    </state>

  </world>
</sdf>

@osrf-migration
Copy link
Author

Original comment by Diego Ferigo (Bitbucket: dgferigo).


As far as I know, this is not yet supported by Ignition Gazebo. I recently needed to change the base velocity of a model, and I had to implement a new custom WorldVelocityCmd component and modify my vendored Physics system. Note that this is specific to the model base and not for generic links.

Maybe this could be a starting point to port a similar modification upstream and perhaps extending it to all model’s links.

@osrf-migration
Copy link
Author

Original comment by Addisu Z. Taddese (Bitbucket: azeey, GitHub: azeey).


The <state> tag is not yet supported in ign-gazebo. I've just created a PR adding that to the feature comparison page

@chapulina chapulina added enhancement New feature or request physics Involves Ignition Physics and removed minor labels Apr 29, 2020
@chapulina
Copy link
Contributor

We most likely won't support the <state> tags in Ignition. See #137 for more context.

This feature could be implemented as a forward-port of gazebo::InitialVelocityPlugin, with an extension to support links as well as models.

@chapulina chapulina added the close the gap Features from Gazebo-classic label May 29, 2020
@chapulina
Copy link
Contributor

chapulina commented Jul 29, 2021

It's possible to set an initial velocity for models or joints since #693. Using the VelocityControl plugin or JointController plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
close the gap Features from Gazebo-classic enhancement New feature or request physics Involves Ignition Physics
Projects
None yet
Development

No branches or pull requests

2 participants