# Stop Gearing at a position

I am having a little trouble with gearing. I have an axis geared to another and when it passes a position I tell it to stop gearing. I can’t just stop I need to decel a little then stop. I can do both of these by using the stop command and the hold command. I like using the stop command because I can give it a decel rate. The problem is this decel gives me some drift past the position I want to stop at. For example I give it the stop command at 3.000 with the decel it may stop at 3.055

If the master was going a constant speed I might be able to calculate the speed of the slave and subtract that from the 3.000 position and stop on 3.000 however the master is not going a constant speed. I think what I need is like the clutch by dist gearing but only for stopping or a stop command that has a distance. Is there another way to do this?

I figured out how to do this with an Advanced Gear Move command.

I assumed the master and slave are geared 1:1 and both moving in the positive direction. In a user program, I waited for the slave to pass 2, then I issued the Advanced Gear command to the slave with the following parameters:

Slave Sync Pos: 3
Ratio: 0
Ratio Rate: 0
Master Reg: The current master target position
Master Sync Pos: The current master target position + 1.6667
Master Dir: Nearest
Slave Dir: Nearest

The key here is that the Master Distance must be 1.66667 times the Slave distance, or larger (2 times works very well also). Since I want the slave to stop at 3, and I had waited until it passed 2 before I issued the command, the Slave Distance is approximately 1. Therefore, the Master Distance must be at least 1.6667 or larger. If this condition is not met, the slave will actually speed up before stopping. This is related to the discussion in the Gear Position (Clutch by Position) help topic. Notice that if the gear ratio is not 1:1, then the Master Distance should be (Slave Distance x 1.6667/Current Gear Ratio).

I attached a user program that does this using variables so the calculations are clear.
GearStopAtPosition.rmcprog (2.47 KB)

I had some idea’s last night that relate back to one of Peter’s Friday math questions. After I start the gearing I look for it to get to a position. I know the act velocity and i know how quick I want to stop. So I can calculate the decel distance at that velocity and subtract that distance from the stop position. I almost have it working. I will take a look at your solution and see whick one works best.

I didn’t look at the program that Jacob posted a link to but the picture in the post above should have the AdvancedGearMove wait until the done bit is set. Then you know the gear ratio is zero. The next step should be a hold position to really end gearing and be back in position control.