예제 #1
0
 def __call__(
     self, scene_node: habitat_sim.SceneNode, actuation_spec: SpinSpec
 ):
     # Rotate about the +y (up) axis
     rotation_ax = habitat_sim.geo.UP
     scene_node.rotate_local(mn.Deg(actuation_spec.spin_amount), rotation_ax)
     # Calling normalize is needed after rotating to deal with machine precision errors
     scene_node.rotation = scene_node.rotation.normalized()
예제 #2
0
        def __call__(self, scene_node: habitat_sim.SceneNode,
                     actuation_spec: MoveAndSpinSpec):
            forward_ax = (np.array(
                scene_node.absolute_transformation().rotation_scaling())
                          @ habitat_sim.geo.FRONT)
            scene_node.translate_local(forward_ax *
                                       actuation_spec.forward_amount)

            # Rotate about the +y (up) axis
            rotation_ax = habitat_sim.geo.UP
            scene_node.rotate_local(mn.Deg(actuation_spec.spin_amount),
                                    rotation_ax)
            # Calling normalize is needed after rotating to deal with machine precision errors
            scene_node.rotation = scene_node.rotation.normalized()
예제 #3
0
def _noisy_move(scene_node: habitat_sim.SceneNode, forward_amount: float,
                spin_amount: float, noise: bool):
    forward_ax = (
        np.array(scene_node.absolute_transformation().rotation_scaling())
        @ habitat_sim.geo.FRONT)
    forward_noise = np.random.normal(forward_amount,
                                     FORWARD_NOISE) if noise else 0
    forward = np.clip(forward_amount + forward_noise,
                      np.maximum(forward_amount - FN_CLIP_RATIO * X, 0),
                      forward_amount + FN_CLIP_RATIO * X)
    scene_node.translate_local(forward_ax * forward)

    spin_noise = np.random.normal(0,
                                  SPIN_NOISE) * 180 / 3.141592 if noise else 0
    spin = np.clip(spin_amount + spin_noise,
                   spin_amount - SN_CLIP_RATIO * THETA,
                   spin_amount + SN_CLIP_RATIO * THETA)

    #print('forward : {}, spin : {}'.format(forward,spin))
    # Rotate about the +y (up) axis
    rotation_ax = habitat_sim.geo.UP
    scene_node.rotate_local(mn.Deg(spin), rotation_ax)
    # Calling normalize is needed after rotating to deal with machine precision errors
    scene_node.rotation = scene_node.rotation.normalized()