APIs, concepts, guides, and more
axis-motion-streaming-pt.cs
/* Demonstrates PT (Position-Time) streaming motion.
PT motion is the simplest streaming motion requiring only position and time arrays.
The controller calculates velocity and acceleration for each segment.
*/
using RSI.RapidCode; // RSI.RapidCode.dotNET;
Console.WriteLine("📜 Axis Streaming Motion: PT");
// get rmp objects
try
{
Helpers.CheckErrors(controller);
Axis axis = controller.AxisGet(Constants.AXIS_0_INDEX);
// configure phantom axis
int points = 3; // total number of streamed points
int emptyCount = 2; // e-stop generated if there are this number or fewer frames loaded
double[] positions = [1.0, 0.5, 0.75]; // positions to reach
double[] times = [0.2, 0.3, 0.1]; // time deltas for each position (velocity and acceleration calculated by RMP)
axis.AmpEnableSet(true);
axis.MovePT(RSIMotionType.RSIMotionTypePT, // type of PT motion (RSIMotionTypePT, RSIMotionTypeBSPLINE, RSIMotionTypeBSPLINE2)
positions, // positions to reach
times, // time deltas
points, // total number of points
emptyCount, // minimum frames before e-stop
false, // whether points are kept
true); // if this is the last MovePT call (true = final point, false = more points expected)
axis.MotionDoneWait(); // wait for motion to complete
Console.WriteLine($"Final position: {axis.CommandPositionGet()}");
// cleanup
}
// handle errors as needed
finally
{
controller.Delete(); // dispose
}
static void AbortMotionObject(RapidCodeMotion motionObject)
Aborts motion on the given RapidCodeMotion object (Axis or MultiAxis), waits for motion to stop,...
Definition _helpers.cs:186
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
static void PhantomAxisReset(Axis phantomAxis)
Configures a phantom axis on the controller.
Definition _helpers.cs:144
Helpers class provides static methods for common tasks in RMP applications.
Definition _helpers.cs:5
Represents a single axis of motion control. This class provides an interface for commanding motion,...
Definition rsi.h:5862
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.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
Definition rsi.h:800
int32_t MotionDoneWait()
Waits for a move to complete.
int32_t AmpEnableSet(bool enable, int32_t ampActiveTimeoutMilliseconds=AmpEnableTimeoutMillisecondsDefault, bool overrideRestrictedState=false)
Enable all amplifiers.
void MovePT(RSIMotionType type, const double *const position, const double *const time, int32_t pointCount, int32_t emptyCount, bool retain, bool final)
A move commanded by a list of position and time points.
RSIMotionType
PT and PVT streaming motion types.
Definition rsienums.h:1038