The RMP Motion Controller APIs
MotionModify.cs
using NUnit.Framework;
using System;
using System.Threading;
[TestFixture]
[Category("Software")]
class MotionModify : SampleAppTestBase
{
[Test] // Timeout(Constants.MAX_TEST_TIME)
public void FeedRate()
{
Console.WriteLine("Start Motion");
axis.MoveSCurve(100); // Call MoveScurve to move to a position.
// set feedrate for axis to 150%
axis.FeedRateSet(1.5);
while (axis.CommandPositionGet() < 5)
{
Thread.Sleep(1); // Wait here until we reach position "15".
}
axis.Stop(); // Stop the axis/motor.
axis.MotionDoneWait(); // Wait for move to complete.
axis.FeedRateSet(-1); // Change FeedRate to reverse motion.
axis.Resume(); // Start Reverse Motion.
Console.WriteLine("New Feed Rate Start");
axis.FeedRateSet(1); //restore default
}
public void ChangeMotionSpeed()
{
axis.MoveSCurve(20, Constants.VELOCITY, Constants.ACCELERATION, Constants.DECELERATION, Constants.JERK_PERCENT);
if (axis.CommandPositionGet() > 2)
{
// Go 10X faster
axis.MoveSCurve(20, Constants.VELOCITY * 10, Constants.ACCELERATION, Constants.DECELERATION, Constants.JERK_PERCENT);
}
}
}
double CommandPositionGet()
Get the current command position.
void MoveSCurve(double position, double vel, double accel, double decel, double jerkPct)
Command a point-to-point S-Curve motion.
int32_t MotionDoneWait()
Waits for a move to complete.
void Resume()
Resume an axis.
void FeedRateSet(double rate)
Set the feed rate for an Axis.