Learn hot to use streaming motion.
- 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.
- Precondition
- This is a sample assumes you already have a RapidCode MotionController and Axis Object. See the Template.cs or HelperFunctions.cs sample app to see how to set up those objects.
π PT Motion
PT motion is the simplest streaming motion to use because it only requires an array of Positions and Time deltas. The controller is responsible for figuring out the velocity, and acceleration for each motion segment.
int points = 3;
int emptyCount = 2;
double[] positions = { 1.0, 0.5, 0.75 };
double[] times = { 0.2, 0.3, 0.1 };
positions,
times,
points,
emptyCount,
false,
true);
Learn more in the concept page.
π PVT Motion
PVT motion is another Streaming motion. PVT motion is a bit more complicated to use because it requires an array of Positions, Velocities, and Time deltas. The controller is only responsible for figuring out the acceleration for each motion segment.
int points = 3;
int emptyCount = 2;
double[] positions = { 1.0, 0.5, 0.75 };
double[] velocities = { 12.0, 10.0, 6.0 };
double[] times = { 0.1, 0.2, 0.1 };
velocities,
times,
points,
emptyCount,
false,
true);
Learn more in the concept page.
π PVAJT Motion
int points = 3;
int emptyCount = 2;
double[] positions = { 1.0, 0.5, 0.75 };
double[] velocities = { 10.0, 20.0, 40.0 };
double[] accelerations = { 4, 4, 4 };
double[] jerks = { 50, 50, 50 };
double[] times = { 0.4, 0.2, 0.1 };
velocities,
accelerations,
jerks,
times,
points,
emptyCount,
false,
true);
Learn more in the concept page.
π PT Motion While Stopping
This code demonstrates that different actions that you can take after stopping a PT Streaming motion.
const int points = 3;
const int emptyCount = 2;
double[] first = { 0.1, 0.2, 0.3 };
double[] second = { 0.4, 0.5, 0.6 };
double[] third = { 0.7, 0.8, 0.9 };
double[] time1 = { 0.3, 0.3, 0.3 };
double[] time2 = { 0.2, 0.2, 0.2 };
double[] time3 = { 0.25, 0.25, 0.25 };
Learn more in the concept page.
π Single Axis Sync Outputs
This sample application will show you a basic demonstartion on how to set up Sync Outputs, so that you can easily change any IOβs state based on a specified point index (or ElmentID) on your steaming motion.
const int TOTAL_POINTS = 4;
const int EMPTY_CT = -1;
const int OUTPUT_INDEX = 0;
const int NODE_INDEX = 0;
double[] positions = { 1.0, 2.0, 3.0, 4.0 };
double[] times = { 0.5, 0.1, 0.2, 0.4 };
int outputEnableID = 2;
int outputDisableID = 3;
axis.
MovePT(
RSIMotionType.RSIMotionTypePT, positions, times, TOTAL_POINTS, EMPTY_CT,
false,
true);
{
{
Assert.That(output0.
Get(), Is.EqualTo(
true),
"The output should be triggered");
}
else
{
Assert.That(output0.
Get(), Is.EqualTo(
false),
"The output should NOT be triggered");
}
}
Learn more in the concept page.