The RMP Motion Controller APIs
Motion: Point-to-Point

Learn how to use our different point-to-point motion commands. More...

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. 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.
Note
The following sample apps use these constants:
public const double POSITION = 2; // Specify the position to travel to.
public const double VELOCITY = 200; // Specify your velocity. - units: UserUnits/Sec
public const double ACCELERATION = 100; // Specify your acceleration. - units: UserUnits/Sec^2
public const double DECELERATION = 100; // Specify your deceleration. - units: UserUnits/Sec^2
public const double JERK_PERCENT = 50; // Specify your jerk percent (0.0 to 100.0)


📜 Absolute Motion
This sample code moves a single axis in trapezoidal profile to an absolute distance set by CONSTANTS.POSITION below. Trapezoidal motion accelerates each axis at the given rate until it reaches the specified velocity. When each axis approaches the specified location, it decelerates at the given rate to a stop. All accelerations and decelerations are constant,

axis.MoveTrapezoidal(Constants.POSITION, Constants.VELOCITY, Constants.ACCELERATION, Constants.DECELERATION);// Command simple trapezoidal motion.
axis.MotionDoneWait();// Wait for motion to be done

Learn more in topic page.


📜 SCurve Motion
This sample code moves a single axis in an SCurve profile to an absolute position.

axis.MoveSCurve(Constants.POSITION); // Command SCurve Motion. This overload willuse default velocity, acceleration, deceleration, jerk values for the axis. See axis config to learn how to set those values.
axis.MotionDoneWait(); // Wait for motion to finish

Learn more in topic page.


📜 Relative Motion
This sample code moves a single axis relative to its current position.

axis.MoveRelative(Constants.POSITION, Constants.VELOCITY, Constants.ACCELERATION, Constants.DECELERATION, Constants.JERK_PERCENT); // Command a relative to the current position
axis.MotionDoneWait(); // Wait for motion to finish. (the motion should take 2.5 seconds)
var cmdPositionAfterMove = axis.CommandPositionGet(); // The command position should be equal to Constants.POSITION
// Move back to the start position by moving negative relative to current position
axis.MoveRelative(-1 * Constants.POSITION, Constants.VELOCITY, Constants.ACCELERATION, Constants.DECELERATION, Constants.JERK_PERCENT);

Learn more in topic page.


📜 Final Velocity
This sample code moves a single axis. Once the motion is complete the axis continues spinning at a specified velocity.

int finalVelocity = 5;
axis.MoveSCurve(Constants.POSITION, // Command an SCurve move with a final velocity of FINAL_VELOCITY.
Constants.VELOCITY,
Constants.ACCELERATION,
Constants.DECELERATION,
Constants.JERK_PERCENT,
finalVelocity); // Once the commanded position has been reached, the motor will begin spinning with a speed of FINAL_VELOCITY, and continue to spin at that velocity until stopped.

Learn more in topic page.


📜 Move Velocity
This sample code moves a single axis at a specified velocity.

axis.MoveVelocity(Constants.VELOCITY, Constants.ACCELERATION);

Learn more in topic page.

RSI::RapidCode::Axis::MoveRelative
void MoveRelative(double relativePosition, double vel, double accel, double decel, double jerkPct)
Command a relative point-to-point S-Curve motion.
RSI::RapidCode::Axis::MoveTrapezoidal
void MoveTrapezoidal(double position, double vel, double accel, double decel)
Point-to-point trapezoidal move.
RSI::RapidCode::Axis::MoveSCurve
void MoveSCurve(double position, double vel, double accel, double decel, double jerkPct)
Command a point-to-point S-Curve motion.
RSI::RapidCode::Axis::CommandPositionGet
double CommandPositionGet()
Get the current command position.
RSI::RapidCode::Axis::MoveVelocity
void MoveVelocity(double velocity)
RSI::RapidCode::RapidCodeMotion::MotionDoneWait
int32_t MotionDoneWait()
Waits for a move to complete.