The RMP Motion Controller APIs
Motion: Camming & Gearing

Sample apps showing how the position of an axis can be driven by that of another 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.
This sample code presumes that the user has set the tuning paramters(PID, PIV, etc.) prior to running this program so that the motor can rotate in a stable manner.

📜 Camming
This sample application allows you to command a nonlinear coordinated motion betweentwo axes.
  Moving Axis Axis: this axis/motor may or may not be controlled by the motion controller.
  Driven Axis: the motion controller controls the position of this axis/motor as a function of the position of the Moving axis.

User Units must be set to 1 ❗️
//Create RapidCode Objects
Axis moving_axis = controller.AxisGet(Constants.MAIN_AXIS_NUMBER);
Axis follower_axis = controller.AxisGet(Constants.DRIVEN_AXIS_NUMBER);
// Constants
const double MAIN_VELOCITY = 50; // Specify your Moving Axis's velocity. - units: Units/Sec (it will do 1 counts / (1/104857) of a revolution every 1 second.)
const double MAIN_ACCELERATION = 20; // Specify your Moving Axis's acceleration. - units: Units/Sec^2
// Commanded Positions
double[] movingAxisDistances = { 5, 10, 8 }; // This is the RELATIVE Moving Axis distance, every n revolutions it changes its Driven position. (This is the x-axis)
double[] followerAxisPositions = { 10, 20, 10 }; // This is the final ABSOLUTE Driven position, for every 5 revolutions one of this positions gets applied. (This is the y-axis)
// Command motion on the Driven before the Moving Axis starts
RSIAxisMasterType.RSIAxisMasterTypeAXIS_COMMAND_POSITION, // Use COMMAND for phantoms and ACTUAL for real axis.
moving_axis.MoveVelocity(MAIN_VELOCITY, MAIN_ACCELERATION); // Command a constant velocity on the master axis, Driven will follow.
follower_axis.MotionDoneWait(); // Wait for the cam motion to complet
moving_axis.Stop(); // Stop the Moving Axis

Learn more in topic page.

📜 Gearing
Axis gearing on the XMP is based off of a Axis, RSIAxisMasterType, numerator, and denominator.
  The Axis points to a Moving Axis axis to gear to.
  The RSIAxisMasterType specifies what feedback source to gear to. The ratio between the lead and follower axes is set by a ratio of two longs – a numerator and a denominator.

//Create RapidCode Objects
Axis moving_axis = controller.AxisGet(Constants.MAIN_AXIS_NUMBER);
Axis follower_axis = controller.AxisGet(Constants.DRIVEN_AXIS_NUMBER);
int numerator = 2; // Specify the numerator of the gearing ratio.
int denominator = 1; // Specify the denominator of the gearing ratio.
// Configure the 'follower' axis to be a follow to the 'moving' axis at a ratio of 2:1, that is,
// for every rotation of the Moving Axis axis, the Driven axis will rotate twice.
RSIAxisMasterType.RSIAxisMasterTypeAXIS_COMMAND_POSITION, // If NOT using a Phantom Axis, switch to RSIAxisMasterTypeAXIS_ACTUAL_POSITION
// Perform a S-curve motion on the Moving Axis axis.
moving_axis.MotionDoneWait(); // Wait for motion to finish.

Learn more in topic page.

Sources available to a slave Axis for electronic gearing & camming.
Definition: rsienums.h:1136
Axis * AxisGet(int32_t axisNumber)
AxisGet returns a pointer to an Axis object and initializes its internals.
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