APIs, concepts, guides, and more
path-setup-gantry.cs
Note
See Motion: Path 📜 for a detailed explanation of this sample code.
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.
/* This sample demonstrates how to set up a kinematic model with a gantry prime axis.
Shows how to configure a 1:1 geared axis system where two physical axes work together
to control the same cartesian coordinate.
*/
using RSI.RapidCode; // RSI.RapidCode.dotNET;
Console.WriteLine("📜 Motion: Path Gantry");
// get rmp objects
try
{
Helpers.CheckErrors(controller);
// set robot axis labels
const string xLabel = "X-Axis";
const string yLabel = "Y-Axis";
const string yPrimeLabel = "Y-Prime";
// get the 3 axis needed for XY_Yp robot
Axis xAxis = controller.AxisGet(Constants.AXIS_0_INDEX);
Helpers.CheckErrors(xAxis);
Axis yAxis = controller.AxisGet(Constants.AXIS_1_INDEX);
Helpers.CheckErrors(yAxis);
Axis primeAxis = controller.AxisGet(Constants.AXIS_2_INDEX);
Helpers.CheckErrors(primeAxis);
// configure phantom axes
Helpers.PhantomAxisReset(xAxis);
Helpers.PhantomAxisReset(yAxis);
Helpers.PhantomAxisReset(primeAxis);
// set the expected labels for each axis
xAxis.UserLabelSet(xLabel);
yAxis.UserLabelSet(yLabel);
primeAxis.UserLabelSet(yPrimeLabel);
// the joint index of each axis is the index within the MultiAxis object
// "X-Axis" has joint index 0
// "Y-Axis" has joint index 1
// "Y-Prime" has joint index 2
MultiAxis jointsMultiAxis = controller.MultiAxisGet(0);
Axis[] axes = [xAxis, yAxis, primeAxis];
jointsMultiAxis.AxesAdd(axes, axes.Length);
const LinearUnits units = LinearUnits.Millimeters;
const string modelName = "RSI_XY_Yp";
const double scaling = 1.0, offset = 0.0;
LinearModelBuilder builder = new(modelName);
builder.UnitsSet(units);
builder.JointAdd(new LinearJointMapping(0, CartesianAxis.X) { ExpectedLabel = xLabel, Scaling = scaling, Offset = offset });
builder.JointAdd(new LinearJointMapping(1, CartesianAxis.Y) { ExpectedLabel = yLabel, Scaling = scaling, Offset = offset });
builder.JointAdd(new LinearJointMapping(2, CartesianAxis.Y) { ExpectedLabel = yPrimeLabel, Scaling = scaling, Offset = offset });
// create Robot object where the y and y prime will be geared 1:1
const int motionFrameBufferSize = 50; // this is the minimum valid motion frame buffer size
Robot robot = Robot.RobotCreate(controller, jointsMultiAxis, builder, motionFrameBufferSize);
Helpers.CheckErrors(robot);
Console.WriteLine($"Model name: {robot.ModelGet().NameGet()}");
Console.WriteLine($"Model units: {robot.ModelGet().UnitsGet()}");
Console.WriteLine("Gantry configuration: Y-axis and Y-Prime axis are geared 1:1");
// cleanup
Robot.RobotDelete(controller, robot);
}
// handle errors as needed
finally
{
controller.Delete(); // dispose
}
Constants used in the C# sample apps.
Definition _constants.cs:3
const int AXIS_0_INDEX
Default: 0.
Definition _constants.cs:11
const int AXIS_1_INDEX
Default: 1.
Definition _constants.cs:12
const int AXIS_2_INDEX
Default: 2.
Definition _constants.cs:13
void UserLabelSet(const char *const userLabel)
Set the axis User defined Label.
Represents a single axis of motion control. This class provides an interface for commanding motion,...
Definition rsi.h:5863
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 AxesAdd(Axis **axes, int32_t axisCount)
Represents multiple axes of motion control, allows you to map two or more Axis objects together for e...
Definition rsi.h:10795
Helpers namespace provides utility functions for common tasks in RMP applications.
Definition helpers.h:21