show() #with_weight = True with_weight = False is_fixed = False use_snake = True w = World() njoints = 9 lengths = [1., .9, .8 , .7 , .6, .5, .4 , .3, .2] masses = [1., .9, .8 , .7 , .6, .5, .4 , .3, .2] gvel = gvel=[2.]*njoints gpos = [0, 3.14159/4., 0, 0, 0, 0, 0, 0, 0] #gpos = [0.]*njoints if use_snake: add_snake(w, njoints, lengths=lengths, masses=masses, gpos=gpos, gvel=gvel, is_fixed=False) else: assert njoints == 9 add_robot(w, gpos=gpos, gvel=gvel, is_fixed=is_fixed) if with_weight: w.register(arboris.controllers.WeightController()) t_end = 2.08 else: t_end = 1.430 nrj = EnergyMonitor(w) mM = MassMonitor(w) w.observers.append(mM) #w.observers.append(Drawer(w))
show() t_start, t_end, dt = 0., 2.08, 0.005 t_end = 1.430 #### timeline = arange(t_start, t_end, dt) with_weight = False is_fixed = False world = ObservableWorld() world._up = array([0., 0., 1.]) # we use matlab's convention njoints = 9 lengths = [1., .9, .8 , .7 , .6, .5, .4 , .3, .2] masses = [1., .9, .8 , .7 , .6, .5, .4 , .3, .2] gvel = gvel=[2.]*njoints gpos = [0, 3.14159/4., 0, 0, 0, 0, 0, 0, 0] add_snake(world, njoints, lengths, masses, gvel=[2.]*njoints, is_fixed=is_fixed) name = "haha" if with_weight: world.register(WeightController(world)) simulate_mat(world, timeline, name) simulate_py(world, timeline, name) matpy = load_matpy(name) d = diff_matpy(*matpy) print max_error(d) plot_energy(*matpy)
show() t_start, t_end, dt = 0., 2.08, 0.005 t_end = 1.430 #### timeline = arange(t_start, t_end, dt) with_weight = False is_fixed = False world = World() world._up = array([0., 0., 1.]) # we use matlab's convention njoints = 9 lengths = [1., .9, .8 , .7 , .6, .5, .4 , .3, .2] masses = [1., .9, .8 , .7 , .6, .5, .4 , .3, .2] gvel = gvel=[2.]*njoints gpos = [0, 3.14159/4., 0, 0, 0, 0, 0, 0, 0] add_snake(world, njoints, lengths, masses, gvel=[2.]*njoints, is_fixed=is_fixed) name = "haha" if with_weight: world.register(WeightController(world)) simulate_mat(world, timeline, name) simulate_py(world, timeline, name) matpy = load_matpy(name) d = diff_matpy(*matpy) print max_error(d) plot_energy(*matpy)