APIs, concepts, guides, and more
path-setup-gantry.cs
/* 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);
Axis yAxis = controller.AxisGet(Constants.AXIS_1_INDEX);
Axis primeAxis = controller.AxisGet(Constants.AXIS_2_INDEX);
Helpers.CheckErrors(primeAxis);
// configure phantom axes
// 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);
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
}
static void ConfigurePhantomAxis(Axis phantomAxis)
Configures a phantom axis on the controller.
Definition _helpers.cs:144
static void CheckErrors(RapidCodeObject rsiObject)
Checks for errors in the given RapidCodeObject and throws an exception if any non-warning errors are ...
Definition _helpers.cs:15
Helpers class provides static methods for common tasks in RMP applications.
Definition _helpers.cs:5
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:5870
Axis * AxisGet(int32_t axisNumber)
AxisGet returns a pointer to an Axis object and initializes its internals.
static MotionController * Get()
Get an already running RMP EtherCAT controller.
void Delete(void)
Delete the MotionController and all its objects.
MultiAxis * MultiAxisGet(int32_t motionSupervisorNumber)
MultiAxisGet returns a pointer to a MultiAxis object and initializes its internals.
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:10804