The RMP Motion Controller APIs
RapidScript

Description

RapidScript is a basic programming language we created to make programming motion applications simple and fun.

🛠️ Configuration

Prior to running any RapidScript application, users should configure their system properly. See the Configuration page for more information. In most cases, either using the rsiconfig utility or RapidCode functions to configure a system is preferred over using RapidScript.

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.

Example configuration of a phantom axis:

void ConfigurePhantomAxis(uint32 axisIndex)
{
// The number of encoder counts per unit.
// This value is just the value used for testing and on phantom axes.
// Remember to change this value to one that makes sense for the application.
double userUnits = 1000.0;
AxisUserUnitsSet(axisIndex, userUnits);
// This gets rid of any abnormal configurations the axis previously had.
AxisInterruptEnableSet(axisIndex, false);
// Set the axis to do nothing when the axis gets an amp fault, hits hardware limits, or gets a position error limit.
enum RSIActionNONE = 0;
AxisAmpFaultActionSet(axisIndex, RSIActionNONE);
AxisHardwareNegLimitActionSet(axisIndex, RSIActionNONE);
AxisHardwareNegLimitTriggerStateSet(axisIndex, true);
AxisHardwarePosLimitActionSet(axisIndex, RSIActionNONE);
AxisHardwarePosLimitTriggerStateSet(axisIndex, true);
AxisErrorLimitActionSet(axisIndex, RSIActionNONE);
// Set the Fine Position Tolerance to a very large value to get the phantom axis to detect that it's done
// moving when it reaches the final position
double finePositionTolerance = 1000000.0;
AxisPositionToleranceFineSet(axisIndex, finePositionTolerance);
// Set the Coarse Position Tolerance to a very large value to get the phantom axis to detect that it's done
// moving when it reaches the final position
double coarsePositionTolerance = 1000000.0;
AxisPositionToleranceCoarseSet(axisIndex, coarsePositionTolerance);
// Set default velocity to a very high number because this is a phantom axis.
double velocity = 100000.0;
AxisDefaultVelocitySet(axisIndex, velocity); // Set the default velocity
// This value is just the value used for testing and on phantom axes.
// Remember to change this value to one that makes sense for the application.
// Set default acceleration to a very high value because this is a phantom axis.
double acceleration = 1000000.0;
AxisDefaultAccelerationSet(axisIndex, acceleration);
AxisDefaultDecelerationSet(axisIndex, acceleration);
double jerkPercent = 50.0;
AxisDefaultJerkPercentSet(axisIndex, jerkPercent);
}

Preparing an axis for motion:

void PrepareAxisForMotion(uint32 axisIndex)
{
// Prepare the axis for motion
AxisAbort(axisIndex); // Stop whatever the axis was doing.
AxisClearFaults(axisIndex); // Clear any faults the axis had.
AxisPositionSet(axisIndex, 0); // Set the current position to 0.
AxisCommandPositionSet(axisIndex, 0); // Set command position to 0.
AxisCommandPositionDirectSet(axisIndex, 0);
AxisMotionCamRepeatStop(axisIndex);
AxisGearingDisable(axisIndex); // Reset gearing.
AxisAmpEnableSet(axisIndex, true); // Enable the axis.
}


🌐 Subsections

Topics

 Axis Analog Jogging
 Learn how to jog an axis with RapidScript.
 
 Hello Sequencer
 A brief demonstration of how to interact with various RapidCode objects in RapidScript.
 
 Loop Timing
 Executes a specified number of loops and prints out both the total execution time and the average execution time of each loop.
 
 Motion: MoveSCurve
 Learn how to configure use the MoveSCurve function in RapidScript.