robogym/envs/dactyl/goals/face_cube_solver.py [122:159]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        }

    def relative_goal(self, goal_state, current_state):
        """
        Calculate a difference in the 'goal space' between current state and the target goal
        """
        if goal_state["goal_type"] == "rotation":
            orientation_distance = cube_utils.distance_quat_from_being_up(
                current_state["cube_quat"],
                goal_state["axis_nr"],
                goal_state["axis_sign"],
            )
        elif goal_state["goal_type"] == "flip":
            orientation_distance = rotation.quat_difference(
                goal_state["cube_quat"], current_state["cube_quat"]
            )
        else:
            raise ValueError('unknown goal_type "{}"'.format(goal_state["goal_type"]))

        return {
            # Cube pos does not count
            "cube_pos": np.zeros(goal_state["cube_pos"].shape),
            # Quaternion difference of a rotation
            "cube_quat": orientation_distance,
            # Angle differences
            "cube_face_angle": rotation.normalize_angles(
                goal_state["cube_face_angle"] - current_state["cube_face_angle"]
            ),
        }

    def goal_distance(self, goal_state, current_state):
        """ Distance from the current goal to the target state. """
        relative_goal = self.relative_goal(goal_state, current_state)

        goal_distance = {
            "cube_pos": 0.0,
            "cube_quat": rotation.quat_magnitude(relative_goal["cube_quat"]),
            "cube_face_angle": np.linalg.norm(relative_goal["cube_face_angle"]),
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



robogym/envs/dactyl/goals/face_free.py [145:182]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        }

    def relative_goal(self, goal_state, current_state):
        """
        Calculate a difference in the 'goal space' between current state and the target goal
        """
        if goal_state["goal_type"] == "rotation":
            orientation_distance = cube_utils.distance_quat_from_being_up(
                current_state["cube_quat"],
                goal_state["axis_nr"],
                goal_state["axis_sign"],
            )
        elif goal_state["goal_type"] == "flip":
            orientation_distance = rotation.quat_difference(
                goal_state["cube_quat"], current_state["cube_quat"]
            )
        else:
            raise ValueError('unknown goal_type "{}"'.format(goal_state["goal_type"]))

        return {
            # Cube pos does not count
            "cube_pos": np.zeros(goal_state["cube_pos"].shape),
            # Quaternion difference of a rotation
            "cube_quat": orientation_distance,
            # Angle differences
            "cube_face_angle": rotation.normalize_angles(
                goal_state["cube_face_angle"] - current_state["cube_face_angle"]
            ),
        }

    def goal_distance(self, goal_state, current_state):
        """ Distance from the current goal to the target state. """
        relative_goal = self.relative_goal(goal_state, current_state)

        goal_distance = {
            "cube_pos": 0.0,
            "cube_quat": rotation.quat_magnitude(relative_goal["cube_quat"]),
            "cube_face_angle": np.linalg.norm(relative_goal["cube_face_angle"]),
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



