APIs, concepts, guides, and more

◆ ConfigurePhantomAxis()

static void ConfigurePhantomAxis ( MotionController controller,
int axisNumber )
static
Parameters
controllerPointer to the MotionController containing the axis.
axisNumberThe number of the axis to configure as a phantom axis.
Exceptions
SystemExceptionThrown if an invalid axis number is provided.
public static void ConfigurePhantomAxis(MotionController controller, int axisNumber)
{
// Check if the axis number is valid
if (axisNumber < 0)
{
throw new SystemException("Error: " + axisNumber.ToString() + " is invalid. Axis numbers cannot be negative.");
}
if (axisNumber >= controller.AxisCountGet())
{
throw new SystemException("Error: " + axisNumber.ToString() + " is invalid. Axis numbers cannot be greater than the number of axes on the controller.");
}
// Configure the specified axis as a phantom axis
Axis axis = controller.AxisGet(axisNumber); // Initialize Axis class
HelperFunctionsCS.CheckErrors(axis); // [Helper Function] Check that the axis has been initialized correctly
// These limits are not meaningful for a Phantom Axis (e.g., a phantom axis has no actual position so a position error trigger is not necessary)
// Therefore, you must set all of their actions to "NONE".
axis.PositionSet(0); // Set the position to 0
axis.ErrorLimitActionSet(RSIAction.RSIActionNONE); // Set Error Limit Action.
axis.HardwareNegLimitActionSet(RSIAction.RSIActionNONE); // Set Hardware Negative Limit Action.
axis.HardwarePosLimitActionSet(RSIAction.RSIActionNONE); // Set Hardware Positive Limit Action.
axis.HomeActionSet(RSIAction.RSIActionNONE); // Set Home Action.
axis.SoftwareNegLimitActionSet(RSIAction.RSIActionNONE); // Set Software Negative Limit Action.
axis.SoftwarePosLimitActionSet(RSIAction.RSIActionNONE); // Set Software Positive Limit Action.
const double positionToleranceMax = Double.MaxValue / 10.0; // Reduce from max slightly, so XML to string serialization and deserialization works without throwing System.OverflowException
axis.PositionToleranceCoarseSet(positionToleranceMax); // Set Settling Coarse Position Tolerance to max value
axis.PositionToleranceFineSet(positionToleranceMax); // Set Settling Fine Position Tolerance to max value (so Phantom axis will get immediate MotionDone when target is reached)
axis.MotorTypeSet(RSIMotorType.RSIMotorTypePHANTOM); // Set the MotorType to phantom
}
See also
CheckErrors @[Configure-Phantom-Axis-cs]

Definition at line 212 of file HelperFunctionsCS.cs.