OMRON Forums

# User- Written Servo for computed torque control

## Recommended Posts

Now I want to use PPMAC for computed torque control of PKM(Parallel Kinematic Machine). So the inverse dynamic model must be written into the PPMAC through the User-Written Servo algorithm.

The problem as following:

1. the command outputs of every motors are coupled. For example, to compute the output of Motor 1, the velocity of other motors are all necessary in the formula. It's not clear whether other motor's actual velocity can be used when computing the command output of Moter 1 in PPMAC, maybe it cannot in Turbo PMAC.

2.the command output of every motor can't be written in one formula. Can I write some formulas for every motor. For example:

//motor 1 command output

cmd1=... ,

//motor 2 command output

cmd2=... ,

...

But return what?

I'll look forward to your help.

Thank you!

• Replies 3
• Created

#### Popular Days

You can do a coupled multi-motor custom servo algorithm if you follow a few rules.

1. The motors must be consecutively numbered.

2. Your algorithm runs on the lowest-numbered of these motors.

3. For this motor, you set Motor[x].ExtraMotors to the additional number of motors whose loops you are closing in this algorithm.

4. You "return" the value of this motor's servo command.

5. For the additional motors, you write the servo command directly to that motor's Mptr->ServoOut (double) element.

Let's say you want to couple the servos of 5 motors running on Motors 3 - 7.

Your custom algorithm will run on Motor 3.

You will set Motor[3].ExtraMotors to 4 so Motors 4 - 7 do not try to run their own algorithms.

You can define:

Mptr2 = Mptr + 1 for Motor 4 (the 2nd motor)

Mptr3 = Mptr + 2 for Motor 5 (the 3rd motor)

Mptr4 = Mptr + 3 for Motor 6 (the 4th motor)

Mptr5 = Mptr + 4 for Motor 7 (the 5th motor)

The command for Motor 3 will be the return value.

You will write the value for Motor 4 to Mptr2->ServoOut

You will write the value for Motor 5 to Mptr3->ServoOut

You will write the value for Motor 6 to Mptr4->ServoOut

You will write the value for Motor 7 to Mptr5->ServoOut

##### Share on other sites

Thank you, curtwilson.

Maybe I didn't express clearly. For example, to compute the Motor 1 command output, the following error(FE) and the actual velocity(AVEL) of Motor 2 is necessary. Also, the Motor 1 FE and AVEL is necessary to Motor 2. That is the meaning of couple.

How can I write the servo routine?

You can do a coupled multi-motor custom servo algorithm if you follow a few rules.

1. The motors must be consecutively numbered.

2. Your algorithm runs on the lowest-numbered of these motors.

3. For this motor, you set Motor[x].ExtraMotors to the additional number of motors whose loops you are closing in this algorithm.

4. You "return" the value of this motor's servo command.

5. For the additional motors, you write the servo command directly to that motor's Mptr->ServoOut (double) element.

Let's say you want to couple the servos of 5 motors running on Motors 3 - 7.

Your custom algorithm will run on Motor 3.

You will set Motor[3].ExtraMotors to 4 so Motors 4 - 7 do not try to run their own algorithms.

You can define:

Mptr2 = Mptr + 1 for Motor 4 (the 2nd motor)

Mptr3 = Mptr + 2 for Motor 5 (the 3rd motor)

Mptr4 = Mptr + 3 for Motor 6 (the 4th motor)

Mptr5 = Mptr + 4 for Motor 7 (the 5th motor)

The command for Motor 3 will be the return value.

You will write the value for Motor 4 to Mptr2->ServoOut

You will write the value for Motor 5 to Mptr3->ServoOut

You will write the value for Motor 6 to Mptr4->ServoOut

You will write the value for Motor 7 to Mptr5->ServoOut

##### Share on other sites

Just as you would use Mptr->PosError and Mptr->ActVel for the first motor's following error and actual velocity, you would use Mptr2->PosError and Mptr2->ActVel for the second motor, Mptr3->PosError and Mptr3->ActVel for the third motor, and so on.

Each servo cycle, Power PMAC computes these terms for all motors before it executes the servo loop for any motor.

##### Share on other sites

This topic is now closed to further replies.

### Announcements

×
• Forums

• Events

• #### Store

×
• Create New...