'actuator_force_period': 10, # * s 'activation_amplification': 1, 'activation_delay': 0.0, # * a delay for when to start activation 'constant_normalized_damping': 0.75, # * s : D/K : [N/m/s]/[N/m] 'linear_normalized_damping_coefficient': 3.5, # * A: s/m : D/F : [N/m/s]/N : 0.0035 N/mm/s -> 3.5 1/m/s from Kirch et al. Fig 12 'linear_minimum_normalized_damping': 0.05, # * 1/A*(kg*N/kg) : 'swing_leg_norm_angular_velocity': 0, # [1/s]/[m/s] (omega/(vx/lr)) 'swing_velocity': 0, # rad/s (set by calculation) 'angle_of_attack_offset': 0} # rad (set by calculation) # * linear_normalized_damping_coefficient: # * A: s/m : D/F : [N/m/s]/N : 0.0035 N/mm/s -> 3.5 1/m/s (Kirch et al. Fig 12) x0 = np.array([0, 1.00, 5.5, 0, 0, 0, p['actuator_resting_length'], 0, 0, 0]) x0 = model.reset_leg(x0, p) p['total_energy'] = model.compute_total_energy(x0, p) x0, p = model.create_open_loop_trajectories(x0, p) p['x0'] = x0 p['activation_amplification'] = 1.5 # initialize default x0_daslip p_map = model.poincare_map p_map.p = p p_map.x = x0 p_map.sa2xp = model.sa2xp_y_xdot_timedaoa # p_map.sa2xp = model.sa2xp_y_xdot_aoa p_map.xp2s = model.xp2s_y_xdot s_grid_height = np.linspace(0.5, 1.5, 7) s_grid_velocity = np.linspace(3, 8, 7) s_grid = (s_grid_height, s_grid_velocity) a_grid_aoa = np.linspace(00/180*np.pi, 70/180*np.pi, 21)
tictoc.tic() name = 'guineafowl' # name folder and files to save data # * find spring stiffness that results in limit cycle motion legStiffnessSearchWidth = p['stiffness'] * 0.5 limit_cycle_options = { 'search_initial_state': False, 'state_index': 2, # not used 'state_search_width': 2.0, # not used 'search_parameter': True, 'parameter_name': 'stiffness', 'parameter_search_width': legStiffnessSearchWidth } print(p['stiffness'], ' N/m :Leg stiffness prior to fitting') x0, p = model.create_open_loop_trajectories(x0, p, limit_cycle_options) print(p['stiffness'], ' N/m :Leg stiffness after fitting') # * Save parameter fit if not os.path.exists(name): os.makedirs(name) filename = name + '/' + name + '_parameter_fit' data2save = { "p": p, "x0": x0, "limit_cycle_options": limit_cycle_options, "damping_vals": damping_vals } outfile = open(filename + '.pickle', 'wb') pickle.dump(data2save, outfile)