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;
public const double VELOCITY = 200;
public const double ACCELERATION = 100;
public const double DECELERATION = 100;
public const double JERK_PERCENT = 50;
📜 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);
Learn more in the concept page.
📜 SCurve Motion
This sample code moves a single axis in an SCurve profile to an absolute position.
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);
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;
Constants.VELOCITY,
Constants.ACCELERATION,
Constants.DECELERATION,
Constants.JERK_PERCENT,
finalVelocity);
Learn more in the concept page.
📜 Move Velocity
This sample code moves a single axis at a specified velocity.
axis.
MoveVelocity(Constants.VELOCITY, Constants.ACCELERATION);
Learn more in the concept page.