in differentiable_robot_model/rigid_body.py [0:0]
def __init__(self, rigid_body_params, device="cpu"):
super().__init__()
self._device = torch.device(device)
self.joint_id = rigid_body_params["joint_id"]
self.name = rigid_body_params["link_name"]
# parameters that can be made learnable
self.inertia = DifferentiableSpatialRigidBodyInertia(
rigid_body_params, device=self._device
)
self.joint_damping = lambda: rigid_body_params["joint_damping"]
self.trans = lambda: rigid_body_params["trans"].reshape(1, 3)
self.rot_angles = lambda: rigid_body_params["rot_angles"].reshape(1, 3)
# end parameters that can be made learnable
# local joint axis (w.r.t. joint coordinate frame):
self.joint_axis = rigid_body_params["joint_axis"]
self.joint_limits = rigid_body_params["joint_limits"]
self.joint_pose = CoordinateTransform(device=self._device)
self.joint_pose.set_translation(torch.reshape(self.trans(), (1, 3)))
# local velocities and accelerations (w.r.t. joint coordinate frame):
self.joint_vel = SpatialMotionVec(device=self._device)
self.joint_acc = SpatialMotionVec(device=self._device)
self.update_joint_state(
torch.zeros([1, 1], device=self._device),
torch.zeros([1, 1], device=self._device),
)
self.update_joint_acc(torch.zeros([1, 1], device=self._device))
self.pose = CoordinateTransform(device=self._device)
self.vel = SpatialMotionVec(device=self._device)
self.acc = SpatialMotionVec(device=self._device)
self.force = SpatialForceVec(device=self._device)
return