APIs, concepts, guides, and more
Motion: Point-to-Point

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

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.
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 the concept 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 the concept 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 the concept 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 the concept page.


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

// Command a velocity move
axis.MoveVelocity(Constants.VELOCITY, Constants.ACCELERATION);

Learn more in the concept page.