Skip to content

Commit

Permalink
Add default value
Browse files Browse the repository at this point in the history
  • Loading branch information
HoangGiang93 committed Aug 22, 2024
1 parent ff3bbff commit 0d0db65
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,15 @@ def _import_inertial(self, body: urdf.Link, body_builder: BodyBuilder) -> None:
if self._config.inertia_source == InertiaSource.FROM_SRC:
if body.inertial is not None:
body_mass = body.inertial.mass
body_center_of_mass = body.inertial.origin.xyz
body_center_of_mass = body.inertial.origin.xyz if body.inertial.origin is not None else numpy.array([0.0, 0.0, 0.0])
body_inertia = body.inertial.inertia
body_inertia_tensor = numpy.array([[body_inertia.ixx, body_inertia.ixy, body_inertia.ixz],
[body_inertia.ixy, body_inertia.iyy, body_inertia.iyz],
[body_inertia.ixz, body_inertia.iyz, body_inertia.izz]])
body_inertia_tensor = shift_inertia_tensor(mass=body_mass,
inertia_tensor=body_inertia_tensor,
quat=Rotation.from_euler('xyz',
body.inertial.origin.rpy).inv()
body.inertial.origin.rpy if body.inertial.origin is not None else numpy.array([0.0, 0.0, 0.0])).inv()
.as_quat())

body_diagonal_inertia, body_principal_axes = diagonalize_inertia(inertia_tensor=body_inertia_tensor)
Expand Down

0 comments on commit 0d0db65

Please sign in to comment.