I don’t know if this really amounts to much in the end, but it was pointed out on another thread that the sprocket’s pitch diameter, defined by the source of the formula as the diameter [of] the circle followed by the centers of the chain pins as the sprocket revolves in mesh with the chain, is

pitch diameter = pitch / sin (180/number of teeth)

The current firmware calculates how much chain wraps around the sprocket by multiplying the radius of the sprocket by the angle of chain wrap. The radius is generally calculated as:

radius = pitch * number of teeth * chain compensation factor / (2*PI)

My theory is that to calculate how much chain wraps around the sprocket, you should be using the pitch diameter AND not using a chain compensation factor. I can’t prove why pitch diameter should be used over the other, but this is the formula that apparently is used by people who make sprockets and it maybe have something to do with how the chain sits on the sprocket(?). As for chain compensation factors, the chain is meshed with the sprocket and not stretched due to wear so I don’t think a compensation factor should apply.

Since I don’t fully understand how all of the triangular kinematics is calculated, I am just proposing this for discussion. Also, I don’t think this is a big of a deal… based upon a chain angle of 0.785 (just an example value), the chain wraps are:

Current method, chain compensation = 0.32%: 7.963 mm

Current method, chain compensation = 0%: 7.938 mm (-0.025 mm difference)

Pitch Diameter method, chain compensation = 0%: 8.070 mm (0.107 mm difference)

So, does a 0.107 mm difference in chain length amount to much… I think there are bigger sources of errors (if this is actually an error) to find. I don’t think I can do that test in simulator, but I can’t really imagine the effect is significant… nevertheless, doing something correctly in order to do it correctly does make sense, even if the error is negligible by doing it wrong.

So, I think I finally figured it out how triangular kinematics works thanks to an old message from @rjon17469. I don’t think he every put a drawing together so I did this based upon my understanding:

a+b make the angle to calculate how much chain wraps around the sprocket (Chain1AroundSprokcet)… basically the wrap = r * (a+b) when a+b are expressed in radians. This seems to make sense to me.

Then, the length of the chain from where the chain comes off the sprocket to the target is calculated (Chain1Straight) is simply based upon Pythagorean’s theorem and is sqrt(Motor1Distance^2 - r^2)

Chain1Straight is then adjusted for chain sag (that part I have not figured out and don’t know if I ever will).

The two chain lengths are then added together and the rotational radius of the ring/linkage kit is subtracted from it… Chain1 = Chain1AroundSprocket + Chain1Straight - rotationDiskRadius

So… still, I think the radius that is used shouldn’t include a factor for chain wear (since it’s meshed to the sprocket). Whether or not one should use the pitch diameter formula to calculate how much chain is on the sprocket, I don’t know.

Yes, the amount of chain wrap should not have compensation added.

That being said, we are talking about 0.1mm or so of error when we are looking for an accuracy of ~0.5mm, and achieving a real-world accuracy of a little worse than 1mm. So this isn’t a smoking gun, but if you can fix something in the math…

by the way, I seem to remember that the math actually did some shortcut trickery of extending the chain line straight to account for the wrap with some tricky radians based math. It made y head hurt to try and figure it out.

Yeah, that was my sentiment as well. I’m still looking for smoking guns, but might as well fix even the littlest of things. Also, if @jwolter’s post in this thread is correct and means we should be using pitch/sin(180/teeth) as the diameter, might as well adjust that as well.