diff --git a/examples/plotter/__init__.py b/examples/plotter/__init__.py index b7720f9..4bb072b 100644 --- a/examples/plotter/__init__.py +++ b/examples/plotter/__init__.py @@ -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) diff --git a/examples/plotter/try.py b/examples/plotter/try.py index 6528453..406453b 100644 --- a/examples/plotter/try.py +++ b/examples/plotter/try.py @@ -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()