|
The GetVelocity() and GetRVelocity() methods in the ACS.SPiiPlusNET library are used to retrieve the current velocity of an axis, but they return the velocity value in different units.
The GetVelocity() method retrieves the current velocity of an axis in internal velocity units, which are typically encoder counts per second or motor revolutions per minute. This velocity value is useful when working with motion control algorithms that require precise control over the axis velocity and acceleration.
The GetRVelocity() method, on the other hand, retrieves the current velocity of an axis in real-world units, such as mm/s or m/s. This velocity value is more useful when working with applications that require knowledge of the actual speed of the axis in real-world units, such as when monitoring the velocity of a moving stage in a manufacturing process.
Here is an example code snippet that demonstrates the difference between GetVelocity() and GetRVelocity():
csharp
Copy code
// Create a new instance of the SPiiPlusNET class
SPiiPlusNET spiiplus = new SPiiPlusNET();
// Connect to the SPiiPlus controller
spiiplus.Connect("192.168.0.1");
// Get the current velocity of axis 1 in internal velocity units
double velocityCountsPerSec = spiiplus.GetVelocity(Axis.Axis1);
// Get the current velocity of axis 1 in mm/s
double velocityMmPerSec = spiiplus.GetRVelocity(Axis.Axis1) * spiiplus.AxisSettingsGet(Axis.Axis1).UserUnitToCountRatio;
// Disconnect from the SPiiPlus controller
spiiplus.Disconnect();
In this example, we first create a new instance of the SPiiPlusNET class and connect to the SPiiPlus controller using its IP address. We then use the GetVelocity() method to retrieve the current velocity of axis 1 in internal velocity units, and store the result in the velocityCountsPerSec variable. We then use the GetRVelocity() method to retrieve the current velocity of axis 1 in real-world units, and convert the result into mm/s by multiplying it by the user-defined unit-to-count ratio for the axis, and store the result in the velocityMmPerSec variable. Finally, we disconnect from the SPiiPlus controller using the Disconnect() method. |
|