axi/examples/butterfly_test.py

27 lines
71 KiB
Python
Raw Normal View History

2017-01-05 03:01:55 +00:00
from axi import Planner
def main():
planner = Planner(
2017-01-06 21:35:27 +00:00
acceleration=100, max_velocity=200, corner_factor=0.1)
2017-01-05 03:01:55 +00:00
draws = list(PATHS)
jogs = []
for p1, p2 in zip(draws, draws[1:]):
jogs.append([p1[-1], p2[0]])
paths = draws + jogs
paths[::2] = draws
paths[1::2] = jogs
2017-01-05 19:50:33 +00:00
print 'var PIECES = ['
2017-01-05 03:01:55 +00:00
for i, path in enumerate(paths):
print '['
2017-01-06 21:35:27 +00:00
plan = planner.plan(path)
2017-01-05 19:50:33 +00:00
for b in plan.blocks:
2017-01-06 21:35:27 +00:00
record = (b.p1.x, b.p1.y, b.p2.x, b.p2.y, b.a, b.t, i)
2017-01-05 03:01:55 +00:00
print '[%s],' % ','.join(map(str, record))
print '],'
print '];'
2017-01-05 04:12:33 +00:00
PATHS = [[(258.8, 3.9), (252.57, 7.297), (246.486, 11.028), (240.558, 15.084), (234.797, 19.452), (229.213, 24.12), (223.816, 29.077), (218.617, 34.312), (213.625, 39.812), (208.851, 45.567), (204.306, 51.565), (199.999, 57.794), (195.941, 64.242), (192.141, 70.899), (188.611, 77.751), (185.361, 84.789), (182.4, 92), (179.058, 101.147), (175.987, 110.125), (173.498, 118.016), (171.9, 123.9), (170.239, 130.748), (168.812, 135.337), (168.167, 136.829), (167.555, 137.808), (166.969, 138.292), (166.4, 138.3), (165.802, 137.839), (165.362, 136.938), (165.092, 135.642), (165, 134), (164.877, 132.083), (164.462, 130.587), (163.692, 129.373), (162.5, 128.3), (161.67, 127.67), (161.036, 126.987), (160.568, 126.043), (160.237, 124.625), (159.87, 119.525), (159.7, 110), (159.636, 100.662), (159.862, 95.225), (160.14, 93.441), (160.558, 92), (161.137, 90.69), (161.9, 89.3), (163.775, 86.512), (164.677, 85.545), (165.575, 84.85), (166.482, 84.417), (167.412, 84.237), (168.38, 84.302), (169.4, 84.6), (170.162, 85.048), (170.789, 85.748), (171.269, 86.634), (171.587, 87.637), (171.733, 88.693), (171.692, 89.733), (171.452, 90.691), (171, 91.5), (169.688, 92.739), (169.172, 92.94), (168.75, 92.862), (168.422, 92.509), (168.188, 91.88), (168, 89.8), (168, 86.6), (165.8, 88.7), (164.702, 89.942), (164.212, 90.987), (164.267, 92.089), (164.8, 93.5), (165.511, 94.65), (166.362, 95.425), (167.458, 95.862), (168.9, 96), (170.154, 95.913), (171.227, 95.641), (172.133, 95.167), (172.887, 94.475), (173.506, 93.549), (174.005, 92.372), (174.397, 90.928), (174.7, 89.2), (174.903, 87.08), (174.675, 85.587), (173.884, 84.377), (172.4, 83.1), (171.132, 82.266), (169.872, 81.719), (168.607, 81.462), (167.325, 81.5), (166.015, 81.838), (164.666, 82.481), (163.264, 83.434), (161.8, 84.7), (160.704, 85.961), (159.742, 87.491), (158.919, 89.288), (158.237, 91.35), (157.701, 93.675), (157.314, 96.259), (157.079, 99.102), (157, 102.2), (156.9, 108.5), (154.4, 100.7), (153.144, 97.255), (151.775, 94.269), (150.294, 91.742), (148.7, 89.675), (146.994, 88.067), (145.175, 86.919), (143.244, 86.23), (141.2, 86), (138.377, 86.177), (137.324, 86.427), (136.462, 86.812), (135.756, 87.353), (135.167, 88.067), (134.2, 90.1), (133.882, 91.146), (133.745, 92.211), (133.775, 93.279), (133.956, 94.334), (134.72, 96.34), (135.925, 98.1), (137.458, 99.485), (139.206, 100.366), (140.126, 100.577), (141.058, 100.614), (141.987, 100.46), (142.9, 100.1), (143.823, 99.383), (144.492, 98.412), (144.906, 97.273), (145.062, 96.05), (144.962, 94.827), (144.602, 93.688), (143.981, 92.717), (143.1, 92), (142.296, 91.655), (141.62, 91.511), (141.087, 91.552), (140.712, 91.762), (140.511, 92.128), (140.498, 92.633), (140.69, 93.262), (141.1, 94), (141.828, 95.439), (141.947, 95.96), (141.9, 96.362), (141.684, 96.657), (141.297, 96.855), (140, 97), (139.092, 96.82), (138.212, 96.312), (137.427, 95.523), (136.8, 94.5), (136.319, 93.15), (136.25, 92.1), (136.631, 91.125), (137.5, 90), (138.389, 89.125), (139.214, 88.528), (140.022, 88.218), (140.862, 88.2), (141.782, 88.482), (142.83, 89.072), (145.5, 91.2), (147.219, 92.844), (148.731, 94.617), (150.084, 96.623), (151.325, 98.962), (152.5, 101.738), (153.656, 105.052), (156.1, 113.7), (157.931, 121.237), (158.825, 125.925), (158.944, 127.376), (158.856, 128.325), (158.572, 128.843), (158.1, 129), (157.59, 129.168), (157.191, 129.633), (156.908, 130.334), (156.75, 131.212), (156.834, 133.261), (157.091, 134.312), (157.5, 135.3), (158.061, 136.547), (158.237, 137.55), (158.02, 138.478), (157.4, 139.5), (156.844, 140.377), (156.4, 141.412), (156.106, 142.467), (156, 143.4), (155.913, 143.712), (155.662, 143.688), (154.725, 142.7), (153.3, 140.587), (151.5, 137.5), (146.523, 128.712), (141.524, 120.379), (136.49, 112.487), (131.409, 105.025), (126.272, 97.98), (121.065, 91.34), (115.778, 85.092), (110.4, 79.225), (104.918, 73.726), (99.322, 68.582), (93.6, 63.782), (87.741, 59.312), (81.732, 55.162), (75.564, 51.318), (69.223, 47.768), (62.7, 44.5), (55.845, 41.434), (48.919, 38.722), (42.134, 36.418), (35.7, 34.575), (29.829, 33.248), (24.
2017-01-05 03:01:55 +00:00
if __name__ == '__main__':
main()