APIs, concepts, guides, and more
Motion: Modify

Learn how to modify motion in-flight in C#.

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:


📜 Feed Rate

Learn how to use Feed Rate 📖 to adjust motion speed in-flight. Shows how to increase speed, stop, reverse motion, and resume without changing controller state.

axis.AmpEnableSet(true);
// start motion
axis.MoveSCurve(POSITION);
Console.WriteLine($"\tPosition commanded: {POSITION}");
// set feedrate to 150%
axis.FeedRateSet(1.5);
// wait here until we reach position 10
while (axis.CommandPositionGet() < 5)
Thread.Sleep(10);
// stop motion
axis.Stop();
axis.MotionDoneWait();
Console.WriteLine($"\tPosition after FeedRate (1.5): {axis.CommandPositionGet()}");
// set feedrate to reverse motion (-100%)
axis.FeedRateSet(-1);
// resume motion for a bit
axis.Resume();
Thread.Sleep(500);
Console.WriteLine($"\tPosition after FeedRate (-1): {axis.CommandPositionGet()}");
// restore feedrate (100%)
axis.FeedRateSet(1);
// wait for motion done
axis.MotionDoneWait();
Console.WriteLine($"\tPosition after FeedRate (1): {axis.CommandPositionGet()} (expected: {POSITION})");

Source: axis-motion-modify.cs


📜 Change Motion Speed

Learn how to change the velocity parameter of a motion that is partially complete. Demonstrates issuing a new move command mid-motion to change speed on the fly.

axis.AmpEnableSet(true);
// start motion
axis.MoveSCurve(POSITION, VELOCITY, ACCELERATION, DECELERATION, JERK_PERCENT);
// wait until position > 5
while (axis.CommandPositionGet() < 5)
Thread.Sleep(10);
// modify motion to go 10x faster
axis.MoveSCurve(POSITION, VELOCITY * 10, ACCELERATION, DECELERATION, JERK_PERCENT);
// wait for motion done

Source: axis-motion-modify.cs