API Reference v9.2.0

ServoTunerclass

Module: ZaberMotionAscii

Exposes the capabilities to inspect and edit an axis' servo tuning. Requires at least Firmware 6.25 or 7.00.

The following example illustrates how you can obtain an instance of this type:

import ZaberMotionAscii

let connection = try await Connection.openSerialPort(portName: "COM3")
let device = try connection.getDevice(deviceAddress: 1)
let axis = try device.getAxis(axisNumber: 1)
let servoTuner = ServoTuner(axis)

Constructor

ServoTuner(axis)
Creates instance of ServoTuner for the given axis.
Arguments
NameTypeDescription
axisAxisThe axis that will be tuned.

Properties

p

axis

readonly
servoTuner.axis
Axis The axis that will be tuned.

Methods

m

getPidTuning()

asyncthrows
try await servoTuner.getPidTuning(paramset)
Gets the PID representation of this paramset's servo tuning.
Arguments
NameTypeDescription
paramsetServoTuningParamsetThe paramset to get tuning for.
Return Value
PidTuning The PID representation of the current tuning.
m

getSimpleTuning()

asyncthrows
try await servoTuner.getSimpleTuning(paramset)
Get the simple tuning parameters for this device.
Arguments
NameTypeDescription
paramsetServoTuningParamsetThe paramset to get tuning for.
Return Value
SimpleTuning The simple tuning parameters.
m

getSimpleTuningParamDefinitions()

asyncthrows
try await servoTuner.getSimpleTuningParamDefinitions()
Gets the parameters that are required to tune this device.
Return Value
[SimpleTuningParamDefinition] The tuning parameters.
m

getStartupParamset()

asyncthrows
try await servoTuner.getStartupParamset()
Get the paramset that this device uses by default when it starts up.
Return Value
ServoTuningParamset The paramset used when the device restarts.
m

getTuning()

asyncthrows
try await servoTuner.getTuning(paramset)
Get the full set of tuning parameters used by the firmware driving this axis.
Arguments
NameTypeDescription
paramsetServoTuningParamsetThe paramset to get tuning for.
Return Value
ParamsetInfo The raw representation of the current tuning.
m

loadParamset()

asyncthrows
try await servoTuner.loadParamset(toParamset, fromParamset)
Load the values from one paramset into another.
Arguments
NameTypeDescription
toParamsetServoTuningParamsetThe paramset to load into.
fromParamsetServoTuningParamsetThe paramset to load from.
m

setPidTuning()

asyncthrows
try await servoTuner.setPidTuning(paramset, p, i, d, fc)
Sets the tuning of a paramset using the PID method.
Arguments
NameTypeDescription
paramsetServoTuningParamsetThe paramset to get tuning for.
pDoubleThe proportional gain. Must be in units of N/m for linear devices, and N⋅m/° for rotary devices.
iDoubleThe integral gain. Must be in units of N/(m⋅s) for linear devices, and N⋅m/(°⋅s) for rotary devices.
dDoubleThe derivative gain. Must be in units of N⋅s/m for linear devices, and N⋅m⋅s/° for rotary devices.
fcDoubleThe cutoff frequency. Must be in units of Hz.
Return Value
PidTuning The PID representation of the current tuning after your changes have been applied.
m

setSimpleTuning()

asyncthrows
try await servoTuner.setSimpleTuning(paramset, tuningParams, loadInertia, loadInertiaUnits = Units.native, carriageInertia = nil, carriageInertiaUnits = Units.native, motorInertia = nil, motorInertiaUnits = Units.native, enableFeedForward = true)
Set the tuning of this device using the simple input method.
Arguments
NameTypeDescription
paramsetServoTuningParamsetThe paramset to set tuning for.
tuningParams[ServoTuningParam]The params used to tune this device. To get what parameters are expected, call GetSimpleTuningParamList. All values must be between 0 and 1.
loadInertiaDoubleThe mass loaded on the stage, excluding the mass of the carriage itself. Unless specified by the LoadInertiaUnits parameter, this is in units of kg for linear devices, and kg⋅m² for rotary devices.
loadInertiaUnitsUnitsThe units the load mass was supplied in.
carriageInertiaDouble?The mass of the carriage itself. If not supplied, the product's default mass will be used. Unless specified by the CarriageInertiaUnits parameter, this is in units of kg for linear devices, and kg⋅m² for rotary devices.
carriageInertiaUnitsUnitsThe units the carriage mass was supplied in.
motorInertiaDouble?The inertia of the motor. Unless specified by the MotorInertiaUnits parameter, this is in units of kg⋅m².
motorInertiaUnitsUnitsThe units the motor inertia was supplied in.
enableFeedForwardBoolWhether to enable the inertial feed-forward term.
m

setStartupParamset()

asyncthrows
try await servoTuner.setStartupParamset(paramset)
Set the paramset that this device uses by default when it starts up.
Arguments
NameTypeDescription
paramsetServoTuningParamsetThe paramset to use at startup.
m

setTuning()

asyncthrows
try await servoTuner.setTuning(paramset, tuningParams, setUnspecifiedToDefault = false)
Set individual tuning parameters. Only use this method if you have a strong understanding of Zaber specific tuning parameters.
Arguments
NameTypeDescription
paramsetServoTuningParamsetThe paramset to set tuning of.
tuningParams[ServoTuningParam]The params to set.
setUnspecifiedToDefaultBoolIf true, any tuning parameters not included in TuningParams are reset to their default values.