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