Console.WriteLine("📜 User Limit: Position Abort");
const int USER_LIMIT_NUMBER = 0;
const double TRIGGER_POSITION = 5.0;
const double MOVE_POSITION = 10.0;
const int OUTPUT_INDEX = 1;
const int WAIT_FOR_TRIGGER_MILLISECONDS = 1000;
try
{
controller.UserLimitCountSet(1);
controller.InterruptEnableSet(true);
controller.UserLimitConditionSet(
number: USER_LIMIT_NUMBER,
conditionNumber: 0,
limitValueDouble: TRIGGER_POSITION);
controller.UserLimitConfigSet(
number: USER_LIMIT_NUMBER,
duration: 0);
controller.UserLimitOutputSet(
number: USER_LIMIT_NUMBER,
enabled: true);
Console.WriteLine($"Moving to position {MOVE_POSITION}...");
Console.WriteLine($"User limit will trigger abort at position {TRIGGER_POSITION}");
Console.WriteLine("ERROR: Output should not be triggered yet");
RSIEventType interruptType = controller.InterruptWait(WAIT_FOR_TRIGGER_MILLISECONDS);
{
int interruptSource = controller.InterruptSourceNumberGet();
int expectedSource = USER_LIMIT_NUMBER + 1;
if (interruptSource == expectedSource)
{
Console.WriteLine($"✓ User limit triggered - abort executed");
Console.WriteLine($" Interrupt source: {interruptSource}");
Console.WriteLine(" Output activated successfully");
else
Console.WriteLine(" WARNING: Output was not activated");
}
else
{
Console.WriteLine($"✗ Got USER_LIMIT interrupt but wrong source (expected: {expectedSource}, actual: {interruptSource})");
}
}
else
{
Console.WriteLine($"✗ Expected USER_LIMIT interrupt but got {interruptType}");
}
controller.UserLimitDisable(USER_LIMIT_NUMBER);
controller.UserLimitCountSet(0);
Console.WriteLine("\nUser limit position abort complete.");
}
finally
{
controller.Delete();
}
Constants used in the C# sample apps.
const int AXIS_0_INDEX
Default: 0.
uint64_t AddressGet(RSIAxisAddressType addressType)
Get the an address for some location on the Axis.
void MoveSCurve(double position, double vel, double accel, double decel, double jerkPct)
Represents a single axis of motion control. This class provides an interface for commanding motion,...
uint64_t AddressGet()
Get the Host Address for the I/O point.
void Set(bool state)
Set the state of a Digital Output.
static IOPoint * CreateDigitalOutput(Axis *axis, RSIMotorDedicatedOut motorDedicatedOutNumber)
Create a Digital Output from an Axis' Dedicated Output bits.
bool Get()
Get the state of Digital Input or Output.
int32_t MaskGet()
Get the bit mask for the I/O point.
Represents one specific point: Digital Output, Digital Input, Analog Output, or Analog Input....
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...
int32_t AmpEnableSet(bool enable, int32_t ampActiveTimeoutMilliseconds=AmpEnableTimeoutMillisecondsDefault, bool overrideRestrictedState=false)
Enable all amplifiers.
int32_t NumberGet()
Get the axis number.
RSIControllerAddressType
Used to get firmware address used in User Limits, Recorders, etc.
RSIEventType
Event Types or Status Bits.
RSIUserLimitLogic
Logic options for User Limits.
RSIAction
Action to perform on an Axis.
RSIAxisAddressType
Used to get firmware address used in User Limits, Recorders, etc.
RSIUserLimitTriggerType
Trigger types for UserLimits.
Helpers namespace provides utility functions for common tasks in RMP applications.