APIs, concepts, guides, and more

◆ MotionAttributeMaskOnSet()

void MotionAttributeMaskOnSet ( RSIMotionAttrMask maskOn)
Description:
MotionAttributeMaskOnSet turns on a particular motion attribute mask.
Parameters
maskOn::RSIMotionAttrMask value we want to turn on.

Part of the Motion Configuration method group.

Sample Code:
Motion: Hold
/* This sample demonstrates how to hold motion until a digital input signal is received.
Uses a digital input to trigger motion release, useful for external sensor-based control.
*/
using RSI.RapidCode; // RSI.RapidCode.dotNET;
Console.WriteLine("📜 Motion Hold: via Digital Input");
int exitCode = 0;
// set sample config params
const int DIGITAL_INPUTS_PDO_INDEX = 3; // pdo inputs index for digital inputs
// get rmp objects
try
{
Helpers.CheckErrors(controller);
Helpers.VerifyHardwareUsage(controller);
Helpers.VerifyAxisCount(controller);
// check is network is started
{
Console.WriteLine("Phantom axes do not have digital inputs. Please enable USE_HARDWARE to run this sample.");
}
if (controller.NetworkStateGet() != RSINetworkState.RSINetworkStateOPERATIONAL)
{
Console.WriteLine("Network not started. Please start it before running this app.");
}
// get axis
Axis axis = controller.AxisGet(Constants.AXIS_0_INDEX);
Helpers.CheckErrors(axis);
// configure axis
// get host address using the pdo input index of digital inputs
ulong inputAddress = controller.NetworkInputAddressGet(DIGITAL_INPUTS_PDO_INDEX);
// configure motion hold for digital input
axis.MotionHoldTypeSet(RSIMotionHoldType.RSIMotionHoldTypeCUSTOM); // use custom type to hold based on bit pattern
axis.MotionHoldUserAddressSet(inputAddress); // specify the digital inputs host address
axis.MotionHoldUserMaskSet(0x20000); // specify the bit to watch (logic AND)
axis.MotionHoldUserPatternSet(0x20000); // bit value that will release the motion hold
// enable motion hold
axis.MotionAttributeMaskOnSet(RSIMotionAttrMask.RSIMotionAttrMaskHOLD);
// command motion - will be held until digital input condition is met
axis.MoveRelative(3);
Console.WriteLine("\tFirst motion commanded (held until digital input triggers)");
// subsequent moves will also be held with same condition
axis.MoveRelative(3);
Console.WriteLine("\tSecond motion commanded (held until digital input triggers)");
// disable motion hold
axis.MotionAttributeMaskOffSet(RSIMotionAttrMask.RSIMotionAttrMaskHOLD);
// this motion will execute immediately without hold
axis.MoveRelative(3);
Console.WriteLine("\tThird motion commanded (no hold, executes immediately)");
Console.WriteLine($"\tFinal position: {axis.CommandPositionGet()}");
// cleanup
Helpers.AbortMotionObject(axis);
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 bool USE_HARDWARE
Default: false.
Definition _constants.cs:10
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 AMP_ENABLE_MS
Default: 750.
Definition _constants.cs:35
const int EXIT_SUCCESS
Exit code for successful execution.
Definition _constants.cs:68
void MoveRelative(double relativePosition, double vel, double accel, double decel, double jerkPct)
Command a relative point-to-point S-Curve motion.
Represents a single axis of motion control. This class provides an interface for commanding motion,...
Definition rsi.h:5966
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
void MotionHoldUserMaskSet(int32_t holdMask)
Sets the Motion Hold User bit mask.
void MotionHoldUserPatternSet(int32_t pattern)
Sets the Motion Hold User pattern bit mask.
void MotionAttributeMaskOffSet(RSIMotionAttrMask maskOff)
Turn off a particular motion attribute mask.
void MotionHoldTypeSet(RSIMotionHoldType type)
Set the motion hold type.
int32_t MotionDoneWait(int32_t waitTimeoutMilliseconds=WaitForever)
Waits for a move to complete.
void MotionHoldUserAddressSet(uint64_t address)
Sets the Motion Hold User Address.
int32_t AmpEnableSet(bool enable, int32_t ampActiveTimeoutMilliseconds=AmpEnableTimeoutMillisecondsDefault, bool overrideRestrictedState=false)
Enable all amplifiers.
void MotionAttributeMaskOnSet(RSIMotionAttrMask maskOn)
Turn on a particular motion attribute mask.
RSINetworkState
State of network.
Definition rsienums.h:573
RSIMotionAttrMask
Attribute masks for motion. You cannot mix RSIMotionAttrMaskDELAY and RSIMotionAttrMaskAPPEND.
Definition rsienums.h:1067
RSIMotionHoldType
Types for MotionHold attribute.
Definition rsienums.h:1102
Helpers namespace provides utility functions for common tasks in RMP applications.
Definition helpers.h:21
Note
You cannot mix RSIMotionAttrMaskDELAY and RSIMotionAttrMaskAPPEND.
See also
::RSIMotionAttrMask, MotionAttributeMaskOnGet, MotionAttributeMaskOffSet
Examples
MotionHoldReleasedBySoftwareAddress.cpp, MultiaxisMotion.cpp, axis-motion-hold-via-address.cs, axis-motion-hold-via-digitalinput.cs, and axis-motion-hold-via-position.cs.