MotionFinalVelocity.cs
Perform a point-to-point motion which finishes at a non-zero velocity.
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using RSI.RapidCode.SynqNet.dotNET;
using RSI.RapidCode.SynqNet.dotNET.Enums;
namespace SampleApplications
{
[TestFixture]
public class MotionFinalVelocity
{
const int X = 1;
const double maxVelocity = 100.0;
const double accel = 1000.0;
const double finalVelocity = 10.0;
const double jerkPercent = 10.0;
const double relativeIncrement = 200.0;
[Test]
public void Main()
{
try
{
MotionController controller = MotionController.Create();
Axis x = controller.AxisGet(X);
x.ClearFaults();
x.AmpEnableSet(true);
x.MoveRelative(relativeIncrement, maxVelocity, accel, accel, jerkPercent, finalVelocity);
while (!(x.StatusBitGet(RSIEventType.RSIEventTypeMOTION_AT_VELOCITY)))
{
Console.WriteLine("Pos: " + x.CommandPositionGet() + " Vel: " + x.CommandVelocityGet());
if (x.StateGet() == RSIState.RSIStateERROR)
{
break;
}
controller.OS.Sleep(100);
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
}