code: def get_controller_state(self):
          
          dpos = self.control[:3] * 0.005
          roll, pitch, yaw = self.control[3:] * 0.005
          self.grasp = self.control_gripper
  
          # convert RPY to an absolute orientation
          drot1 = rotation_matrix(angle=-pitch, direction=[1., 0, 0], point=None)[:3, :3]
          drot2 = rotation_matrix(angle=roll, direction=[0, 1., 0], point=None)[:3, :3]
          drot3 = rotation_matrix(angle=yaw, direction=[0, 0, 1.], point=None)[:3, :3]
  
          self.rotation = self.rotation.dot(drot1.dot(drot2.dot(drot3)))
  
          return dict(
              dpos=dpos, rotation=self.rotation, grasp=self.grasp, reset=self._reset_state
          )
docs: Returns the current state of the 3d mouse, a dictionary of pos, orn, grasp, and reset.