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

Inertial <pose relative_to="some_frame"> has no effect #380

Closed
sloretz opened this issue Sep 29, 2020 · 2 comments · Fixed by #480
Closed

Inertial <pose relative_to="some_frame"> has no effect #380

sloretz opened this issue Sep 29, 2020 · 2 comments · Fixed by #480
Assignees

Comments

@sloretz
Copy link
Contributor

sloretz commented Sep 29, 2020

I'm unable to get the pose of an <inertial> relative to a frame using sdformat9. It looks like the relative_to attribute has no effect if used in the <pose> of an <inertial>. The pose is always treated as if it were in link frame.

Screenshot from 2020-09-29 14-23-29

<?xml version='1.0' encoding='utf-8'?>
<sdf version="1.7">
  <model name="pose_inertial_in_frame">
    <frame name="some_frame">
      <pose>0 0 1 0 0 0</pose>-->
    </frame>
    <link name="pose_inertial_in_frame_link">
      <visual name="pose_inertial_in_frame_link_visual">
        <pose relative_to="some_frame">0 0 0 0 0 0</pose>
        <geometry>
          <box>
            <size>0.1 0.2 0.4</size>
          </box>
        </geometry>
      </visual>
      <collision name="pose_inertial_in_frame_link_collision">
        <pose relative_to="some_frame">0 0 0 0 0 0</pose>
        <geometry>
          <box>
            <size>0.1 0.2 0.4</size>
          </box>
        </geometry>
      </collision>
      <inertial>
        <pose relative_to="some_frame">0 0 0 0 0 0</pose>
        <mass>1.23</mass>
        <inertia>
          <ixx>0.0205</ixx>
          <ixy>0</ixy>
          <ixz>0</ixz>
          <iyy>0.017425</iyy>
          <iyz>0</iyz>
          <izz>0.005125</izz>
        </inertia>
      </inertial>
    </link>
  </model>
</sdf>

It looks like the inertial is in the wrong pose using gazebo 11.1.0. It should be at the same location as the visual and collision, but it's in the ground.

The SDFormat API doesn't have a SemanticPose() API for inertials. I was expecting the Inertial() API to return a pose in link frame, but with the relative_to frame resolved. It looks like the issue is a variable inertialFrame is initialized, but never set with the true value: Edit: loadPose sets the variable inertiaFrame, but then it's not used anywhere after that.

https://github.com/osrf/sdformat/blob/b6c761ba38652ea440c4f728d60ef4b85cebf511/src/Link.cc#L169-L177

https://github.com/osrf/sdformat/blob/b6c761ba38652ea440c4f728d60ef4b85cebf511/src/Link.cc#L204-L205

@EricCousineau-TRI
Copy link
Collaborator

EricCousineau-TRI commented Dec 17, 2020

EDIT: Ignore this suggestion. It's bad.

This is feasible for libsdformat11 milestone:

  • Add Link::ResolveInertial(relative_to="")
  • Deprecate Link::Inertial()
  • Replace with explicit Link::RawInertial()

Alternative:

  • Fail fast if //inertial/pose/relative_to is non-default

@EricCousineau-TRI
Copy link
Collaborator

Per f2f, would be simplest to error out if //inertial/pose/@relative_to is non-default.

It's probably a niche case to have that and //link/pose/@relative_to differ (creds to @sammy-tri)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants