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

Learn how to perform various types of 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.


In this page:


📜 Motion: Point-to-Point

Learn how to perform point-to-point motion including absolute moves, relative moves, S-curve motion, and velocity motion with Final Velocity Motion 📖 .

// *NOTICE* The following constants must be configured before attempting to run with hardware.
const int NUM_AXES = 1; // the number of axes to configure
const int AXIS_INDEX = 0; // the index of the axis to configure
// motion Parameters
const double POSITION_0 = 0; // specify the start position
const double POSITION_1 = 0.5; // specify the position to move to
const double VELOCITY = 1; // specify your velocity - units: UserUnits/Sec
const double ACCELERATION = 10; // specify your acceleration - units: UserUnits/Sec^2
const double DECELERATION = 10; // specify your deceleration - units: UserUnits/Sec^2
const double JERK_PERCENT = 50; // specify your jerk percent (0.0 to 100.0)
const double FINAL_VELOCITY = 0.5; // specify your final velocity - units: UserUnits/Sec

Source: point-to-point.cpp


📜 Absolute Motion

Demonstrates how to perform absolute trapezoidal motion moves.

std::cout << "Absolute (Trapezoidal) Motion:" << std::endl;
std::cout << "Moving to position: " << POSITION_1 << std::endl;
axis->MoveTrapezoidal(POSITION_1, VELOCITY, ACCELERATION, DECELERATION);
axis->MotionDoneWait(TIMEOUT);
std::cout << "Motion Complete" << std::endl;
std::cout << "Moving back to position: " << POSITION_0 << std::endl;
axis->MoveTrapezoidal(POSITION_0, VELOCITY, ACCELERATION, DECELERATION);
axis->MotionDoneWait(TIMEOUT);
std::cout << "Motion Complete\n" << std::endl;


📜 Relative Motion

Demonstrates how to perform relative motion moves with S-curve profiles.

std::cout << "Relative Motion:" << std::endl;
std::cout << "Moving to position: " << POSITION_1 << std::endl;
axis->MoveRelative(POSITION_1 - POSITION_0, VELOCITY, ACCELERATION, DECELERATION, JERK_PERCENT);
axis->MotionDoneWait(TIMEOUT);
std::cout << "Motion Complete" << std::endl;
std::cout << "Moving back to position: " << POSITION_0 << std::endl;
axis->MoveRelative(POSITION_0 - POSITION_1, VELOCITY, ACCELERATION, DECELERATION, JERK_PERCENT);
axis->MotionDoneWait(TIMEOUT);
std::cout << "Motion Complete\n" << std::endl;


📜 S-Curve Motion

Demonstrates how to perform S-curve motion using default motion parameters.

std::cout << "SCurve Motion:" << std::endl;
std::cout << "Moving to position: " << POSITION_1 << std::endl;
axis->MoveSCurve(POSITION_1);
axis->MotionDoneWait(TIMEOUT);
std::cout << "Motion Complete" << std::endl;
std::cout << "Moving back to position: " << POSITION_0 << std::endl;
axis->MoveSCurve(POSITION_0);
axis->MotionDoneWait(TIMEOUT);
std::cout << "Motion Complete\n" << std::endl;


📜 S-Curve Motion with Final Velocity

Demonstrates how to perform S-curve motion with a specified final velocity.

std::cout << "SCurve Motion with Final Velocity:" << std::endl;
std::cout << "Moving to position: " << POSITION_1 << std::endl;
std::cout << "Final Velocity: " << FINAL_VELOCITY << std::endl;
axis->MoveSCurve(POSITION_1, VELOCITY, ACCELERATION, DECELERATION, JERK_PERCENT, FINAL_VELOCITY);
HelperAtVelocityWait(controller, axis, TIMEOUT);
std::cout << "Motion Complete" << std::endl;
std::cout << "Moving back to position: " << POSITION_0 << std::endl;
std::cout << "Final Velocity: " << 0 << std::endl;
axis->MoveSCurve(POSITION_0, VELOCITY, ACCELERATION, DECELERATION, JERK_PERCENT, 0);
axis->MotionDoneWait(TIMEOUT);
std::cout << "Motion Complete\n" << std::endl;


📜 Velocity Move

Demonstrates how to perform velocity moves to accelerate and decelerate to target velocities.

std::cout << "Velocity Move:" << std::endl;
std::cout << "Accelerating to velocity: " << VELOCITY << std::endl;
axis->MoveVelocity(VELOCITY, ACCELERATION);
HelperAtVelocityWait(controller, axis, TIMEOUT);
std::cout << "Motion Complete" << std::endl;
std::cout << "Decelerating to velocity: " << 0 << std::endl;
axis->MoveVelocity(0, DECELERATION);
HelperAtVelocityWait(controller, axis, TIMEOUT);
std::cout << "Motion Complete" << std::endl;