Console.WriteLine("📜 Motion: G-Code Units");
try
{
const string xLabel = "X-Axis";
const string yLabel = "Y-Axis";
const string zLabel = "Z-Axis";
const string aLabel = "A-Axis";
const string bLabel = "B-Axis";
const string cLabel = "C-Axis";
MultiAxis jointsMultiAxis = controller.MultiAxisGet(0);
Axis[] axes = [xAxis, yAxis, zAxis, aAxis, bAxis, cAxis];
jointsMultiAxis.
AxesAdd(axes, axes.Length);
const LinearUnits units = LinearUnits.Centimeters;
const string modelName = "RSI_XYZABC_Centimeters";
const double scaling = 1.0;
const double 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.Z) { ExpectedLabel = zLabel, Scaling = scaling, Offset = offset });
builder.JointAdd(new LinearJointMapping(3, CartesianAxis.Roll) { ExpectedLabel = aLabel, Scaling = scaling, Offset = offset });
builder.JointAdd(new LinearJointMapping(4, CartesianAxis.Pitch) { ExpectedLabel = bLabel, Scaling = scaling, Offset = offset });
builder.JointAdd(new LinearJointMapping(5, CartesianAxis.Yaw) { ExpectedLabel = cLabel, Scaling = scaling, Offset = offset });
Console.WriteLine($"Initial G-Code units: {robot.Gcode.UnitsGet()}");
robot.Gcode.AccelerationRateSet(10);
robot.Gcode.FeedRateSet(10);
Console.WriteLine($"Acceleration rate (cm/min²): {robot.Gcode.AccelerationRateGet()}");
Console.WriteLine($"Feed rate (cm/min): {robot.Gcode.FeedRateGet()}");
robot.Gcode.UnitsSet(LinearUnits.Inches);
Console.WriteLine($"G-Code units after setting to inches: {robot.Gcode.UnitsGet()}");
robot.Gcode.AccelerationRateSet(10);
robot.Gcode.FeedRateSet(10);
Console.WriteLine($"Acceleration rate (in/min²): {robot.Gcode.AccelerationRateGet()}");
Console.WriteLine($"Feed rate (in/min): {robot.Gcode.FeedRateGet()}");
Robot.RobotDelete(controller, robot);
}
finally
{
controller.Delete();
}
Constants used in the C# sample apps.
const int AXIS_0_INDEX
Default: 0.
const int AXIS_5_INDEX
Default: 5.
const int AXIS_3_INDEX
Default: 3.
const int AXIS_4_INDEX
Default: 4.
const int AXIS_1_INDEX
Default: 1.
const int AXIS_2_INDEX
Default: 2.
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,...
static constexpr int32_t AxisFrameBufferSizeDefault
The default value of the AxisFrameBufferSize, also the minimum allowable value.
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...
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...
void ClearFaults()
Clear all faults for an Axis or MultiAxis.
Helpers namespace provides utility functions for common tasks in RMP applications.