1
0
mirror of https://github.com/undera/pylgbst.git synced 2020-11-18 19:37:26 -08:00

Cosmetics

This commit is contained in:
Andrey Pohilko 2017-12-19 22:20:00 +03:00
parent 2c7b9b126c
commit a16392fa5f
2 changed files with 21 additions and 8 deletions

View File

@ -122,7 +122,7 @@ class Plotter(MoveHub):
dur = 0.225 dur = 0.225
logging.info("Circle of radius %s, %s parts with %s time", radius, parts, dur) logging.info("Circle of radius %s, %s parts with %s time", radius, parts, dur)
for x in range(0, parts): for x in range(0, parts):
speed_a = math.sin(x * 2 * math.pi / parts) speed_a = math.sin(x * 2.0 * math.pi / float(parts))
speed_b = math.cos(x * 2 * math.pi / parts) speed_b = math.cos(x * 2.0 * math.pi / float(parts))
logging.debug("A: %s, B: %s", speed_a, speed_b) logging.debug("A: %s, B: %s", speed_a, speed_b)
self.motor_AB.timed(dur, speed_a * BASE_SPEED, -speed_b * BASE_SPEED * MOTOR_RATIO) self.motor_AB.timed(dur, speed_a * BASE_SPEED, -speed_b * BASE_SPEED * MOTOR_RATIO)

View File

@ -42,6 +42,23 @@ def romb():
plotter.line(-FIELD_WIDTH, FIELD_WIDTH * 2) plotter.line(-FIELD_WIDTH, FIELD_WIDTH * 2)
def circles():
plotter.move(FIELD_WIDTH / 5.0, 0)
plotter.circle(FIELD_WIDTH / 5.0)
plotter.move(FIELD_WIDTH / 5.0, 0)
plotter.circle(FIELD_WIDTH / 4.0)
plotter.move(FIELD_WIDTH / 5.0, 0)
plotter.circle(FIELD_WIDTH / 3.0)
plotter.move(FIELD_WIDTH / 5.0, 0)
plotter.circle(FIELD_WIDTH / 2.0)
plotter.move(FIELD_WIDTH / 5.0, 0)
plotter.circle(FIELD_WIDTH / 1.0)
if __name__ == '__main__': if __name__ == '__main__':
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
@ -61,11 +78,7 @@ if __name__ == '__main__':
# square() # square()
# cross() # cross()
# romb() # romb()
plotter.move(FIELD_WIDTH / 2.0, 0) circles()
plotter.circle(FIELD_WIDTH / 2.0)
plotter.move(FIELD_WIDTH / 2.0, 0)
plotter.circle(FIELD_WIDTH)
pass pass
finally: finally:
plotter.finalize() plotter.finalize()