Exemple #1
0
def get_step_trajectories(x0_, p_, ground_heights_=None):

    if ground_heights_ is None:
        total_leg_length = p_['spring_resting_length']
        total_leg_length += p_['actuator_resting_length']
        ground_heights_ = np.linspace(0, -0.5*total_leg_length, 10)
    x0_ = sys.reset_leg(x0_, p_)
    trajectories_ = list()
    for height in ground_heights_:
        x0_[-1] = height
        trajectories_.append(sys.step(x0_, p_))
    x0_[-1] = 0.0  # reset x0 back to 0
    return trajectories_
Exemple #2
0
def get_step_trajectories(x0, p, ground_heights=None):
    '''
    helper function to apply a battery of ground-height perturbations.
    returns a list of trajectories.
    '''

    if ground_heights is None:
        total_leg_length = p['resting_length']
        total_leg_length += p['actuator_resting_length']
        ground_heights = np.linspace(0, -0.5 * total_leg_length, 10)
    x0 = model.reset_leg(x0, p)
    trajectories = list()
    for height in ground_heights:
        x0[-1] = height
        trajectories.append(model.step(x0, p))
    x0[-1] = 0.0  # reset x0 back to 0
    return trajectories
Exemple #3
0
def get_step_trajectories(x0, p, ground_heights=None):
    '''
    helper function to apply a battery of ground-height perturbations.
    returns a list of trajectories.
    '''

    if ground_heights is None:
        total_leg_length = p['resting_length']
        total_leg_length += p['actuator_resting_length']
        ground_heights = np.linspace(0, -0.5 * total_leg_length, 10)
    x0 = model.reset_leg(x0, p)

    # start_idx = np.argwhere(~np.isclose(p['actuator_force'][1], 0))[0]
    # time_to_activation = p['actuator_force'][0, start_idx]

    trajectories = list()
    for height in ground_heights:
        x0[-1] = height
        # time_to_touchdown = np.sqrt(2*(x0[5] - x0[-1])/p['gravity'])
        # p['activation_delay'] = time_to_touchdown - time_to_activation
        trajectories.append(model.step(x0, p))
    x0[-1] = 0.0  # reset x0 back to 0
    return trajectories