几何尺寸与公差论坛

 找回密码
 注册
查看: 406|回复: 0

what difference between GetVelocity and GetRVelocity?

[复制链接]
发表于 2023-2-27 15:12:28 | 显示全部楼层 |阅读模式
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.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-22 01:34 , Processed in 0.035292 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表