MattReid Posted February 12, 2014 Posted February 12, 2014 Hi, I have a phantom axis that will generate a sinusoidal oscillating pattern. I want my real x, y axis to travel along a motion path but then be overridden by the phantom axis to weave along that motion path. The motion path will be the center line of the oscillation. What is the easiest way to calculate the perpendicular vector to my direction of travel? Is there anything built in for this or do I basically have to 1. Use the target position (Mx63) and my current position (Mx62) and calculate the perpendicular vector for both X and Y and use this to figure out my override component for each axis? Matt
curtwilson Posted February 13, 2014 Posted February 13, 2014 We don't compute a tangent or perpendicular vector velocity automatically - it adds computation time, and an automatic routine never does exactly what any individual application needs. However, there are a couple of "Tangent Following" application notes for Turbo PMAC on the website (under Resources/Technical Notes/Trajectories) that show the calculations. I generally find that using the instantaneous commanded velocity registers (D:$86, D:$106), as in the app notes, to be slightly better than (target - present). Regardless, you should always use commanded trajectory values, not actual, so you are not responding to whatever disturbance and noise is occurring at the instant. The app notes are doing the calculations in a motion program in a separate coordinate system to command a rotary axis to the angle of the path. For your case, you should either do a PLC 0 or an Open Servo for a virtual motor for these calculations. I would be updating my mathematical "sine wave" instantaneous value given parameterized magnitude and frequency. Once the angle perpendicular to the path has been computed, the component of your value for each axis can be computed with sine and cosine. (Technically, you don't need to compute the angle with ATAN2 and then resolve back into components with SIN and COS, but unless you need to shave microseconds off your calculations, I would advise doing this for ease of understanding and debugging.) You can use your calculated offsets by writing them either into the "master" position registers for the X and Y motors (D:$8D, D:$10D, Mxx67) or the "compensation" position registers (D:$90, D:$110, Mxx69).
Recommended Posts