The RMP Motion Controller APIs
Axis: Configuration

Learn how to configure different characteristics for an axis. More...

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. We recommend that you wire an external hardware emergency stop (e-stop) button for safety when using our code sample apps. Doing so will help ensure the safety of you and those around you and will prevent potential injury or damage.

The sample apps assume that the system (network, axes, I/O) are configured prior to running the code featured in the sample app. See the Configuration page for more information.

📜 Axis Settling
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.

const double POSITION_TOLERANCE_FINE = 200; // Specify the fine position tolerance.
const double POSITION_TOLERANCE_COARSE = 300; // Specify the coarse position tolerance.
const double VELOCITY_TOLERANCE = 12000; // Specify the velocity tolerance.
const double SETTLING_TIME = 5; // Specify the settling time.
// SET
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.
// GET
var posTolFine = axis.PositionToleranceFineGet();
var posTolCoarse = axis.PositionToleranceCoarseGet();
var velTol = axis.VelocityToleranceGet();
var setTime = axis.SettlingTimeGet();

Learn more in topic page.

📜 Amp Fault Configuration
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.

const double AMP_FAULT_DURATION_TIME = 1; //value in seconds
// SET
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.
// GET
var isEnabled = axis.AmpEnableGet();
var faultAction = axis.AmpFaultActionGet();
var faultTriggerState = axis.AmpFaultTriggerStateGet();
var faultDuration = axis.AmpFaultDurationGet();

Learn more in topic page.

📜 Set User Units
Learn how to get and set User Units.

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)
// 1048576 Setting the user units to this value will result in a commanded position of 1 spinning the motor 1 full revolution
// SET
axis.ErrorLimitTriggerValueSet(1); // Specify the position error limit trigger. (Learn more about this on our support page)
// GET
var userUnits = axis.UserUnitsGet();

Learn more in topic page.

📜 Stop Rate
Learn how to set the stop rate.

// 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.
// SET
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.

Learn more in topic page.

📜 Hardware Limits
Learn how to get and set hardware limits.

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)
// SET (Hardware POSITIVE (+) Limit characteristics)
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.
// GET
var hPosLimAct = axis.HardwarePosLimitActionGet();
var hPosLimTrigState = axis.HardwarePosLimitTriggerStateGet();
var hPosLimDur = axis.HardwarePosLimitDurationGet();
// SET (Hardware NEGATIVE (-) Limit charateristics)
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.
// GET
var hNegLimAct = axis.HardwareNegLimitActionGet();
var hNegLimTrigState = axis.HardwareNegLimitTriggerStateGet();
var hNegLimDur = axis.HardwareNegLimitDurationGet();

Learn more in topic page.

📜 Phantom Axis
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
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

Learn more in topic page.

Motor Type.
Definition: rsienums.h:1229
Action to perform on an Axis.
Definition: rsienums.h:1033
static void CheckErrors(RapidCodeObject rsiObject)
Check if the RapidCode Object has any errors.
Definition: HelperFunctions.cs:64
Helper Functions for checking logged creation errors, starting the network, etc.
Definition: HelperFunctions.cs:50