mirror of
https://github.com/undera/pylgbst.git
synced 2020-11-18 19:37:26 -08:00
Cosmetics
This commit is contained in:
parent
2c7b9b126c
commit
a16392fa5f
@ -116,13 +116,13 @@ class Plotter(MoveHub):
|
||||
|
||||
def circle(self, radius):
|
||||
if not self.is_tool_down:
|
||||
self._tool_down()
|
||||
self._tool_down()
|
||||
|
||||
parts = int(2 * math.pi * radius * 5)
|
||||
dur = 0.225
|
||||
logging.info("Circle of radius %s, %s parts with %s time", radius, parts, dur)
|
||||
for x in range(0, parts):
|
||||
speed_a = math.sin(x * 2 * math.pi / parts)
|
||||
speed_b = math.cos(x * 2 * math.pi / parts)
|
||||
speed_a = math.sin(x * 2.0 * math.pi / float(parts))
|
||||
speed_b = math.cos(x * 2.0 * math.pi / float(parts))
|
||||
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)
|
||||
|
@ -42,6 +42,23 @@ def romb():
|
||||
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__':
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
@ -61,11 +78,7 @@ if __name__ == '__main__':
|
||||
# square()
|
||||
# cross()
|
||||
# romb()
|
||||
plotter.move(FIELD_WIDTH / 2.0, 0)
|
||||
plotter.circle(FIELD_WIDTH / 2.0)
|
||||
|
||||
plotter.move(FIELD_WIDTH / 2.0, 0)
|
||||
plotter.circle(FIELD_WIDTH)
|
||||
circles()
|
||||
pass
|
||||
finally:
|
||||
plotter.finalize()
|
||||
|
Loading…
x
Reference in New Issue
Block a user