APIs, concepts, guides, and more
axis-motion-streaming-pvt.cs
Note
See Motion: Streaming 📜 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.
/* Demonstrates PVT (Position-Velocity-Time) streaming motion.
PVT motion requires position, velocity, and time arrays.
The controller calculates acceleration for each segment.
*/
using RSI.RapidCode; // RSI.RapidCode.dotNET;
Console.WriteLine("📜 Axis Streaming Motion: PVT");
// get rmp objects
try
{
Helpers.CheckErrors(controller);
// get axis
Axis axis = controller.AxisGet(Constants.AXIS_0_INDEX);
Helpers.CheckErrors(axis);
// configure phantom axis
Helpers.PhantomAxisReset(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[] velocities = [12.0, 10.0, 6.0]; // velocities for each position
double[] times = [0.1, 0.2, 0.1]; // time deltas (acceleration calculated by RMP)
axis.AmpEnableSet(true);
axis.MovePVT(positions, // positions to reach
velocities, // velocities for each position
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 MovePVT call (true = final point, false = more points expected)
axis.MotionDoneWait(); // wait for motion to complete
Console.WriteLine($"Final position: {axis.CommandPositionGet()}");
// cleanup
Helpers.AbortMotionObject(axis);
}
// 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
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
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 MovePVT(const double *const position, const double *const velocity, const double *const time, int32_t pointCount, int32_t emptyCount, bool retain, bool final)
Move commanded by list of positions, velocities, and times.
Helpers namespace provides utility functions for common tasks in RMP applications.
Definition helpers.h:21