Approximating Perfection with Math and the LogoTurtle


After a hiatus from the LogoTurtle I returned at the end of my summer to a fun programming challenge. I wanted to create a gift of LogoTurtle art for a friend. I chose a design that I worked with before on the LogoTurtle, "ArcBoxFlower," but which I had not yet perfected. The arc and line often did not end up intersecting at the end as closely as they might. The star in the center often did not emerge because the angles were somehow off. I honestly had not yet had time to muck with the math to see if I could get the LogoTurtle to draw a little more accurately. 

It turns out that this experiment resulted in a couple different breakthroughs in terms of accurate LogoTurtle drawings. Also, I became entrapped by the hard fun, like some of my students, of working with the math, hardware, and software to approximate perfection in my LogoTurtle design.



The first breakthrough was adding washers to the pen collar. The extra weight stabilizes the pen a little bit, producing straighter lines after the LogoTurtle turns or draws an arc and then goes forward or back.



After fussing with one of my LogoTurtle that has the most upgrades (bumper sensor, rechargeable battery) and still not getting the results I wanted I switched back to my original LogoTurtle, Seymour.



I loaded fresh batteries and ran the square procedure to confirm the LogoTurtle was calibrated.




I also ran the ArcBoxFlower procedure on my computer in TurtleArt. I played with the numbers a bit to understand what was happening, and realized that it was the final right 45 that seemed to affect the LogoTurtle's joining of the arc and the line in the ArcBoxFlower procedure. Here is the procedure run twice, once with 43 degrees and once with 48 degrees.




Understanding what number to work with, I also modified my LogoTurtle procedure a little. I wanted to have to change as few numbers as possible but still have the LogoTurtle be able to "muck" with that 45 degrees a little.

to arcboxflower :angle :size
repeat 4 [
repeat 2 [
arcrt :angle :size
rt :angle
fd :size * 2
rt (:angle / 2) + 3]
]


It took some iterations of playing with the angle setting after deciding on a size of 150. 




On this LogoTurtle an angle of 91 degrees approximated perfection for this design for me. The symmetry of the design, the crispness of the lines, and the way the final line meets perfectly with the first arc is beautiful to me. Even though I ran the procedure on scrap paper with purple curves already drawn on it, the design approximated perfection to me.



I also made a modification to the pen collar. I wanted to reduce how much it spun in the pen holder as it was dragged across the paper. I added a tube that helps keep it from spinning, accounts for the servo, and accommodates washers, too. The lower tube below the collar fits over the pen holder when the servo lowers the pen in an attempt to reduce the wobble. It still needs a little work but produced great results.




Finally, making sure the LogoTurtle had as close to a 112 millimeter wheel base as possible made the drawing turn out beautiful and approximately perfect, too. 



All the software calculations performed by the LogoTurtle software running on the Arduino or Metro Mini assume the wheel base is 112 mm. You are either working with that hard fact by having your LogoTurtle hardware calibrated to that width or you are fighting the LogoTurtle's inaccurate calibration in the software, mucking with the math and iterating. I suggest checking the hardware first (wheel base, pen wobble), then muck with the math in your LogoTurtle procedure.

Having the time to devote to a challenging hardware, software, and programming problem does not always come easy, but when it arrives it is always hard fun.

Comments