The RMP Motion Controller APIs
RapidScript

Learn to run a RapidScript program using the C# RapidSequencer API. More...

Description

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

To create an application using our RapidScript language you will need to use our RapidSetup Tool. The tool contains an IDE (Integrated Development Environment) so you can write, debug, and run code.

RapidSequencer IDE


✨ Product Overview

Check out our Product Page to get a quick overview about RapidSequencer.

📖 Docs

Explore our Docs to learn how to use our RapidScript language.

🏃 Running a Sample App

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. 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.

Below is an example of creating a RapidSequencer instance and running a RapidScript file using the RapidSequencer C# API. Replace the following with the correct values for the system:
  1. _platform: An enum specifying which platform to create the sequencer on (Windows or INtime).
  2. _nodeName: The string name of the INtime node to run the sequencer on (if platform is INtime).
  3. _rmpNodeName: The string name of the INtime node RMP is running on.
  4. workingDir: The path to the directory where the RapidSequencer executable is (as a string).
  5. port: The port number the RapidSequencer will listen for requests on.
  6. "RapidSequencer": The "friendly" name to assign to the RapidSequencer process (as a string).
  7. fileNameString: The name of the file to run (as a string). For sample apps, set this to the name of the sample app, such as "MoveSCurve.sq".
  8. entryPoint: The function in the sequencer file to run (as a string). Common practice (and the default value) is to run the "main" function.

RSI.RapidSequencer.RapidSequencer sequencer = RSI.RapidSequencer.RapidSequencerFactory.Create(_platform, _nodeName, _rmpNodeName, workingDir, port, "RapidSequencer");
string rmpPath = TestContext.CurrentContext.TestDirectory;
sequencer.EngineStart(_rmpNodeName, rmpPath);
string entryPoint = "main";
sequencer.Compile(samplesDirectory + fileNameString, entryPoint);
string taskId = sequencer.Run();
string output = sequencer.TaskOutputGet(taskId);


🛠️ 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. 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

Modules

 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.
 
RSI::RapidSequencer.RapidSequencerFactory.Create
static RapidSequencer Create(Platform platform, string sequencerNodeName, string rmpNodeName, string executablePath, int grpcPort=DEFAULT_GRPC_PORT, string friendlyName="RapidServer", ulong timeoutMs=DEFAULT_TIMEOUT_MS, int discoveryPort=DEFAULT_DISCOVER_PORT)
Creates a RapidSequencer process on the given platform at the specified port if one does not already ...
Definition: RapidSequencer.cs:630
RSI::RapidSequencer
RSI
RSI::RapidSequencer.RapidSequencerFactory
The RapidSequencerFactory provides static methods for creating RapidSequencer processes or discoverin...
Definition: RapidSequencer.cs:562
RSI::RapidSequencer.RapidSequencer
An object for interacting with a RapidSequencer process.
Definition: RapidSequencer.cs:64
RSI::RapidSequencer.RapidSequencer.EngineStart
void EngineStart(string rmpNode="NodeA", string rmpPath="")
Starts the runtime of the RapidSequencer process.
Definition: RapidSequencer.cs:252