The RMP Motion Controller APIs

◆ MoveVelocitySCurve()

void MoveVelocitySCurve ( const double *const velocity,
const double *const accel,
const double *const jerkPct )
Description:
MoveVelocitySCurve commands the MultiAxis to a specified target velocity for each Axis.
Parameters
*velocityArray of target velocities (UserUnits/second).
*accelArray of accelerations (UserUnits/second/second).
*jerkPct0.0 to 100.0 - The percentage of acceleration time which is smoothed.
Remarks
This function is also available in RapidSequencer.
Sample Code:
Motion: Multi-Axis
// RapidCode Objects
MultiAxis multi; // Declare what multi is.
// Constants
const int cycles = 2; // Specify how many times you want to update the velocity.
const int NUM_OF_AXES = 6;
controller.AxisCountSet(NUM_OF_AXES);
controller.MotionCountSet(NUM_OF_AXES + 1); // We will need a motion supervisor for every Axis object and MultiAxis object
int i;
double[] accelerations = new double[6] { 1000, 1000, 1000, 1000, 1000, 1000 }; // Specify the acceleration for all 6 axes.
double[] velocities = new double[6]; // Initialize the array that will contain the velocities of all 6 axes.
Random rnd = new Random(); // Initialize the Random object that we will use to generate random velocities.
Axis x_axis = controller.AxisGet(Constants.X_AXIS_NUMBER); // Initialize axis. (You can use RapidSetup to see what axes you are using.)
Axis y_axis = controller.AxisGet(Constants.Y_AXIS_NUMBER); // Initialize axis.
Axis z_axis = controller.AxisGet(Constants.Z_AXIS_NUMBER); // Initialize axis.
Axis a_axis = controller.AxisGet(Constants.A_AXIS_NUMBER); // Initialize axis.
Axis b_axis = controller.AxisGet(Constants.B_AXIS_NUMBER); // Initialize axis.
Axis c_axis = controller.AxisGet(Constants.C_AXIS_NUMBER); // Initialize axis.
HelperFunctions.CheckErrors(x_axis); // Check that the axis has been initialize correctly.
HelperFunctions.CheckErrors(y_axis); // Check that the axis has been initialize correctly.
HelperFunctions.CheckErrors(z_axis); // Check that the axis has been initialize correctly.
HelperFunctions.CheckErrors(a_axis); // Check that the axis has been initialize correctly.
HelperFunctions.CheckErrors(b_axis); // Check that the axis has been initialize correctly.
HelperFunctions.CheckErrors(c_axis); // Check that the axis has been initialize correctly.
multi = controller.MultiAxisGet(NUM_OF_AXES); // Configure your MultiAxis on RapidSetup (Make sure MotionCount is 1 higher than AxisCount)
HelperFunctions.CheckErrors(multi); // Check that multi has been initialized correctly.
multi.AxisRemoveAll(); // If there are any current axes on multi, remove them.
multi.AxisAdd(x_axis); // Add axis to your Multi-Axis controller.
multi.AxisAdd(y_axis); // Add axis to your Multi-Axis controller.
multi.AxisAdd(z_axis); // Add axis to your Multi-Axis controller.
multi.AxisAdd(a_axis); // Add axis to your Multi-Axis controller.
multi.AxisAdd(b_axis); // Add axis to your Multi-Axis controller.
multi.AxisAdd(c_axis); // Add axis to your Multi-Axis controller.
multi.Abort(); // If there is any motion happening, abort it.
multi.ClearFaults(); // Clear faults and enable all axes.
multi.AmpEnableSet(true); // Enable the motor.
for (i = 0; i < cycles; i++) // This loop will iterate 5 times based on the value of "cycles"
{
int random_vel1 = rnd.Next(1, 100); // random_vel1 is a number [ >= 1 and < 100 ]
int random_vel2 = rnd.Next(1, 100);
int random_vel3 = rnd.Next(1, 100);
int random_vel4 = rnd.Next(1, 100);
int random_vel5 = rnd.Next(1, 100);
int random_vel6 = rnd.Next(1, 100);
velocities = new double[6] {random_vel1, // Update axis's velocity.
random_vel2, // Update axis's velocity.
random_vel3, // Update axis's velocity.
random_vel4, // Update axis's velocity.
random_vel5, // Update axis's velocity.
random_vel6 }; // Update axis's velocity.
multi.MoveVelocity(velocities, accelerations); // Move your Multi-Axis. (this will also update the move on the fly)
System.Threading.Thread.Sleep(100); // Sleep for 100ms before iterating again.
}
multi.Abort(); // Stop motion on all axes.
See also
MotionAttributeMaskGet