You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reviewing the code, it seems that in one spot in triangularInverse we take into account chain tolerance (chain wrap around sprocket calculations) but in another spot (straight chain length) we do not.
Since "axis" takes into account the mmPerRotation (adjusted by chain tolerance), I think the straight chain length should be the ideal value that's currently computed. However, the chain around sprocket, I think should be "inversely" compensated.. meaning we need to take out chain tolerance from it so that when "axis" does it's calculations it cancels out the chain tolerance since that portion of chain should be meshed. Also, the calculations that involve the radius of the sprocket should be based upon the actual sprocket radius and not chain tolerance.
I've used distPerRot that is currently calculated by GroundControl as gear pitch * number of teeth but this could be changed to gear pitch / sin(180/number of teeth)*3.141592 in GroundControl if its a more accurate circumference to use. The three new variables (sprocketRadius, leftChainDecompensation, rightchainDecompensation) should be precomputed and stored since they shouldn't change.
//Set up variables
float Chain1Angle = 0;
float Chain2Angle = 0;
float Chain1AroundSprocket = 0;
float Chain2AroundSprocket = 0;
//These should be calculated elsewhere and stored since they don't change
float sprocketRadius = distPerRot / (2*3.141592);
float leftChainDecompensation = sprocketRadius / RleftChainTolerance;
float rightChainDecompensation = sprocketRadius / RrightChainTolerance;
//Calculate motor axes length to the bit
float Motor1Distance = sqrt(pow((-1*_xCordOfMotor - xTarget),2)+pow((_yCordOfMotor - yTarget),2));
float Motor2Distance = sqrt(pow((_xCordOfMotor - xTarget),2)+pow((_yCordOfMotor - yTarget),2));
//Calculate the chain angles from horizontal, based on if the chain connects to the sled from the top or bottom of the sprocket
if(sysSettings.chainOverSprocket == 1){
Chain1Angle = asin((_yCordOfMotor - yTarget)/Motor1Distance) + asin(sprocketRadius/Motor1Distance);
Chain2Angle = asin((_yCordOfMotor - yTarget)/Motor2Distance) + asin(sprocketRadius/Motor2Distance);
Chain1AroundSprocket = sprocketRadius * Chain1Angle * leftChainDecompensation;
Chain2AroundSprocket = sprocketRadius * Chain2Angle * rightChainDecompensation;
}
else{
Chain1Angle = asin((_yCordOfMotor - yTarget)/Motor1Distance) - asin(sprocketRadius/Motor1Distance);
Chain2Angle = asin((_yCordOfMotor - yTarget)/Motor2Distance) - asin(sprocketRadius/Motor2Distance);
Chain1AroundSprocket = sprocketRadius * (3.14159 - Chain1Angle) * leftChainDecompensation;
Chain2AroundSprocket = sprocketRadius * (3.14159 - Chain2Angle) * rightChainDecompensation;
}
//Calculate the straight chain length from the sprocket to the bit
float Chain1Straight = sqrt(pow(Motor1Distance,2)-pow(sprocketRadius,2));
float Chain2Straight = sqrt(pow(Motor2Distance,2)-pow(sprocketRadius,2));
I can't readily test this. I might be able to this weekend. I think if we changed the formula for distPerRot than recalibration would technically be required for everyone (regardless of using chain compensation) but since it's only used here with chain wrap, I don't think it will be significant. For example, if amount of wrap is 135 degrees (assumes bottom feed configuration and sled low on the frame) then the difference would be 0.4 mm of chain length
The text was updated successfully, but these errors were encountered:
Well, I'm putting my toe into the water and I went ahead and modified the firmware and groundcontrol to do all the above. I'll give it a shot this weekend (assuming it compiles and doesn't use up too much memory in eeprom)
Reviewing the code, it seems that in one spot in triangularInverse we take into account chain tolerance (chain wrap around sprocket calculations) but in another spot (straight chain length) we do not.
Since "axis" takes into account the mmPerRotation (adjusted by chain tolerance), I think the straight chain length should be the ideal value that's currently computed. However, the chain around sprocket, I think should be "inversely" compensated.. meaning we need to take out chain tolerance from it so that when "axis" does it's calculations it cancels out the chain tolerance since that portion of chain should be meshed. Also, the calculations that involve the radius of the sprocket should be based upon the actual sprocket radius and not chain tolerance.
I've used distPerRot that is currently calculated by GroundControl as gear pitch * number of teeth but this could be changed to gear pitch / sin(180/number of teeth)*3.141592 in GroundControl if its a more accurate circumference to use. The three new variables (sprocketRadius, leftChainDecompensation, rightchainDecompensation) should be precomputed and stored since they shouldn't change.
I can't readily test this. I might be able to this weekend. I think if we changed the formula for distPerRot than recalibration would technically be required for everyone (regardless of using chain compensation) but since it's only used here with chain wrap, I don't think it will be significant. For example, if amount of wrap is 135 degrees (assumes bottom feed configuration and sled low on the frame) then the difference would be 0.4 mm of chain length
The text was updated successfully, but these errors were encountered: