Exemplo n.º 1
0
  def test_from_axis_angle_jacobian_random(self):
    """Test the Jacobian of the from_axis_angle function."""
    x_axis_init, x_angle_init = test_helpers.generate_random_test_axis_angle()
    x_axis = tf.convert_to_tensor(value=x_axis_init)
    x_angle = tf.convert_to_tensor(value=x_angle_init)

    y = euler.from_axis_angle(x_axis, x_angle)

    self.assert_jacobian_is_finite(x_axis, x_axis_init, y)
    self.assert_jacobian_is_finite(x_angle, x_angle_init, y)
Exemplo n.º 2
0
  def test_from_axis_angle_gimbal(self, gimbal_configuration):
    """Checks that from_axis_angle works when Ry = pi/2 or -pi/2."""
    random_euler_angles = test_helpers.generate_random_test_euler_angles()
    random_euler_angles[..., 1] = gimbal_configuration

    random_matrix = rotation_matrix_3d.from_euler(random_euler_angles)
    random_axis, random_angle = axis_angle.from_euler(random_euler_angles)
    predicted_random_angles = euler.from_axis_angle(random_axis, random_angle)
    reconstructed_random_matrices = rotation_matrix_3d.from_euler(
        predicted_random_angles)

    self.assertAllClose(reconstructed_random_matrices, random_matrix, atol=1e-3)