Use Relative Motion to move an axis a specified distance from its current position, providing flexibility to adjust position based on current location rather than a fixed point.
🔹 What is Relative Motion?
A Relative Motion is a motion that allows you to move to a specified distance from the current position.
🔹 Why use Relative Motion?
Relative motion allows you to move an axis a specified distance from its current position. This differs from an absolute motion in that a call to MoveSCurve(10) (an absolute move) will move the axis to position 10, while a call to MoveRelative(10) will move the axis to a position 10 units greater than the current position. For more information on Absolute Motion, visit our Absolute Motion topic page.
Example 1
A RELATIVE MOVE will move the axis 25 units ahead of the current position, rather than to position 25.
An ABSOLUTE MOVE will move the axis to position 25 rather than 25 units ahead of the current position.
- Note
- Relative motion always executes a SCurve motion profile. For more information on SCurve motion, visit our SCurve Motion topic page
📜 Sample Code
- C#
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;
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);
- C++
const int NUM_AXES = 1;
const int AXIS_INDEX = 0;
const double POSITION_0 = 0;
const double POSITION_1 = 0.5;
const double VELOCITY = 1;
const double ACCELERATION = 10;
const double DECELERATION = 10;
const double JERK_PERCENT = 50;
const double FINAL_VELOCITY = 0.5;
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);
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);
std::cout << "Motion Complete\n" << std::endl;