Position setpoint with CSV
3 minute read
Motorcortex closes the position loop and sends the drive a target velocity every cycle. The drive runs the velocity and torque loops.
Paths are under root/AxesControl/actuatorControlLoops/actuatorControlLoopNN/, where NN is the axis number.
Set the drive mode
Warning
Change the drive mode only while the axes are disabled.
In Desk, write 9 9 9 9 9 9 to root/DriveLogic/driveMode, one value per axis, and save with Save parameter tree to server. See Drive logic for details.
Check the drive’s PDOs and links
The standard configuration has these already. Otherwise, map the entries in the drive (CiA402 drives) and link them with channel 0 (EtherCAT configuration). Paths starting with …/ are under the axis’s control loop:
The torque offset is optional: it carries feedforward torque from the application to the drive.
See the links in the ECAT tool
Each entry shows its production link to the control loop and, below it, its simulation link to the Simulator. The blue marks the simulation link.
Set the transformations
The transformations turn drive units into rad, rad/s and Nm at the load. This is what happens to a position reading:
| Set | Parameter | Example |
|---|---|---|
| Gearbox | gearboxLoadSide, gearboxMotorSide |
100, 1 for 100:1 |
| Encoder | positionTransformation/transducer/ticksPerRevolution |
1048576 for 20 bits |
| Zero position | positionTransformation/transducer/offset, in ticks |
set by homing |
| Velocity units | velocityTransformation/transducer/ticksPerRevolution |
1 if the drive reports rev/s |
Then move the axis a known amount and compare with actuatorPositionActual. If it moves the wrong way, make gainNum negative.
Tune the controllers
Warning
An untuned loop can make an axis oscillate or run away. Start with low gains and keep the emergency stop within reach.
- Position controller (
positionController/…): setparameter/enableto1and raiseproportionalGainuntilactuatorPositionErrorstays small without overshoot. - If a steady error remains, widen
controlIntegrationMinandcontrolIntegrationMax, then addintegratorGain. Save the parameter tree.
Both are PID controllers. Double-click an error in the Desk Parameters panel to plot it while you tune.
Check the result
Plot actuatorPositionTarget and actuatorPositionActual in Desk during a move: they should overlap, and the error should settle to zero when the axis stops.
Next: Step 3: configure the axes.