APIs, concepts, guides, and more
axis-config-ampfault.cs
Note
See Axis: Configuration 📜 for a detailed explanation of this sample code.
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. 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.
using RSI.RapidCode; // RSI.RapidCode.dotNET;
Console.WriteLine("📜 Axis Config: AmpFault");
int exitCode = 0;
// get rmp objects
try
{
Helpers.CheckErrors(controller);
Helpers.VerifyHardwareUsage(controller);
Helpers.VerifyAxisCount(controller);
Axis axis = controller.AxisGet(axisNumber: Constants.AXIS_0_INDEX);
Helpers.CheckErrors(axis);
// 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(1); // set the duration (seconds) required before the Amp Fault event triggers.
// get
bool isEnabled = axis.AmpEnableGet();
RSIAction faultAction = axis.AmpFaultActionGet();
bool faultTriggerState = axis.AmpFaultTriggerStateGet();
double faultDuration = axis.AmpFaultDurationGet();
Console.WriteLine($"Amp Enabled: {isEnabled}");
Console.WriteLine($"Fault Action: {faultAction}");
Console.WriteLine($"Fault Trigger State: {faultTriggerState}");
Console.WriteLine($"Fault Duration: {faultDuration}");
exitCode = Constants.EXIT_SUCCESS;
}
// handle errors as needed
catch (Exception e)
{
Console.WriteLine($"❌ Error: {e.Message}");
exitCode = Constants.EXIT_FAILURE;
}
finally
{
controller.Delete(); // dispose
}
return exitCode;
Constants used in the C# sample apps.
Definition _constants.cs:3
const int EXIT_FAILURE
Exit code for failed execution.
Definition _constants.cs:69
const int AXIS_0_INDEX
Default: 0.
Definition _constants.cs:20
const int EXIT_SUCCESS
Exit code for successful execution.
Definition _constants.cs:68
RSIAction AmpFaultActionGet()
Get the Amp Fault action.
bool AmpEnableGet()
Get the state of the Amp Enable Output.
void AmpFaultActionSet(RSIAction action)
Set the Amp Fault action.
void AmpFaultTriggerStateSet(bool state)
Set the trigger state of the Amp Fault input.
double AmpFaultDurationGet()
Get the duration required before the Amp Fault event triggers.
bool AmpFaultTriggerStateGet()
Get the Amp Fault trigger state.
void AmpFaultDurationSet(double seconds)
Set the duration required before the Amp Fault event triggers.
Represents a single axis of motion control. This class provides an interface for commanding motion,...
Definition rsi.h:5921
static MotionController * Get()
Get an already running RMP EtherCAT controller.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
Definition rsi.h:800
int32_t AmpEnableSet(bool enable, int32_t ampActiveTimeoutMilliseconds=AmpEnableTimeoutMillisecondsDefault, bool overrideRestrictedState=false)
Enable all amplifiers.
RSIAction
Action to perform on an Axis.
Definition rsienums.h:1122
Helpers namespace provides utility functions for common tasks in RMP applications.
Definition helpers.h:21