コード例 #1
0
  def test_multiply_jacobian_preset(self):
    """Test the Jacobian of the multiply function."""
    x_1_init = test_helpers.generate_preset_test_quaternions()
    x_2_init = test_helpers.generate_preset_test_quaternions()

    self.assert_jacobian_is_correct_fn(quaternion.multiply,
                                       [x_1_init, x_2_init])
コード例 #2
0
  def test_jacobian_relative_angle_preset(self):
    """Test the Jacobian of the relative_angle function."""
    x_1_init = test_helpers.generate_preset_test_quaternions()
    x_2_init = test_helpers.generate_preset_test_quaternions()

    # relative angle is not smooth near <q1, q2> = 1, which occurs for
    # certain preset test quaternions.
    self.assert_jacobian_is_finite_fn(quaternion.relative_angle,
                                      [x_1_init, x_2_init])
コード例 #3
0
  def test_multiply_jacobian_preset(self):
    """Test the Jacobian of the multiply function."""
    x_1_init = test_helpers.generate_preset_test_quaternions()
    x_2_init = test_helpers.generate_preset_test_quaternions()
    x_1 = tf.convert_to_tensor(value=x_1_init)
    x_2 = tf.convert_to_tensor(value=x_2_init)

    y = quaternion.multiply(x_1, x_2)

    self.assert_jacobian_is_correct(x_1, x_1_init, y)
    self.assert_jacobian_is_correct(x_2, x_2_init, y)
コード例 #4
0
  def test_jacobian_relative_angle_preset(self):
    """Test the Jacobian of the relative_angle function."""
    x_1_init = test_helpers.generate_preset_test_quaternions()
    x_2_init = test_helpers.generate_preset_test_quaternions()
    x_1 = tf.convert_to_tensor(value=x_1_init)
    x_2 = tf.convert_to_tensor(value=x_2_init)

    y = quaternion.relative_angle(x_1, x_2)

    # relative angle is not smooth near <q1, q2> = 1, which occurs for
    # certain preset test quaternions.
    self.assert_jacobian_is_finite(x_1, x_1_init, y)
    self.assert_jacobian_is_finite(x_2, x_2_init, y)
コード例 #5
0
  def test_rotate_jacobian_preset(self):
    """Test the Jacobian of the rotate function."""
    x_matrix_init = test_helpers.generate_preset_test_quaternions()
    tensor_shape = x_matrix_init.shape[:-1] + (3,)
    x_point_init = np.random.uniform(size=tensor_shape)

    self.assert_jacobian_is_correct_fn(quaternion.rotate,
                                       [x_point_init, x_matrix_init])
コード例 #6
0
  def test_normalize_jacobian_preset(self):
    """Test the Jacobian of the normalize function."""
    x_init = test_helpers.generate_preset_test_quaternions()
    x = tf.convert_to_tensor(value=x_init)

    y = quaternion.normalize(x)

    self.assert_jacobian_is_correct(x, x_init, y)
コード例 #7
0
    def test_from_quaternion_jacobian_preset(self):
        """Test the Jacobian of the from_quaternion function."""
        x_init = test_helpers.generate_preset_test_quaternions()
        x = tf.convert_to_tensor(value=x_init)

        y = rotation_matrix_3d.from_quaternion(x)

        self.assert_jacobian_is_correct(x, x_init, y)
コード例 #8
0
  def test_from_quaternion_preset(self):
    """Tests that a quaternion maps to correct matrix."""
    preset_quaternions = test_helpers.generate_preset_test_quaternions()

    preset_matrices = test_helpers.generate_preset_test_rotation_matrices_3d()

    self.assertAllClose(preset_matrices,
                        rotation_matrix_3d.from_quaternion(preset_quaternions))
コード例 #9
0
  def test_rotate_jacobian_preset(self):
    """Test the Jacobian of the rotate function."""
    x_matrix_init = test_helpers.generate_preset_test_quaternions()
    x_matrix = tf.convert_to_tensor(value=x_matrix_init)
    tensor_shape = x_matrix_init.shape[:-1] + (3,)
    x_point_init = np.random.uniform(size=tensor_shape)
    x_point = tf.convert_to_tensor(value=x_point_init)

    y = quaternion.rotate(x_point, x_matrix)

    self.assert_jacobian_is_correct(x_matrix, x_matrix_init, y)
    self.assert_jacobian_is_correct(x_point, x_point_init, y)
コード例 #10
0
    def test_from_quaternion_jacobian_preset(self):
        """Test the Jacobian of the from_quaternion function."""
        x_init = test_helpers.generate_preset_test_quaternions()

        self.assert_jacobian_is_correct_fn(rotation_matrix_3d.from_quaternion,
                                           [x_init])
コード例 #11
0
  def test_normalize_jacobian_preset(self):
    """Test the Jacobian of the normalize function."""
    x_init = test_helpers.generate_preset_test_quaternions()

    self.assert_jacobian_is_correct_fn(quaternion.normalize, [x_init])
コード例 #12
0
  def test_from_quaternion_jacobian_preset(self):
    """Test the Jacobian of the from_quaternion function."""
    x_init = test_helpers.generate_preset_test_quaternions()

    self.assert_jacobian_is_finite_fn(euler.from_quaternion, [x_init])