Skip to content

Commit

Permalink
more inertia debugging (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
codekansas authored May 15, 2024
1 parent fe78166 commit bba673c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion kol/onshape/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,11 @@ def get_urdf_part(self, key: Key, joint: Joint | None = None) -> urdf.Link:
logger.info("Converting STL file to %s", part_file_path)
stl_to_fmt(part_file_path_stl, part_file_path)

mass = part_dynamic.mass[0]
if mass <= 0.0:
logger.error("Part %s has a mass of %f, which is invalid", part_name, mass)
mass = 1.0

# Move the mesh origin and dynamics from the part frame to the parent
# joint frame (since URDF expects this by convention).
mesh_origin = urdf.Origin.zero_origin()
Expand Down Expand Up @@ -647,7 +652,7 @@ def get_urdf_part(self, key: Key, joint: Joint | None = None) -> urdf.Link:
xyz=center_of_mass,
rpy=principal_axes_rpy,
),
mass=part_dynamic.mass[0],
mass=mass,
inertia=urdf.Inertia(
ixx=float(inertia[0, 0]),
ixy=float(inertia[0, 1]),
Expand Down
2 changes: 1 addition & 1 deletion kol/scripts/pybullet.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def draw_box(pt: list[list[float]], color: tuple[float, float, float], obj_id: i
prev_control_values[k] = target_position
p.setJointMotorControl2(robot, joints[k], p.POSITION_CONTROL, target_position)
except p.error:
logger.exception("Failed to set joint %s", k)
logger.debug("Failed to set joint %s", k)
pass

# Step simulation.
Expand Down

0 comments on commit bba673c

Please sign in to comment.