Position setpoint with CSP

Send position setpoints to a drive that runs its own position, velocity and torque loops.

The drive runs all three loops itself and follows a new target position every cycle. This is the default for robot and machine applications, and the simplest set-up.

Motorcortex Drive Position setpoint Position loop Velocity loop Torque loop Motor Target position · 607A Position actual 6064 (for monitoring)

Paths are under root/AxesControl/actuatorControlLoops/actuatorControlLoopNN/, where NN is the axis number.

Set the drive mode

In Desk, write 8 8 8 8 8 8 to root/DriveLogic/driveMode, one value per axis, and save with Save parameter tree to server. See Drive logic for details.

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.

ECAT tool: the target position entry of axis 1 with its production link to the control loop and its simulation link to the Simulator
ECAT tool: the position actual value entry of axis 1 with its production link to the control loop and its simulation link to the Simulator

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:

Reading one motor revolution: 20-bit encoder, 100:1 gearbox Drive 1310720 ticks 1048576 ticks Motor 6.283 rad Load 0.0628 rad = application 1 − offset 2 ÷ gain 3 ÷ 100 1 offset In drive units: 262144 ticks here. Homing sets it, so the axis reads its reference position there. 2 gain ticksPerRevolution × gainNum / gainDen = 1048576 × 1 / 2π = 166886 ticks per rad 3 gearbox gearboxLoadSide / gearboxMotorSide = 100 / 1 motor turns per load turn Targets go the other way: drive value = value × gain + offset. For an encoder that restarts at 0 every turn, enableSingleTurnCounter first adds the whole turns it counts, times ticksPerRevolution.
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

Then move the axis a known amount and compare with actuatorPositionActual. If it moves the wrong way, make gainNum negative.

Leave positionController/parameter/enable and velocityController/parameter/enable at 0: in CSP the drive closes the loops.

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.