Synchronizing axes in Homemade Plotter

  • Thread starter Daniel Marin Valencia
  • Start date
D

Thread Starter

Daniel Marin Valencia

Hello...

I'm developing a homemade Plotter with small permanent magnet DC motors and incremental encoders; using independent proportional velocity control loop for each axis. [Out(k) = Out(k-1) + Kp*Err(k)].

I have problems with synchronizing the axes; i want to know the method or algorithm to adjust the velocity relationship among axes
in a precise way.

Thanks...
Daniel
[email protected]
 
T
Daniel,

Go to http://www.control.com and look under the BULL! luminary. You will find a paper entitled "Command Generation". Below is a version of it without the illustrations. BTW, we conduct a 2 day servo seminar that this discussion comes from. If you want to know more about the seminar, let me know.

Tom

Thomas B. Bullock,
President Industrial Controls Consulting Div.
Bull's Eye Marketing, Inc.
104 S. Main St., Suite 320
Fond du Lac, WI 54935
Ph: 920: 929-6544
Fax: 920: 929-9344
E-mail: [email protected]


BULL! Command Generation By Tom Bullock

About half of the time, when engineers think they have servo problems, they turn out to be command generation problems. Servos will do exactly what they are told to do. That is why it is important to have some understanding of how commands are generated. A position servo has a command register and a position feedback register. The difference between these two is the position error signal. This signal is the input to the drive and motor. If the command and feedback registers are not serviced properly, it can affect the performance of the servo system.

As mentioned in my previous article, there is a command generation update time, Dt, which is typically 1 millisecond. The computer must calculate exactly how far each axis must move in that time. As an example, consider a two axis (x and y) linearly interpolated move. In such a move, one would normally program the distance each axis is to move and the resultant feed rate (FR).

The controller takes the distance each axis is to move (X,Y) and computes the length of the move (D) as shown in Fig. 1. This is done during the processing of the input data. This processed data is used in performing the linear interpolation. The linear interpolation is achieved by computing the distance each axis is to move (Dx,Dy) in one time period (Dt). A typical linear interpolation algorithm for one axis might take the following form:

FR x X/D x Dt = Dx + xc <THORN> xc

The feedrate multiplied by the ratio of X/D gives the required velocity in the x direction. Multiplying the x direction velocity by the upgrade time (Dt) yields the distance the x axis must move (Dx) in one time period (Dt). This x axis movement (Dx) is added to the value in the x axis command register (xc) and this new sum replaces the existing value for xc to yield the desired updated x axis command.

Similarly and simultaneously, a calculation will be made for the y axis using Y/D and yielding a Dy which is used to update the y axis command register.

This approach allows the operator to override the feedrate (FR) thereby slowing down or speeding up the operation without affecting the coordination or accuracy of the interpolated move.

An added advantage in interpolating in this way is the ease with which circular interpolation can be done as is illustrated in Fig. 2. Note that D is the radius of the circle rather than the length of the linear move and X is the x axis vector from the center of the circle to the starting point of the circle and Y is the y axis vector. The velocity in the x direction is FR x Y/D and in the y direction is FR x X/D. The algorithms for computing the incremental moves is identical to linear except that the result for the x axis is fed to the y axis and vice versa. Also, as the circle is traversed, the value of the X and Y vectors change thereby continually changing the X/D and Y/D ratios, which didn’t happen during linear interpolation. The algorithms for circular interpolation are:

FR x X/D x Dt = Dy + yc <THORN> yc FR x Y/D x Dt = Dx + xc <THORN> xc

Note that in a linear move, FR x X/D and FR x Y/D could each be calculated only once during the data entry processing since they do not change during the move. In a circular move, this is no longer the case as the vectors X and Y continually change. This means that the FR x X/D and FR x Y/D calculations must now be done during each Dt.

Also note that Dx and Dy will be very small numbers when the velocity for each axis is low. It may take many time periods before a least count is generated. This necessitates that both Dx and Dy also carry a remainder register to keep track of parts of a count until it carries over to a full count.

There are other types of interpolation available ( for instance parabolic) and other similar algorithms being used. This article was not intended to imply that this is the best way or the recommended way to do the interpolation calculations. Its intent was to take the mystery out of interpolation and show it to be a relatively straight forward process.

Tom can be reached at Industrial Controls Consulting, a division of Bull’s Eye Marketing, Inc. See them at www.bullseyenet.com, or phone (920) 929-6544 or email: [email protected].
 
C
Daniel:

Simply put, if you want to coordinate the positions of the axes, you have to control position, and not just velocity. You will have a commanded position value for each axis each cycle to set your desired path, and you must try to drive the position error of each axis to zero. If you take care of position properly, the velocity will pretty much take care of itself. (Derivative gain in a position loop is equivalent to velocity loop gain.)

Tom's advice to focus first on the command generation is completely valid. Once you are able to mathematically generate your desired path correctly, then focus on closing the position loop.

Curt Wilson
Delta Tau Data Systems
 
D

Daniel Marin Valencia

Thanks for your interest in my problem.

These are the specifications of the system:
MCU Board command X axes, Y axes and Pen.
Controller unit AT89C51RB2 @ 40Mhz [0.3E-6 Cicle].
Data memory 256Kbyte DataFlash.

Speed and position data are downloaded by Rs232 [19200BAUD] to MCU DataFlash.
Speed data are in system velocity resolution [0 o 32767].
Position data are in mm [-2147483648 to 2147483647].
The graphical unit [PC], converts the drawing to lines with Speed and Position data.

Permanent magnet DC Motors 24Vdc, 5 Amp with reduction gear.
[The END max. speed of the system are very slow 85rpm aprox.].
[And the axes speed are very very slow ??? mm/s].

Incremental encoders 2000 puls/rev; 3000Hz @ Max. motor speed.

Motor speed control by PWM 100HZ, 15bits resolution.

Speed system control: Proportional velocity closed loop control for each axes.
Out(k) = Out(k-1) + Kp*Err(k). [Kp are the same for each axes].
Sample time 10Hz.
[The open loop Max. speed for each axes are equal]

Position system control: Numeric long (32 bits) with sign.
Accel. and Decel. time are equal.
Slewing=Position - (2Acc). [Result in encoders pulses]
If Slewing<0 then Slewing=Position / 2
Sample time 10HZ.

Problem:
if the input graph. are rectangle the plotter draws a rectangle [No problem].
if the input graph. are triangle the plotter draws something. One axes reach the position prior to the other [NO AXES SINCHRONIZATION].

Thanks for your cooperation.

Daniel Marin Valencia.
[email protected]
 
" Motor speed control by PWM 100HZ, 15bits resolution and Sample time 10HZ."

You must increase the PWM and sample frequency.


 
Top