AxisConfig.cs
Warning
This is a sample program to assist in the integration of the RMP motion controller with your application. It may not contain all of the logic and safety features that your application requires.

AxisSettling
Visit our Topic Page for more information.
Configure the following characteristics for axis:
1) Fine Position Tolerance.
2) Coarse Position Tolerance.
3) Velocity Tolerance.
4) Settling Time Tolerance.Settling Time is the amount of time that a move must be within the position Fine band, in order for the move to be considered complete.

//---ARRRANGE---
const int POSITION_TOLERANCE_FINE = 200; // Specify the fine position tolerance.
const int POSITION_TOLERANCE_COARSE = 300; // Specify the coarse position tolerance.
const int VELOCITY_TOLERANCE = 12000; // Specify the velocity tolerance.
const int SETTLING_TIME = 5; // Specify the settling time.
//---ACT---
axis.PositionToleranceFineSet(POSITION_TOLERANCE_FINE); // Set fine position tolerance.
axis.PositionToleranceCoarseSet(POSITION_TOLERANCE_COARSE); // Set coarse position tolerance.
axis.VelocityToleranceSet(VELOCITY_TOLERANCE); // Set velocity tolerance.
axis.SettlingTimeSet(SETTLING_TIME); // Set settling time.
//---ASSERT---
Assert.That(axis.PositionToleranceFineGet(), Is.EqualTo(POSITION_TOLERANCE_FINE), "The getter function should return a value equal to POSITION_TOLERANCE_FINE");
Assert.That(axis.PositionToleranceCoarseGet(), Is.EqualTo(POSITION_TOLERANCE_COARSE), "The getter function should return a value equal to POSITION_TOLERANCE_COARSE");
Assert.That(axis.VelocityToleranceGet(), Is.EqualTo(VELOCITY_TOLERANCE), "The getter function should return a value equal to VELOCITY_TOLERANCE");
Assert.That(axis.SettlingTimeGet(), Is.EqualTo(SETTLING_TIME), "The getter function should return a value equal to SETTLING_TIME");

ConfigAmpFault
Visit our Topic Page for more information.

Axis Amp Fault Config sample application The program will configure the amp fault input for a motor. A motor's amp fault input has three items to configure:
1) Event Action(any MPIAction such as MPIActionE_STOP)
2) Event Trigger(a trigger polarity, active HIGH or LOW)
3) Duration(requires the limit condition to exist for a programmable number of seconds before an event will occur) The duration described above is a configuration that provides filtering of the amp fault input by requiring the input to remain active for the defined duration.This will effectively keep the amp fault from activating prematurely due to electrical noise on the amp fault input.

//---ARRANGE---
const double AMP_FAULT_DURATION_TIME = 1; //value in seconds
//---ACT---
axis.AmpEnableSet(false); // Disable the amp
axis.AmpFaultActionSet(RSIAction.RSIActionABORT); // Set the action that will occur when there is an amp fault.
axis.AmpFaultTriggerStateSet(false); //Set the state of the amp fault.
axis.AmpFaultDurationSet(AMP_FAULT_DURATION_TIME); //Set the duration required before the Amp Fault event triggers.
//---ASSERT---
Assert.That(axis.AmpEnableGet(), Is.EqualTo(false), "The getter function should return a value equal to false");
Assert.That(axis.AmpFaultActionGet(), Is.EqualTo(RSIAction.RSIActionABORT), "The getter function should return a value equal to RSIActionABORT");
Assert.That(axis.AmpFaultTriggerStateGet(), Is.EqualTo(false), "The getter function should return a value equal to false");
Assert.That(axis.AmpFaultDurationGet(), Is.EqualTo(AMP_FAULT_DURATION_TIME), "The getter function should return a value equal to AMP_FAULT_DURATION_TIME");

SetUserUnits
Visit our Topic Page for more information.
This application demonstrates how to set User Units.

// Constants
const int ENCODER_RESOLUTION_BITS = 20; // The number of bits defining the encoder resolution
// Specify your counts per unit / user units. (the motor used in this sample app has 1048576 encoder pulses per revolution)
double USER_UNITS = Math.Pow(2, ENCODER_RESOLUTION_BITS); //1048576 Setting the user units to this value will result in a commanded position of 1 spinning the motor 1 full revolution
axis.UserUnitsSet(USER_UNITS); // SET YOUR USER UNITS!
axis.ErrorLimitTriggerValueSet(1); // Specify the position error limit trigger. (Learn more about this on our support page)
//---ASSERT---
Assert.That(axis.UserUnitsGet(), Is.EqualTo(USER_UNITS)); // Verify that your user units were changed!

StopRate
Visit our Topic Page for more information.
Stop Rate example

// Constants
const double STOP_RATE_DEFAULT = 1.0; // Specify the default STOP rate in seconds.
const double ESTOP_RATE_DEFAULT = 0.05; // Specify the default ESTOP rate in seconds.
const double ESTOP_DECELERATION_RATE = 1000; // Specify the default ESTOP deceleration rate in seconds.
axis.StopTimeSet(STOP_RATE_DEFAULT); // Set the default STOP time to STOP_RATE_DEFAULT secs.
axis.EStopTimeSet(ESTOP_RATE_DEFAULT); // Set the default ESTOP time to ESTOP_RATE_DEFAULT secs.
axis.EStopDecelerationSet(ESTOP_DECELERATION_RATE); // Set the default ESTOP time to ESTOP_DECELERATION_RATE secs.

HardwareLimits
Visit our Topic Page for more information.
Hardware Limits example

// Constants
const bool ACTIVE_HIGH = true; // Constant for active high.
const bool ACTIVE_LOW = false; // Constant for active low.
const double HW_POS_DURATION_TIME = 0.01; // Positive limit duration. (in seconds)
const double HW_NEG_DURATION_TIME = 0.01; // Negative limit duration. (in seconds)
// Change Hardware POSITIVE (+) Limit characteristics.
//---ACT---
axis.HardwarePosLimitActionSet(RSIAction.RSIActionE_STOP); // Set the positive limit action to E_STOP.
axis.HardwarePosLimitTriggerStateSet(ACTIVE_HIGH); // Set the positive limit trigger state to ACTIVE_HIGH.
axis.HardwarePosLimitDurationSet(HW_POS_DURATION_TIME); // Set the positive limit duration to 0.01 seconds.
//---ASSERT---
Assert.That(axis.HardwarePosLimitActionGet(), Is.EqualTo(RSIAction.RSIActionE_STOP), "Hardware Positive Limit Action should be set to RSIAction.RSIActionE_STOP");
Assert.That(axis.HardwarePosLimitTriggerStateGet(), Is.EqualTo(ACTIVE_HIGH), "Hardware Positive Limit TriggerState should be set to ACTIVE_HIGH");
Assert.That(axis.HardwarePosLimitDurationGet(), Is.EqualTo(HW_POS_DURATION_TIME), "Hardware Positive Limit Duration set to HW_POS_DURATION_TIME");
// Change Hardware NEGATIVE (-) Limit charateristics.
//---ACT---
axis.HardwareNegLimitActionSet(RSIAction.RSIActionE_STOP); // Set the negative limit action to E_STOP.
axis.HardwareNegLimitTriggerStateSet(ACTIVE_LOW); // Set the negative limit trigger state to ACTIVE_LOW.
axis.HardwareNegLimitDurationSet(HW_NEG_DURATION_TIME); // Set the negative limit duration to 0.01 seconds.
//---ASSERT---
Assert.That(axis.HardwareNegLimitActionGet(), Is.EqualTo(RSIAction.RSIActionE_STOP), "Hardware Positive Limit Action should be set to RSIAction.RSIActionE_STOP");
Assert.That(axis.HardwareNegLimitTriggerStateGet(), Is.EqualTo(ACTIVE_LOW), "Hardware Positive Limit TriggerState should be set to ACTIVE_LOW");
Assert.That(axis.HardwareNegLimitDurationGet(), Is.EqualTo(HW_POS_DURATION_TIME), "Hardware Positive Limit Duration set to HW_POS_DURATION_TIME");

PhantomAxis
Visit our Topic Page for more information.
This sample application demonstrates how to set up a phantom axis. Phantom axes can be used to test your applications when the network is unavailable or you need more axes than are currently connected to your network.

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
SampleAppsCS.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