Syncing Zire 71 in Kubuntu Hardy

I have a somewhat antique Palm Zire 71 that has, periodically, synced perfectly with various flavors of GNU/Linux. On the other hand, sometimes a new release / kernel / version prevents it from syncing at all.

My life is simple enough that I really don’t need to actively sync it with an online calendar, which is a damn good thing. Back when I needed to do hotsyncing, it always came heartbreakingly close to working; apparently that’s still the case. Having to comb out a complete set of duplicate addressbook entries pretty much soured me on futher experimentation.

Currently, the Zire on the outs with Ubuntu / Kubuntu Hardy. The hack that makes it work goes a little something like this:

The file /etc/modprobe.d/libpisock9 blacklists the visor module, which allegedly lets all the pilot-* programs connect using libusb, but that flat-out doesn’t work for me.

Replace this stanza inside /etc/udev/rules.d/60-symlinks.rules:

#KERNEL=="ttyUSB*", ATTRS{product}=="Palm Handheld*|Handspring *|palmOne Handheld", \
#                                       SYMLINK+="pilot"

With this one:
BUS=="usb", SYSFS{product}=="Palm Handheld*|Handspring *|palmOne Handheld", \
KERNEL=="ttyUSB*", NAME="ttyUSB%n", SYMLINK+="pilot", GROUP="dialout", MODE="0666"

Make sure you’re in the dialout group. If you’re not, add yourself, log out, then log back in again.

I back the Zire up once a month, which is rarely enough that I just load the visor module by hand:

sudo modprobe visor

Create a directory for backing up into:

cd ~/Zire71
mkdir 2009-01-03

And then backing up the Zire is easy enough. Pop the thing in the cradle, poke the hotsync button, and quick like a bunny whack Enter on this:

pilot-xfer -p /dev/ttyUSB1 -b 2009-21-03/

The ttyUSB1 device will, of course, vary depending on whether you have any other USB-serial gizmos plugged in at the time.

Frankly, the utter unreliability and instability of this whole USB PDA mess is one of the reasons why, IMHO, GNU/Linux really isn’t “ready for the desktop” despite the fact that all our boxen here run it. I don’t particularly want a phone / camera / PDA / ebook reader / pocketwarmer, but I can see I’ll wind up with one some day just to get a USB interface that actually works.

Memo to self: remember to modprobe visor

Update: Xubuntu 8.10 fixed all that, so USB hotplugging seems to work right out of the box. Install pilot-link, then just:

pilot-xfer -p usb: -b /path/to/backups

Now, whether syncing to contacts & calendars works correctly, I cannot say.

Fairing Arcs

In CNC machining, at least the kind I do on my Sherline CNC mill, you can’t mill around acute inside corners: a round milling bit doesn’t fit into a straight-sided angle. You must add a fairing arc that smoothly connects the two sides; the catch is that “smooth” means it’s tangent to the sides. And EMC2 is really, really fussy about smooth, to the point where you can’t just wing it with a calculator and type in the numbers.

Fairing arc doodles
Fairing arc doodles

There are nice analytic geometry methods for finding the intersection of two line segments, then laying in the arc that connects them, but this example weighs in at over two pages of G-Code. Mostly, what I need is an arc that connects a vertical or horizontal edge to an angled edge, so some simplification is in order.

Herewith, the quick-and-dirty…

The cutter enters from the left side, moving horizontally to the right, and will depart along the line toward P1, which might be the next corner of the part. The two material edges meet at P0, the vertex of the angle. The fairing arc is tangent to the two edges at PA and PB, centered at PC, and with a radius R.

We know the coordinates of P0 and P1 and the arc radius. That radius must be larger than the cutter radius, as you can’t tuck a fat cutter into a narrow corner.

The problem is to find PA, PB, and PC, so that we can write the G-code commands that travel along the sides & the arc.

The first step is finding Φ (Phi), the angle between the outgoing edge and the X axis:

Φ = arctan Δy/Δx = arctan (P1y – P0y) / (P1x – P0x)

I’m pretty sure if you use a 4-quadrant arctan, as shown in the doodle, all the angles will work out perfectly on either side of the axis, but it’s easy enough to fake the signs to get the right answer in any specific case. If you wanted a general solution, you’d have a two-page subroutine, right?

You’ll need the complement of that angle, hereinafter known as Theta:

Θ = 90 – Φ

Find the distances between various points using good old trig and right triangles:

  • CBx = R · sin Φ
  • CBy = R · cos Φ
  • P0PBy = R · (1 – cos Φ)
  • P0PBx = P0PBy · tan Θ

Then the coordinates fall out thusly:

Plastic Spring with Faired Corners
Plastic Spring with Faired Corners
  • PCy = P0y + R
  • PBy = PCy – CBy
  • PBx = P0x + P0PBx
  • PCx = PBx – CBx
  • PAx = PCx
  • PAy = P0y

Remember, you do not figure all this out with your calculator and plug the numbers into the G-code, not if you have any sense. If you have just a few corners, write the commands directly, otherwise gimmick up a little subroutine. Earlier versions of EMC2 used numbered parameters (#100), but now that you can have named parameters (#<_Fairing_Radius>), what’s holding you back?

For example:

#<_CBy>	= [#<_Fairing_Radius> * COS [#<_Phi>]]	(Y distance PC to PB)

If your edge doesn’t come in from the left, then manual 90 degree rotations apply.

0: (x,y) -> (x,y)
90: (x,y) -> (y,-x)
180: (x,y) -> (-x,-y)
270: (x,y) -> (-y,x)

If you’re using a CAD program to lay out your parts, all this is largely irrelevant. I hammer out the G-code for the simple 2-1/2-D parts I make by hand, so rounding off a few corners comes in handy.

Because the lines & arc define the material edge contour, you can mill on either side of it and use cutter radius compensation to make the answer come out right. Works like a champ!

For what it’s worth, the arc is tangent at PA and PB, making the line from PC to the corner (a.k.a. vertex) P0 the bisector of angle Φ. That’s not directly useful here, but keep it in mind when you solve similar problems.

Update: As of mid-January, the newest trunk version of EMC2 can automagically insert fillets when cutter comp is turned on. That’ll be in the stable version in a while, after which I’ll need this math only for decorative fillets. That’s fine with me!