Skip to content

Commit

Permalink
Change operation associated with ChainTolerance
Browse files Browse the repository at this point in the history
This was discovered by @c0depr1sm and @joshua in this thread: https://forums.maslowcnc.com/t/holey-triangular-calibration/6240/191.
The original implementation of ChainTolerance modified the sprocket's mmPerRotation (increasing it for a positive ChainTolerance value).  The affect was to reduce the amount of  chain fed out.  This was adjusted in a previous PR where the ChainTolerance only modified the ChainStraight length in triangularInverse (because there shouldn't be any chain stretch associated with the wrap around the sprocket).  However, the formula used actually increases the amount of chain that is fed out (1+ChainTolerance) instead of decreasing it.  So, this PR changes the operator such that the ChainTolerance is divided into the ChainStraight rather than multiplies it resulting in a smaller chain length amount being fed out.
  • Loading branch information
madgrizzle authored Jan 21, 2019
1 parent 4941486 commit 3c9402c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cnc_ctrl_v1/Kinematics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ void Kinematics::triangularInverse(float xTarget,float yTarget, float* aChainLe
Chain2Straight *= (1 + ((sysSettings.chainSagCorrection / 1000000000000) * pow(cos(Chain2Angle),2) * pow(Chain2Straight,2) * pow((tan(Chain1Angle) * cos(Chain2Angle)) + sin(Chain2Angle),2)));

//Calculate total chain lengths accounting for sprocket geometry and chain sag
float Chain1 = Chain1AroundSprocket + Chain1Straight * (1.0f + sysSettings.leftChainTolerance / 100.0f);
float Chain2 = Chain2AroundSprocket + Chain2Straight * (1.0f + sysSettings.rightChainTolerance / 100.0f);
float Chain1 = Chain1AroundSprocket + Chain1Straight / (1.0f + sysSettings.leftChainTolerance / 100.0f);
float Chain2 = Chain2AroundSprocket + Chain2Straight / (1.0f + sysSettings.rightChainTolerance / 100.0f);

//Subtract of the virtual length which is added to the chain by the rotation mechanism
Chain1 = Chain1 - sysSettings.rotationDiskRadius;
Expand Down

0 comments on commit 3c9402c

Please sign in to comment.