The RMP Motion Controller APIs

◆ InterruptUserDataDoubleGet()

double InterruptUserDataDoubleGet ( uint32_t  userDataIndex)
inherited
Description:
InterruptUserDataGet returns the floating point, double precision user data from the interrupt
Returns
(double) User data.
Sample Code:
// Constants
const int AXIS_INDEX = 0; // This is the index of the axis you will use to command motion.
const int INPUT_INDEX = 0;
const int AXIS_COUNT = 1; // Axes on the network.
const int USER_LIMIT = 0; // Specify which user limit to use.
const int CONDITION = 0; // Specify which condition to use. (0 or 1) ("0" to compare 1 input || "1" to compare 2 inputs)
const RSIUserLimitLogic LOGIC = RSIUserLimitLogic.RSIUserLimitLogicEQ; // Logic for input value comparison.
const int LIMIT_VALUE = 1; // The value to be compared which needs to be set here.
const RSIUserLimitTriggerType TRIGGER_TYPE = RSIUserLimitTriggerType.RSIUserLimitTriggerTypeSINGLE_CONDITION; // Choose the how the condition (s) should be evaluated.
const RSIAction ACTION = RSIAction.RSIActionE_STOP_ABORT; // Choose the action you want to cause when the User Limit triggers.
const double DURATION = 0.125; // Enter the time delay before the action is executed after the User Limit has triggered.
const int USER_DATA_INDEX = 0;
// Some Necessary Pre User Limit Configuration
controller.AxisCountSet(1);
controller.UserLimitCountSet(1); // Set the amount of UserLimits that you want to use.
controller.InterruptEnableSet(true); // Enable User Limit Interrupts. (When a user limit input comparison is met, and interrupt is triggered)
UInt64 userBufferAddress = controller.AddressGet(RSIControllerAddressType.RSIControllerAddressTypeUSER_BUFFER, 0); // Grabing an memory address to store a simulated IO point.
//Instead of using physical IO we will use simulated IO using a memory address as simulated IO. See the IO sample apps to see how to use a physical IO instead.
IOPoint input0 = IOPoint.CreateDigitalInput(controller, userBufferAddress, INPUT_INDEX); // Create IOPoint object. Can be used to automatically get the address of a specified node and input index
axis = CreateAndReadyAxis(Constants.AXIS_NUMBER); // Initialize your axis object.
axis.MoveVelocity(10.0, 20.0); // Command a velocity move (Velocity=1.0, Acceleration=10.0).
// USER LIMIT CONDITION
controller.UserLimitConditionSet(USER_LIMIT, CONDITION, LOGIC, input0.AddressGet(), (uint)input0.MaskGet(), LIMIT_VALUE); // Set your User Limit Condition (1st step to setting up your user limit)
// USER LIMIT CONFIGURATION
controller.UserLimitConfigSet(USER_LIMIT, TRIGGER_TYPE, ACTION, AXIS_INDEX, DURATION); // Set your User Limit Configuration. (2nd step to setting up your user limit)
// USER LIMIT USER DATA SET
controller.UserLimitInterruptUserDataAddressSet(USER_LIMIT, // Specify the user limit you want to add User Data for.
USER_DATA_INDEX, // Specify what user data index you would like to use. (must be a value from 0 to 4)
axis.AddressGet(RSIAxisAddressType.RSIAxisAddressTypeCOMMAND_POSITION)); // Specify the address of the data value you want to store in your User Data so that you can retrieve it later after the UserLimit limit triggers.
// WAIT FOR DIGITAL INPUT TO TRIGGER USER LIMIT EVENT.
while (controller.InterruptWait(250) != RSIEventType.RSIEventTypeUSER_LIMIT) // Wait until your user limit triggers.
{
controller.MemorySet(input0.AddressGet(), 1);
}
int triggeredUserLimit = controller.InterruptSourceNumberGet() - AXIS_COUNT; // Check that the correct user limit has triggered. (an extra user limit is allocated for each axis)
double interruptPosition = controller.InterruptUserDataDoubleGet(USER_DATA_INDEX); // Get the data stored in the interrupt's user data you configured.
Console.WriteLine("TRIGGERED - User Limit Interrupt Position = " + interruptPosition / axis.UserUnitsGet()); // Get the position of the axis when it user limit event triggered.
controller.UserLimitDisable(USER_LIMIT);
See also
UserLimitInterruptUserDataAddressSet
Examples
UserLimit.cs.
RSI::RapidCode::MotionController::UserLimitCountSet
void UserLimitCountSet(int32_t userLimitCount)
Set the number of processed UserLimits in the MotionController.
RSI::RapidCode::RapidCodeInterrupt::InterruptSourceNumberGet
int32_t InterruptSourceNumberGet()
Get the number (or index) of the object (Axis, Motor, etc) that generated the interrupt.
RSI::RapidCode::RapidCodeInterrupt::InterruptUserDataDoubleGet
double InterruptUserDataDoubleGet(uint32_t userDataIndex)
Get the user data associated with the interrupt, as a 64-bit double.
RSI::RapidCode::MotionController::UserLimitInterruptUserDataAddressSet
void UserLimitInterruptUserDataAddressSet(int32_t number, uint32_t userDataIndex, uint64_t address)
Set the User Data address based on a User Limit trigger.
RSI::RapidCode::MotionController::AxisCountSet
void AxisCountSet(int32_t axisCount)
Set the number of allocated and processed axes in the controller.
RSI::RapidCode::RSIEventType
RSIEventType
Event Types or Status Bits.
Definition: rsienums.h:911
RSI::RapidCode::MotionController::UserLimitDisable
void UserLimitDisable(int32_t number)
Disable the processing of a User Limit.
RSI::RapidCode::MotionController::InterruptEnableSet
void InterruptEnableSet(bool enable)
Control interrupts for this class.
RSI::RapidCode::RSIUserLimitLogic
RSIUserLimitLogic
Logic options for User Limits.
Definition: rsienums.h:635
RSI::RapidCode::MotionController::MemorySet
void MemorySet(uint64_t address, int32_t data)
Write a value to controller memory.
RSI::RapidCode::MotionController::UserLimitConfigSet
void UserLimitConfigSet(int32_t number, RSIUserLimitTriggerType triggerType, RSIAction action, int32_t actionAxis, double duration, bool singleShot)
Configure a User Limit.
RSI::RapidCode::MotionController::AddressGet
uint64_t AddressGet(RSIControllerAddressType type)
Get the an address for some location on the MotionController.
RSI::RapidCode::RapidCodeInterrupt::InterruptWait
RSIEventType InterruptWait(int32_t milliseconds)
Suspend the current thread until an interrupt arrives from the controller.
RSI::RapidCode::MotionController::UserLimitConditionSet
void UserLimitConditionSet(int32_t number, int32_t conditionNumber, RSIUserLimitLogic logic, uint64_t addressOfUInt32, uint32_t userLimitMask, uint32_t limitValueUInt32)
Set the conditions for a User Limit with a 32-bit integer trigger value.
RSI::RapidCode::RSIUserLimitTriggerType
RSIUserLimitTriggerType
Trigger types for UserLimits.
Definition: rsienums.h:622
RSI::RapidCode::RSIControllerAddressType
RSIControllerAddressType
Used to get firmware address used in User Limits, Sequencers, etc.
Definition: rsienums.h:412
RSI::RapidCode::RSIAction
RSIAction
Action to perform on an Axis.
Definition: rsienums.h:1051
RSI::RapidCode::RSIAxisAddressType
RSIAxisAddressType
Used to get firmware address used in User Limits, Sequencers, etc.
Definition: rsienums.h:430