Velocity setpoint with CST
4 minute read
Motorcortex closes the velocity loop and sends the drive a target torque every cycle. The drive only closes the torque loop. Use it when the application must shape the torque of a velocity-controlled axis itself.
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 10 to root/DriveLogic/driveMode for each axis that uses this mode, 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:
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; velocity and torque work the same way, with their own transducer:
| Set | Parameter | Example |
|---|---|---|
| Gearbox | gearboxLoadSide, gearboxMotorSide |
100, 1 for 100:1 |
| Velocity units | velocityTransformation/transducer/ticksPerRevolution |
1 if the drive reports rev/s |
| Torque units | torqueTransformation/transducer/gainNum, gainDen |
500, 1 for 2 Nm rated, drive in ‰ |
| Encoder, for the position read-back | positionTransformation/transducer/ticksPerRevolution |
1048576 for 20 bits |
Set 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.
- Leave
positionController/parameter/enableat0. - On the velocity controller (
velocityController/…), setcontrolOutputMinandcontrolOutputMaxto the torque the motor may deliver. - Set
velocityController/parameter/enableto1and raiseproportionalGainin small steps untilactuatorVelocityErrorstays small. If a steady error remains, widencontrolIntegrationMinandcontrolIntegrationMax, then addintegratorGain. Save the parameter tree.
The velocity controller is a PID controller. Double-click actuatorVelocityError in the Desk Parameters panel to plot it while you tune.
Send the setpoint
Warning
By default the limiter follows a position setpoint and ignores a velocity setpoint. Set it to take velocities first, as below. Then it still stops the axis on its position limits, unless you switch those off for a wheel: after that nothing stops the axis turning as long as the setpoint asks.
The setpoint goes into root/AxesControl/axesVelocitiesInput, one value per axis in rad/s, at the load. Channel 0 is the first axis.
Set the limiter of each such axis to take the velocity as its command, under root/AxesControl/axesLimiters/LimitsNN/: enableInput to 0, enableInputDot to 1, and enablePositionLimit to 0 for a wheel or 1 to keep the position limits. See Limiter.
To take the setpoint from another part of the application, link it in a link file. The standard AGV configuration sends its wheel velocities from element 7 on, to axes 7 and 8:
{
"Source": { "Path": "root/AGVControl/jointVelocitySetpoints" },
"Destination": { "Path": "root/AxesControl/axesVelocitiesInput", "Index": 6 }
}
To test by hand, write a small value to that channel of axesVelocitiesInput in Desk while the axis is engaged. A linked input is overwritten every cycle, so test on a channel that is not linked. See position window detector to guard the position.
Check the result
Plot root/AxesControl/axesVelocitiesInput and the measured axesVelocitiesActual in Desk: the measured value should follow the setpoint.
Next: Step 3: configure the axes.