gshort Posted September 15, 2011 Posted September 15, 2011 Is there a restriction that the scale factor for the encoder of a gantry command motor must be the same as its follower ? I'm experimenting with virtual motors and I can't seem to get them to work correctly if I have different scale factors between the two motors ?
curtwilson Posted September 15, 2011 Posted September 15, 2011 In a gantry leader/follower pair, the follower motor simply uses the leader motor's trajectory, so this trajectory is assumed to be in the motor units of the follower motor as well. For any practical system, this means that the follower motor's position units must have the same resolution as the leader motor's. If the two motors have different encoder resolutions, the Motor[x].PosSf saved setup element that scales the encoder position into motor position for the two motors must be different so they end up with the same motor units.
gshort Posted September 16, 2011 Author Posted September 16, 2011 I did experiment with PosSf. If I change it on a standard motor with ServoCtrl set to 1, I can see that this scales the Pos value based on the encoder position. However if I change the same motor to be a Gantry follower with ServoCtrl set to 8, it looks to me that changes to PosSf are ignored. Would you be able to check this your end ? Thanks Graham.
curtwilson Posted September 16, 2011 Posted September 16, 2011 Here's the experiment I just ran with two identical motors on my demo box. First I set Motor 2 to follow Motor 1, both with PosSf of 1.0. I got the 1-to-1 following I desired. Next, I changed the encoder decode on the Motor 2 encoder from "times 4" to "times 2", so a count on Motor 2 is twice as big as on Motor 1. Leaving PosSf at 1.0 for the motor, it now "follows" Motor 1 at a 2-to-1 ratio -- its physical distance traveled is twice as far as Motor 1 goes. Then, I changed PosSf for Motor 2 to 2.0 (Pos2Sf as well so inner loop and outer loop scaling is the same, but that is not really necessary). Motor 2 now follows Motor 1 at a 1-to-1 physical ratio again. Remember that these scale factor terms act as gains in the servo loop, so you would need to retune. I kept the gains low for my experimentation. (I am assuming here that your goal is to take two motors with different feedback resolutions and tie them together with a 1-to-1 physical relationship.)
gshort Posted September 19, 2011 Author Posted September 19, 2011 Hmm. I tried a very similar experiment but without your success. I was initially trying this with virtual motor as the follower, so there was no encoder. I then ganged up two physical motors but that had two identical encoder ratios, but I thought by changing PosSf I would get a different reported physical position. However that didn't seem to happen for me. I guess I must have made an error somewhere. If this is indeed how it is supposed to work, I'll wait until the physical machine is built and perform this experiment then. This was really a test to accelerate development prior to having the physical machine. Thanks again for your help in trying this.
curtwilson Posted September 19, 2011 Posted September 19, 2011 The intent of the gantry leader/follower algorithm is to provide identical commanded trajectories to both leader and follower motors without having to recompute for each motor. By identical, I mean that it will provide the same numerical position command value to both/all motors every servo cycle. So it will servo the follower motor to the same numerical position value as for the leader motor (no matter what that number means physically). I assumed that you wanted the same physical position value but had different measurement resolution. It appears from your latest comment that you want the follower motor to move a different physical distance from that of the leader motor. To do this, you would have to define motor units on the follower motor (by setting the value of its PosSf element) that are different from that of the leader motor, because the numerical command values for both motors (in their respective motor units) will be the same.
gshort Posted September 20, 2011 Author Posted September 20, 2011 No, Curt. You were correct in your original presumption. It was just my bad wording. The physical move is intended to be identical but the motors have different encoder scaling. I was just trying to test it on the one set up I had which had physical motors. Unfortunately in this test rig, these two motors have identical encoders on them, so I thought if I changed PosSf I should get a different physical movement, just to prove to myself that PosSf was having an effect. In my experiment it changing PosSf appeared to make no change, but from your explanation it should have. So I'm thinking I messed up somewhere.
Sina.Sattari Posted September 21, 2011 Posted September 21, 2011 gshort, Just a suggestion on making the scaling different on identical encoders on your system so you can test the condition you're interested in: If you have a quadrature encoder, change the encoder decode from x4, which is default, to x2 or x1 on one of the scales. Regards,
gshort Posted September 22, 2011 Author Posted September 22, 2011 This worked a treat. I could then see that PosSf was correctly scaling the follower. It also revealed that in my MMI where I display the motor position in engineering units, I need to take PosSf into the scaling equation. Thanks for this.
Recommended Posts