The RMP Motion Controller APIs
MotionModify.cs
1
29using NUnit.Framework;
30using System;
31using System.Threading;
32
34[TestFixture]
35[Category("Software")]
36class MotionModify : SampleAppTestBase
37{
38 [Test] // Timeout(Constants.MAX_TEST_TIME)
39 public void FeedRate()
40 {
42 Console.WriteLine("Start Motion");
43 axis.MoveSCurve(100); // Call MoveScurve to move to a position.
44 // set feedrate for axis to 150%
45 axis.FeedRateSet(1.5);
46 while (axis.CommandPositionGet() < 5)
47 {
48 Thread.Sleep(1); // Wait here until we reach position "15".
49 }
50
51 axis.Stop(); // Stop the axis/motor.
52 axis.MotionDoneWait(); // Wait for move to complete.
53 axis.FeedRateSet(-1); // Change FeedRate to reverse motion.
54 axis.Resume(); // Start Reverse Motion.
55
56 Console.WriteLine("New Feed Rate Start");
57
58 axis.FeedRateSet(1); //restore default
60 }
61
62 public void ChangeMotionSpeed()
63 {
65 axis.MoveSCurve(20, Constants.VELOCITY, Constants.ACCELERATION, Constants.DECELERATION, Constants.JERK_PERCENT);
66
67 if (axis.CommandPositionGet() > 2)
68 {
69 // Go 10X faster
70 axis.MoveSCurve(20, Constants.VELOCITY * 10, Constants.ACCELERATION, Constants.DECELERATION, Constants.JERK_PERCENT);
71 }
73 }
74}
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.