APIs, concepts, guides, and more

◆ AxisCountSet() [1/2]

void AxisCountSet ( int32_t axisCount)
Description:
AxisCountSet will configure the number of axes processed by the controller.
Parameters
axisCountA int32_t value to set AxisCount to.

Part of the Information method group.

Sample Code:
Axis: Configuration
controller.AxisCountSet(controller.AxisCountGet() + 1); // Configure one additional axis to be used for the phantom axis
int axisNumber = controller.AxisCountGet() - 1; // Set the axis number to the last axis on the network (subtract one because the axes are zero indexed)
axis = controller.AxisGet(axisNumber); // Initialize Axis class
HelperFunctions.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.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
Warning
Important usage instructions for all RapidCode object count set methods:
This should be done after successful MotionController::Create but before any RapidCode object creation, (MotionController::AxisGet, MotionController::MultiAxisGet, etc.) as changing object counts will reconfigure the RMP's dynamic memory allocation which invalidates all preexisting RapidCode objects.
See also
AxisCountSet, MotionCountSet, RecorderCountSet, UserLimitCountSet, MathBlockCountSet, CompensatorCountSet
AxisCountGet
Note
By default, this will also set the number of allocated/enabled MotionSupervisors, Filters, and Motors
Examples
AxisConfig.cs, Compensator.cs, HelperFunctions.cs, MultiAxisMotion.cs, PhantomAxis.cpp, Recorder.cs, SampleAppsHelper.h, UserLimit.cs, and UserLimitCommandPositionDirect.cs.