机器视觉与图像处理
多功能和易用运动控制框架
支持图像模板深度学习

第六节 功能类函数

6.1 Camera

相机类对相机进行操作如打开,关闭,采集图像,设置参数等。

启动相机常量

<>td实时采集图像方式运行相机
常量 说明
TRIG_NONE
TRIG_SOFT 软触发采集图像方式运行相机
TRIG_WIRE 硬触发方式运行相机

函数说明

IsCamValid

声明 bool IsCamValid()
说明 判断相机是否可用
参数
返回值 true 或 false

GetCurIndex

声明 int GetCurIndex()
说明 获取相机索引。当前相机在操作系统中显示的索引
参数
返回值 整数

GetDeviceCount

声明 int GetDeviceCount()
说明 当前系统中在线的相机数量
参数
返回值 整数

GetDeviceName

声明 string GetDeviceName(int index)
说明 获取相机名称
参数 index - 相机索引
返回值 文本

GetHandle

声明 IntPtr GetHandle()
说明 获取相机句柄
参数
返回值 句柄

Create

声明 bool Create(string strModel)
说明 创建相机对象。
参数 strModel - 相机模型。一般不同厂家相机模型不一样
返回值 true 或 false

Destroy

声明 void Destroy()
说明 销毁相机对象。
参数
返回值

Start

声明 bool Start(int nTriggerType)
说明 启动相机进行采图
参数 nTriggerType - 触发类型。TRIG_NONE、TRIG_SOFT、TRIG_WIRE 之一。
返回值 true 或 false

Stop

tr <>
声明 void Stop()
说明 停止相机进行采图
参数
返回值

IsStarted

声明 bool IsStarted()
说明 判断相机是否已经启动
参数
返回值 true 或 false

OpenE1

声明 bool OpenE1(string strName)
说明 根据名称打开相机
参数 strName - 相机名称
返回值 true 或 false

Open

声明 bool Open(int index)
说明 根据索引打开相机
参数 index- 相机索引
返回值 true 或 false

Reopen

声明 bool Reopen()
说明 重新打开相机
参数
返回值 true 或 false

Close

声明 void Close()
说明 关闭相机
参数
返回值

Close1

声明 void Close1(bool bThrough)
说明 关闭相机
参数 bThrough - 是否彻底关闭,不在允许打开。
返回值

IsOpened

声明 bool IsOpened()
说明 判断相机是否已经打开。
参数
返回值 true 或 false

Trigger

声明 bool Trigger(int timeout)
说明 进行软触发一次。
参数 timeout - 超时
返回值 true 或 false

FetchImage

声明 bool FetchImage(IntPtr hlmage, int timeout)
说明 获取一帧图像
参数 hlmage - 图像对象
timeout - 超时
返回值 true 或 false

GetDepth

声明 bool GetDepth(out int pValue)
说明 获取图像像素值深度
参数 pValue - 返回的像素深度值
返回值 true 或 false

GetWidth

声明 bool GetWidth(out int pValue)
说明 获取图像宽度
参数 pValue - 返回的图像宽度
返回值 true 或 false

GetHeight

声明 bool GetHeight(out int pValue)
说明 获取图像高度
参数 pValue - 返回的图像高度
返回值 true 或 false

SetFrameArrivalCallback

声明 void SetFrameArrivalCallback(FrameArrivalDelegate pfnFrameArrival, IntPtr pUserData)
说明 获取图像高度
参数 pfnFrameArrival - 图像到达代理函数。
IntPtr pUserData - 用户数据句柄
返回值
备注 代理函数声明如下:
public delegate void FrameArrivalDelegate(IntPtr hCamera, IntPtr pData, UInt64 size, IntPtr pUserData)

GetFrameArrivalUserData

声明 IntPtr GetFrameArrivalUserData()
说明 获取图像张到达代理函数的用户数据句柄
参数
返回值 句柄

GetTriggerType

声明 int GetTriggerType()
说明 获取相机启动采图时图像触发类型
参数
返回值 触发类型。TRIG_NONE, TRIG_SOFT, TRIG_WIRE 之一

SetParam

声明 bool SetParam(string strName, int value)
说明 设置相机参数值。
参数 strName - 参数名称
value - 参数值
返回值 true 或 false

GetParam

声明 bool GetParam(string strName, out int pValue)
说明 获取相机参数值。
参数 strName - 参数名称
pValue - 参数值 [OUT]
返回值 true 或 false

GetParamMax

声明 bool GetParamMax(string strName, out int pValue)
说明 获取相机参数允许设置的最大值.
参数 strName - 参数名称
pValue - 参数值 [OUT]
返回值 true 或 false

GetParamMin

声明 bool GetParamMin(string strName, out int pValue)
说明 获取相机参数允许设置的最小值.
参数 strName - 参数名称
pValue - 参数值 [OUT]
返回值 true 或 false

SetRoi

声明 bool SetRoi(int offsetx, int offsety, int width, int height)
说明 获取相机子窗口区域.
参数 offsetx - 水平坐标
offsety - 垂直坐标
width - 宽度
height - 高度
返回值 true 或 false

AutoBalanceWhite

声明 bool AutoBalanceWhite()
说明 对相机进行白平衡
参数
返回值 true 或 false

Create (RealView)

声明 bool Create(IntPtr hParent, string strName, int left, int top, int width, int height)
说明 创建类对象
参数 hParent - 父窗口句柄
strName - 名称
Left - 窗口区域左上角 x 坐标
top - 窗口区域左上角 y 坐标
Width - 窗口宽度
Height - 窗口高度
返回值 true 或 false

Destroy (RealView)

声明 void Destroy()
说明 销毁类对象
参数
返回值

GetHandle (RealView)

声明 IntPtr GetHandle()
说明 获取对象句柄
参数
返回值 句柄

FromHandle

声明 void FromHandle(IntPtr h)
说明 引用句柄对象
参数 h - 其它实例对象句柄
返回值

Refresh

声明 void Refresh(int type)
说明 刷新窗口显示内容
参数 type - 刷新类型
返回值

SetSightFormat

声明 bool SetSightFormat(int imageType, int width, int height, bool bRedraw)
说明 设置对象画布格式
参数 imageType - 图像类型 (二值图,灰度图,RGB 图,RGBA 图)
width - 图像宽度
height - 图像高度
bRedraw - 是否重画
返回值 true 或 false

GetImageType

声明 int GetImageType()
说明 获取对象画布图像类型
参数
返回值 图像类型

GetlmageWidth

声明 int GetlmageWidth()
说明 获取对象画布图像宽度
参数
返回值 图像宽度

GetlmageHeight

声明 int GetlmageHeight()
说明 获取对象画布图像高度
参数
返回值 图像高度

SetDisplayRect

声明 void SetDisplayRect(int left, int top, int width, int height, bool refresh)
说明 设置显示区大小和位置
参数 left - 左上角水平坐标
top - 左上角垂直坐标
width - 宽度
height - 高度
refresh - 是否重画
返回值

SetUserCursorType

声明 void SetUserCursorType(int cursorType, bool refresh)
说明 设置窗口游标类型
参数 cursorType - 游标类型
refresh - 是否重画
返回值

GetUserCursorType

声明 int GetUserCursorType()
说明 获取窗口游标类型
参数
返回值 游标类型

SetUserCursorSize

声明 void SetUserCursorSize(GSize size, bool refresh)
说明 设置窗口游标大小
参数 size - 游标尺寸
refresh - 是否重画
返回值

GetUserCursorSize

声明 GSize GetUserCursorSize()
说明 获取窗口游标大小
参数
返回值 游标尺寸

SetUserCursorTransparence

声明 void SetUserCursorTransparence(int ratio, bool refresh)
说明 设置窗口游标透明度
参数 ratio - 透明度
refresh - 是否重画
返回值

GetUserCursorTransparence

声明 int GetUserCursorTransparence()
说明 获取窗口游标透明度
参数
返回值 透明度

SetUserCursorColor

声明 void SetUserCursorColor(GRgb color, bool refresh)
说明 设置窗口游标颜色
参数 color - 颜色
refresh - 是否重画
返回值

GetUserCursorColor

声明 GRgb GetUserCursorColor()
说明 获取窗口游标颜色
参数
返回值 颜色

GetUserCursorLineType

声明 int GetUserCursorLineType()
说明 获取游标线条类型
参数
返回值 游标线条类型

SetUserCursorThickness

声明 void SetUserCursorThickness(int thickness, bool refresh)
说明 设置窗口游标线条宽度
参数 thickness - 宽度
refresh - 是否重画
返回值

GetUserCursorThickness

声明 int GetUserCursorThickness()
说明 获取窗口游标线条宽度
参数
返回值 游标线条宽度

SetUserCursorImage

声明 void SetUserCursorImage(IntPtr image, bool refresh)
说明 设置窗口游标图像句柄
参数 image - 图像对象句柄
refresh - 是否重绘窗口
返回值

SetPixelBarFontSize

声明 void SetPixelBarFontSize(int size, bool refresh)
说明 设置画布图像素信息栏字体大小
参数 size - 字体大小,单位:像素
refresh - 是否重绘窗口
返回值

GetPixelBarFontSize

声明 int GetPixelBarFontSize()
说明 获取画布图像素信息栏字体大小
参数
返回值 字体大小,单位:像素

SetPixelBarTransparence

声明 void SetPixelBarTransparence(int ratio, bool refresh)
说明 设置画布图像素信息栏透明度
参数 ratio - 透明度,0-100
refresh - 是否重绘窗口
返回值

GetPixelBarTransparence

声明 int GetPixelBarTransparence()
说明 获取画布图像素信息栏透明度
参数
返回值 透明度

SetPixelBarColor

声明 void SetPixelBarColor(GRgb color, bool refresh)
说明 设置画布图像素信息栏颜色
参数 color - 颜色
refresh - 是否重绘窗口
返回值

GetPixelBarColor

声明 GRgb GetPixelBarColor()
说明 获取画布图像素信息栏颜色
参数
返回值 颜色

SetPixelBarVisible

声明 void SetPixelBarVisible(bool flag, bool refresh)
说明 设置画布图像素信息栏可见
参数 flag - 是否可见
refresh - 是否重绘窗口
返回值

IsPixelBarVisible

声明 bool IsPixelBarVisible()
说明 画布图像素信息栏是否可见
参数
返回值 true 或 false

SetPixelBarText

声明 void SetPixelBarText(string strText, bool refresh)
说明 设置画布图像素信息栏文字
参数 strText - 文字
refresh - 是否重绘窗口
返回值

GetRedrawType

声明 int GetRedrawType()
说明 获取对象窗口重绘类型
参数
返回值 类型

SetRedrawType

声明 void SetRedrawType(int type, int rate)
说明 设置对象窗口重绘类型
参数 type - 绘制类型
rate - 重绘频率
返回值

Feedlmage

声明 void Feedlmage(IntPtr hlmage, bool bRedraw)
说明 将图像帧数据设置为当前画布图像数据
参数 hlmage - 图像对象句柄
bRedraw - 是否重绘窗口
返回值

LoadCaliber

声明 bool LoadCaliber(string strFilePath, bool bRedraw)
说明 从文件中装载检测工具或标记控件。
参数 strFilePath - 文件路径
bRedraw - 是否重绘窗口
返回值 true 或 false

SaveCaliber

声明 bool SaveCaliber(string strFilePath)
说明 将对象画布中检测工具或标记控件保存到文件
参数 strFilePath - 文件路径
返回值 true 或 false

FeedData

声明 void FeedData(IntPtr pData, UInt64 size, bool bRedraw)
说明 创建类对象
参数 pData - RvImage 图像数据
size - 数据内存大小,单位:字节
bRedraw - 是否重绘窗口
返回值

运动卡移动参数场景常量

常量 说明
ST_HOME 复归移动
ST_EDIT 编辑操作
ST_JOG 连续移动 JOG
ST_WORK 正式作业

机器运行状态常量

常量 说明
MS_UNKNOWN 未知状态
MS_STANDBY 待机状态,机器无任何动作
MS_RUNNING 运行状态,移动中
MS_PAUSED 暂停状态
MS_BROKEN 故障停止
MS_EMERGENCE 急停状态

GetHandle (Robot)

声明 IntPtr GetHandle()
说明 获得设备对象句柄
参数
返回值

FromHandle (Robot)

声明 void FromHandle(IntPtr h)
说明 从其它设备对象句柄创建设备对象
参数 h - 设备对象句柄
返回值

Create (Robot)

声明 bool Create()
说明 从其它设备对象句柄创建设备对象
参数
返回值

Destroy (Robot)

声明 void Destroy()
说明 销毁设备对象,释放相关资源
参数
返回值

Attach

声明 void Attach(ref Motion motion)
说明 关联运动对象
参数 Motion - 运动对象
返回值

GetMotionHandle

声明 IntPtr GetMotionHandle()
说明 获得运动对象句柄
参数
返回值 运动对象句柄

GetMotionOptions

声明 Options GetMotionOptions(int scene)
说明 获取运动对象移动参数对象
参数 scene - 场景 id
返回值 移动参数对象

Start (第一种声明)

声明 bool Start(IntPtr hNotifyWnd, ref int pErrCode)
说明 启动设备对象
参数 hNotifyWnd - 通知窗口
pErrCode - 错误码 [out]
返回值 true 或 false

Start (第二种声明)

声明 bool Start(IntPtr hNotifyEvent, IntPtr[] pActionEventArray, int nActionEventCount, ref int pErrCode)
说明 启动设备对象
参数 hNotifyEvent - 通知事件
pActionEventArray - 动作事件对象数组
nActionEventCount - 事件对象数量
pErrCode - 错误码 [out]
返回值 true 或 false

Start (第三种声明)

声明 bool Start(ref int errCode)
说明 启动设备对象
参数 pErrCode - 错误码 [out]
返回值 true 或 false

Stop

声明 void Stop()
说明 停止设备对象
参数
返回值 true 或 false

Delay

声明 bool Delay(int timeout)
说明 延迟等待一定时间,该等待可以中途退出。单位:毫秒
参数 timeout - 延迟时间
返回值 true 或 false

GetCurState

声明 int GetCurState()
说明 获得当前机器状态
参数
返回值 当前状态

GetErrorDescription

声明 string GetErrorDescription(int errorCode)
说明 获得错误码说明
参数 errorCode - 错误码
返回值 错误码说明

GetCurrentPosition

声明 bool GetCurrentPosition(ref double pX, ref double pY, ref double pZ, ref int pErrCode)
说明 获取龙门相关轴坐标。
参数 pX - X轴(第1轴)坐标[out]
pY - Y轴(第2轴)坐标[out]
pZ - Z轴(第3轴)坐标[out]
pErrCode - 错误码[out]
返回值 true 或 false

GetCurrentPosition

声明 bool GetCurrentPosition(ref double pX, ref double pYorY1, ref double pZ, ref double pYorY2, ref int pErrCode)
说明 获取双Y轴龙门坐标。
参数 pX - X轴(第1轴)坐标[out]
pYorY1 - Y1轴(第2轴)坐标[out]
pZ - Z轴(第3轴)坐标[out]
pYorY2 - Y2轴(第4轴)坐标[out]
pErrCode - 错误码[out]
返回值 true 或 false

GetCurrentPosition

声明 bool GetCurrentPosition(int axis, ref double pPos, ref int pErrCode)
说明 获取指定轴坐标。
参数 axis - 轴号
pPos - 坐标[out]
pErrCode - 错误码[out]
返回值 true 或 false

GetCurrentSpeed

声明 bool GetCurrentSpeed(ref double pX, ref double pY, ref double pZ, ref int pErrCode)
说明 获取龙门相关轴速度。
参数 pX - X轴(第1轴)速度[out]
pY - Y轴(第2轴)速度[out]
pZ - Z轴(第3轴)速度[out]
pErrCode - 错误码[out]
返回值 true 或 false

GetCurrentSpeed

声明 bool GetCurrentSpeed(ref double pX, ref double pYorY1, ref double pZ, ref double pYorY2, ref int pErrCode)
说明 获取双Y龙门相关轴速度。
参数 pX - X轴(第1轴)速度[out]
pYorY1 - Y1轴(第2轴)速度[out]
pZ - Z轴(第3轴)速度[out]
pYorY2 - Y2轴(第4轴)速度[out]
pErrCode - 错误码[out]
返回值 true 或 false

GetCurrentSpeed

声明 bool GetCurrentSpeed(int axis, ref double pSpeed, ref int pErrCode)
说明 获取指定轴速度。
参数 axis - 轴号
pSpeed - 速度[out]
pErrCode - 错误码[out]
返回值 true 或 false

SetOutputLevel

声明 bool SetOutputLevel(int bit, int level, ref int pErrCode)
说明 设置设置输出点电平。
参数 bit - 输出点位号
level - 电平,0(LOW)或1(HI)
pErrCode - 错误码[out]
返回值 true 或 false

GetOutputLevel

声明 bool GetOutputLevel(int bit, ref int level, ref int pErrCode)
说明 获取设置输出点电平。
参数 bit - 输出点位号
level - 电平,0(LOW)或1(HI) [OUT]
pErrCode - 错误码[out]
返回值 true 或 false

GetInputLevel

声明 bool GetInputLevel(int bit, ref int level, ref int pErrCode)
说明 获取设置输入点电平。
参数 bit - 输入点位号
level - 电平,0(LOW)或1(HI) [OUT]
pErrCode - 错误码[out]
返回值 true 或 false

Move

声明 bool Move(int axis, double pos, bool bAbsolute, IntPtr pOptions, ref int pErrCode)
说明 单轴移动(点位运动)。
参数 axis - 轴号
pos - 移动目标位置或相对距离
bAbsolute - 是否为绝对位置
pOptions - 运动参数对象句柄
pErrCode - 错误码[out]
返回值 true 或 false

MoveAny2

声明 bool MoveAny2(int axisX, int axisY, double x, double y, bool bAbsolute, IntPtr pOptions, ref int pErrCode)
说明 双轴插补移动(点位运动)。
参数 axisX - X轴号
axisY - Y轴号
x - X移动目标位置或相对距离
y - Y移动目标位置或相对距离
bAbsolute - 是否为绝对位置
pOptions - 运动参数对象句柄
pErrCode - 错误码[out]
返回值 true 或 false

MoveAny3

声明 bool MoveAny3(int axisX, int axisY, int axisZ, double x, double y, double z, bool bAbsolute, IntPtr pOptions, ref int pErrCode)
说明 3轴插补移动(点位运动)。
参数 axisX - X轴号
axisY - Y轴号
axisZ - Z轴号
x - X移动目标位置或相对距离
y - Y移动目标位置或相对距离
z - Z移动目标位置或相对距离
bAbsolute - 是否为绝对位置
pOptions - 运动参数对象句柄
pErrCode - 错误码[out]
返回值 true 或 false

WaitInput

声明 bool WaitInput(IntPtr pln, int timeout, ref int pErrCode)
说明 等待输入点位的输入信号,即高电平
参数 pln - 输入点对象
timeout - 等待时长,单位:毫秒
pErrCode - 错误码[out]
返回值 true 或 false

WaitAxis

声明 bool WaitAxis(int axis, bool bGoHome, IntPtr options, ref int pErrCode)
说明 等待单运动轴移动结束
参数 axis - 输入点对象
bGoHome - 是否为复归移动
options - 运动轴参数对象
pErrCode - 错误码[out]
返回值 true 或 false

WaitAny2

声明 bool WaitAny2(int axisX, int axisY, bool bGoHome, IntPtr options, ref int pErrCode)
说明 等待两轴移动结束
参数 axisX - X轴号
axisY - Y轴号
bGoHome - 是否为复归移动
options - 运动轴参数对象
pErrCode - 错误码[out]
返回值 true 或 false

WaitAny3

声明 bool WaitAny3(IntPtr axes, bool bGoHome, IntPtr options, ref int pErrCode)
说明 等待3轴移动结束
参数 axes - 轴对象
bGoHome - 是否为复归移动
options - 运动轴参数对象
pErrCode - 错误码[out]
返回值 true 或 false

WaitAny4

声明 bool WaitAny4(IntPtr axes, bool bGoHome, IntPtr options, ref int pErrCode)
说明 等待4轴移动结束
参数 axes - 轴对象
bGoHome - 是否为复归移动
options - 运动轴参数对象
pErrCode - 错误码[out]
返回值 true 或 false

HaltHomingAxis

声明 bool HaltHomingAxis(int axis, IntPtr options, ref int pErrCode)
说明 终止正在复归的轴移动
参数 axis - 轴号
options - 运动轴参数对象
pErrCode - 错误码[out]
返回值 true 或 false

IsActionActive

声明 bool IsActionActive(int actId)
说明 动作是否在活动状态
参数 actId - 动作ID
返回值 true 或 false

AddEmerg

声明 bool AddEmerg(int bit, bool bReverse, ref int pErrCode)
说明 添加一个急停信号
参数 bit - 输入点位号
bReverse - 信号转置
pErrCode - 错误码[out]
返回值 true 或 false

GetEmergCount

声明 int GetEmergCount()
说明 获得急停信号数量
参数
返回值 信号数量

RemoveEmerg

声明 void RemoveEmerg(int bit)
说明 移除指定输入点位急停信号
参数 bit - 输入点位号
返回值

RemoveAllEmerg

声明 void RemoveAllEmerg()
说明 移除所有急停信号
参数
返回值 true 或 false

GetTriggerCount

声明 int GetTriggerCount()
说明 获得触发器数量
参数
返回值 数量

RemoveTrigger

声明 void RemoveTrigger(int bit)
说明 移除指定输入点的触发器
参数 bit - 输入点位号
返回值

RemoveAllTrigger

声明 void RemoveAllTrigger()
说明 移除所有触发器
参数
返回值

AddScene

声明 bool AddScene(int scene, IntPtr options, ref int pErrCode)
说明 添加场景
参数 scene - 场景id
options - 运动轴参数对象句柄
pErrCode - 错误码[out]
返回值 true 或 false

RemoveScene

声明 void RemoveScene(int sceneId)
说明 移除场景
参数 sceneId - 场景id
返回值

GetSceneCount

声明 int GetSceneCount()
说明 获取场景数量
参数
返回值 数量

RemoveAllScene

声明 void RemoveAllScene()
说明 移除所有场景
参数
返回值

AddAction

声明 bool AddAction(IntPtr action, ref int pErrCode)
说明 添加动作
参数 action - 动作对象句柄
pErrCode - 错误码[out]
返回值 true 或 false

GetActionCount

声明 int GetActionCount()
说明 获取动作数量
参数
返回值 动作数量

RemoveAction

声明 void RemoveAction(int actId)
说明 移除动作
参数 actId - 动作id
返回值

RemoveAllAction

声明 void RemoveAllAction()
说明 移除所有动作
参数
返回值

IsTriggerActive

声明 bool IsTriggerActive()
说明 判断触发器是否激活
参数
返回值 true 或 false

ActivateTrigger

声明 bool ActivateTrigger()
说明 激活触发器
参数
返回值 true 或 false

DeactivateTrigger

声明 void DeactivateTrigger()
说明 停止触发器
参数
返回值

IsEmergenceOn

声明 bool IsEmergenceOn()
说明 判断急停监测是否已经激活
参数
返回值 true 或 false

SwitchEmergence

声明 bool SwitchEmergence(bool bOn)
说明 启动或停止急停监测
参数 bOn - 是否启动
返回值 true 或 false

AddSoftTrigger

声明 bool AddSoftTrigger(int bit, int type, int nInitLevel, IntPtr hNotifyWnd)
说明 添加软触发器
参数 bit - 输入点位号
type - 输入类型
nInitLevel - 初始值
hNotifyWnd - 消息接收窗口
返回值 true 或 false

RemoveSoftTrigger

声明 void RemoveSoftTrigger(int bit)
说明 移除软触发器
参数 bit - 输入点位号
返回值

Pause

声明 void Pause()
说明 设备暂停
参数
返回值

Continue

声明 void Continue()
说明 设备继续运行
参数
返回值

IsPaused

声明 bool IsPaused()
说明 判断设备是否已经暂停
参数
返回值 true 或 false

Reset

声明 void Reset()
说明 设备重置
参数
返回值

Raise

声明 void Raise()
说明 激发信号
参数
返回值

Flat

声明 void Flat()
说明 恢复信号
参数
返回值

IsRequested

声明 bool IsRequested()
说明 是否已经请求
参数
返回值 true 或 false

GoHome

声明 bool GoHome(int axis, IntPtr hNotifyWnd)
说明 单轴复归
参数 axis - 轴号
hNotifyWnd - 通知窗口句柄
返回值 true 或 false

Execute

声明 bool Execute(uint actId, CustomActionImplementDelegate caiDelegate, IntPtr pUserData, IntPtr hNotifyWnd)
说明 运行自定义动作
参数 actId - 动作ID
caiDelegate - 事件代理
pUserData - 用户数据
hNotifyWnd - 通知窗口句柄
返回值 true 或 false

StopMotion

声明 void StopMotion()
说明 停止轴移动
参数
返回值

IsStopped

声明 bool IsStopped()
说明 机器是否已经停止移动
参数
返回值 true 或 false

BeginRegisterAction

声明 bool BeginRegisterAction()
说明 开始注册多个自定义动作
参数
返回值 true 或 false

RegisterAction

声明 IntPtr RegisterAction(uint actId)
说明 添加自定义动作
参数 actId - 动作ID
返回值 动作指针

SetActionImplementFunc

声明 void SetActionImplementFunc(IntPtr hAction, CustomActionImplementDelegate pfnActionImplement, IntPtr pUserData)
说明 单轴复归
参数 hAction - 动作对象句柄
pfnActionImplement - 动作代理
pUserData - 用户数据
返回值

SetActionControlUnits

声明 unsafe int SetActionControlUnits(IntPtr hAction, IntPtr* pUnitsArray, int unitsCount)
说明 设置动作控制单元,这些单元可能是运动器、相机对象句柄
参数 hAction - 动作对象句柄
pUnitsArray - 控制单元句柄数组
unitsCount - 控制单元句柄数量
返回值 动作对象数量

EndRegisterAction

声明 bool EndRegisterAction(IntPtr hNotifyWnd)
说明 结束注册多个自定义动作
参数 hNotifyWnd - 通知窗口句柄
返回值 true 或 false

专用输入点常量

常量 说明
ROB_SIO_EMERG 急停输入
ROB_SIO_HOME 原点输入
ROB_SIO_POSLM 正限位输入
ROB_SIO_NIGHLMT 负限位输入
ROB_SIO_ALARM 报警输入
ROB_SIO_SERVO 是否使能输出
ROB_SIO_RESET_ALARM 清除报警输出
ROB_SIO_SERVO_READY 伺服就绪输入

轴移动方向常量

常量 说明
DIR_POS 正方向
DIR_NEG 负方向

输入输出电平常量

常量 说明
LOW 低电平
HI 高电平

ROB_AXIS

声明 int ROB_AXIS(int index)
说明 获取轴号
参数 index - 轴号索引,从1开始
返回值 轴号

GetHandle

声明 IntPtr GetHandle()
说明 获取运动对象句柄
参数
返回值 句柄

FromHandle

声明 void FromHandle(IntPtr h)
说明 从其它运动对象句柄创建运动对象
参数 h - 运动对象句柄
返回值

Create

声明 bool Create(string strModel, int axisCount, string strArgs, int extra1, int extra2)
说明 创建运动对象
参数 strModel - 运动卡模块名称
axisCount - 轴数量
strArgs - 参数,文本形式
extra1 - 附加参数1
extra2 - 附加参数2
返回值 true 或 false

Destroy

声明 void Destroy()
说明 销毁运动对象
参数 h - 运动对象句柄
返回值

ConfigSio

声明 bool ConfigSio(int axis, int type, int bit, bool bReverse, ref int pErrCode)
说明 配置专用IO
参数 axis - 轴号
type - 类型
bit - 输入或输出点位号
bReverse - 信号是否转置
pErrCode - 错误码[OUT]
返回值 true 或 false

SetSoftLimits

声明 bool SetSoftLimits(int axis, double neg, double pos, ref int pErrCode)
说明 设置轴软限位坐标
参数 axis - 轴号
neg - 正限位坐标
pos - 负限位坐标
pErrCode - 错误码[OUT]
返回值 true 或 false

GetPositiveLimitLevel

声明 bool GetPositiveLimitLevel(int axis, ref int level, ref int pErrCode)
说明 获取硬件正限位输入点电平
参数 axis - 轴号
level - 电平 [OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

GetNegativeLimitLevel

声明 bool GetNegativeLimitLevel(int axis, ref int level, ref int pErrCode)
说明 获取硬件负限位输入点电平
参数 axis - 轴号
level - 电平 [OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

GetHomeLevel

声明 bool GetHomeLevel(int axis, ref int level, ref int pErrCode)
说明 获取原点输入点电平
参数 axis - 轴号
level - 电平 [OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

GetEmergencyLevel

声明 bool GetEmergencyLevel(ref int level, ref int pErrCode)
说明 获取急停输入点电平
参数 level - 电平 [OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

SetHomeType

声明 bool SetHomeType(int axis, int type, ref int pErrCode)
说明 设置轴复归类型
参数 axis - 轴号
type - 类型
pErrCode - 错误码[OUT]
返回值 true 或 false

GetHomeType

声明 bool GetHomeType(int axis, ref int type, ref int pErrCode)
说明 获取轴复归类型
参数 axis - 轴号
type - 类型 [OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

SetPulseMode

声明 bool SetPulseMode(int axis, int mode, ref int pErrCode)
说明 设置脉冲模式
参数 axis - 轴号
mode - 模式
pErrCode - 错误码[OUT]
返回值 true 或 false

GetPulseMode

声明 bool GetPulseMode(int axis, ref int mode, ref int pErrCode)
说明 获取脉冲模式
参数 axis - 轴号
mode - 模式 [OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

SetAxisVendorType

声明 bool SetAxisVendorType(int axis, int type, ref int pErrCode)
说明 设置轴得厂家类型
参数 axis - 轴号
type - 类型
pErrCode - 错误码[OUT]
返回值 true 或 false

.GetAxisVendorType

声明 bool GetAxisVendorType(int axis, ref int type, ref int pErrCode)
说明 获取轴得厂家类型
参数 axis - 轴号
type - 类型 [OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

SetAxisUnits

声明 bool SetAxisUnits(int axis, float units, ref int pErrCode)
说明 设置脉冲当量
参数 axis - 轴号
units - 脉冲当量
pErrCode - 错误码[OUT]
返回值 true 或 false

GetAxisUnits

声明 bool GetAxisUnits(int axis, ref float units, ref int pErrCode)
说明 获取脉冲当量
参数 axis - 轴号
units - 脉冲当量 [OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

EnterEmergencyState

声明 bool EnterEmergencyState(ref int pErrCode)
说明 进入急停状态
参数 pErrCode - 错误码[OUT]
返回值 true 或 false

GetCurSpeed

声明 bool GetCurSpeed(int axis, ref double speed, ref int pErrCode)
说明 获取轴当前移动速度
参数 axis - 轴号
speed - 移动速度 [OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

GetAxisCount

声明 int GetAxisCount()
说明 获取轴数量
参数
返回值 轴数量

IsAxisReady

声明 bool IsAxisReady(int axis)
说明 判断指定轴是否就绪。(可以正常使用)
参数 axis - 轴号
返回值 true 或 false

GetVendorId

声明 int GetVendorId()
说明 获取厂家 ID
参数
返回值 厂家 ID

SetAxisReady

声明 bool SetAxisReady(int axis, bool flag, ref int pErrCode)
说明 设置轴是否就绪。(用于无轴状态输入场所)
参数 axis - 轴号
flag - 模式
pErrCode - 错误码[OUT]
返回值 true 或 false

SetDPR

声明 void SetDPR(int axis, double val)
说明 设置轴导程,转动一圈可移动距离。
参数 axis - 轴号
val - 距离
返回值 true 或 false

GetDPR

声明 double GetDPR(int axis)
说明 获取轴导程
参数 axis - 轴号
返回值 导程

SetMotorReso

声明 void SetMotorReso(int axis, int val)
说明 设置轴马达细分 (每转一圈需要的脉冲数)。
参数 axis - 轴号
val - 脉冲数量
返回值

GetMotorReso

声明 int GetMotorReso(int axis)
说明 获取轴马达细分
参数 axis - 轴号
返回值 脉冲数量

GetAxisCurPos

声明 bool GetAxisCurPos(int axis, ref double curpos, ref int pErrCode)
说明 获取当前轴位置
参数 axis - 轴号
curpos - 当前位置 [OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

ClearAxisPos

声明 bool ClearAxisPos(int axis, ref int pErrCode)
说明 清除轴位置
参数 axis - 轴号
pErrCode - 错误码[OUT]
返回值 true 或 false

GetAxisEncoderPos

声明 bool GetAxisEncoderPos(int axis, ref double curpos, ref int pErrCode)
说明 获取当前轴编码器位置
参数 axis - 轴号
curpos - 当前位置 [OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

GetAxisRasterPos

声明 bool GetAxisRasterPos(int axis, ref double curpos, ref int pErrCode)
说明 获取当前轴光栅位置
参数 axis - 轴号
curpos - 当前位置 [OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

GetAxisState

声明 bool GetAxisState(int axis, ref int state, ref int pErrCode)
说明 获取当前轴状态
参数 axis - 轴号
state - 当前状态 [OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

GetHomeState

声明 bool GetHomeState(int axis, ref int state, ref int pErrCode)
说明 获取当前轴复归状态
参数 axis - 轴号
state - 当前状态 [OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

EnableAxisServo

声明 bool EnableAxisServo(int axis, bool flag, ref int pErrCode)
说明 使当前轴伺服有效
参数 axis - 轴号
flag - 模式
pErrCode - 错误码[OUT]
返回值 true 或 false

IsAxisServoEnabled

声明 bool IsAxisServoEnabled(int axis, ref int state, ref int pErrCode)
说明 判断当前轴伺服是否使能
参数 axis - 轴号
state - 输入点当前状态 [OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

ClearAxisServoAlarm

声明 bool ClearAxisServoAlarm(int axis, int duration, ref int pErrCode)
说明 清除当前轴伺服报警
参数 axis - 轴号
duration - 持续时间,单位:毫秒 [OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

Delay

声明 bool Delay(int duration, ref int pErrCode)
说明 延迟一段时间。该延迟不可撤销
参数 duration - 持续时间,单位:毫秒
pErrCode - 错误码[OUT]
返回值 true 或 false

Home

声明 bool Home(int axis, IntPtr options, ref int pErrCode)
说明 单轴复归
参数 axis - 轴号
options - 参数对象句柄
pErrCode - 错误码[OUT]
返回值 true 或 false

HomeAny2

声明 bool HomeAny2(int axisX, int axisY, IntPtr options, ref int pErrCode)
说明 双轴复归
参数 axisX - X轴号
axisY - Y轴号
options - 参数对象句柄
pErrCode - 错误码[OUT]
返回值 true 或 false

HomeAny3

声明 bool HomeAny3(IntPtr axes, IntPtr options, ref int pErrCode)
说明 三轴复归
参数 axes - 轴对象句柄
options - 参数对象句柄
pErrCode - 错误码[OUT]
返回值 true 或 false

HomeAny4

声明 bool HomeAny4(IntPtr axes, IntPtr options, ref int pErrCode)
说明 四轴复归
参数 axes - 轴对象句柄
options - 参数对象句柄
pErrCode - 错误码[OUT]
返回值 true 或 false

StopHome

声明 bool StopHome(int axis, IntPtr options, ref int pErrCode)
说明 单轴复归停止
参数 axis - 轴号
options - 参数对象句柄
pErrCode - 错误码[OUT]
返回值 true 或 false

StopHomeAny2

声明 bool StopHomeAny2(IntPtr axes, IntPtr options, ref int pErrCode)
说明 双轴复归停止
参数 axes - 轴对象句柄
options - 参数对象句柄
pErrCode - 错误码[OUT]
返回值 true 或 false

StopHomeAny3

声明 bool StopHomeAny3(IntPtr axes, IntPtr options, ref int pErrCode)
说明 三轴复归停止
参数 axes - 轴对象句柄
options - 参数对象句柄
pErrCode - 错误码[OUT]
返回值 true 或 false

StopHomeAny4

声明 bool StopHomeAny4(IntPtr axes, IntPtr options, ref int pErrCode)
说明 四轴复归停止
参数 axes - 轴对象句柄
options - 参数对象句柄
pErrCode - 错误码[OUT]
返回值 true 或 false

Jog

声明 bool Jog(int axis, ref Options options, int dir, ref int pErrCode)
说明 单轴JOG移动
参数 axis - 轴号
options - 参数对象
dir - 方向
pErrCode - 错误码[OUT]
返回值 true 或 false

StopJog

声明 bool StopJog(int axis, ref Options options, ref int pErrCode)
说明 单轴JOG移动停止
参数 axis - 轴号
options - 参数对象
pErrCode - 错误码[OUT]
返回值 true 或 false

StartJog

声明 void StartJog(int axis, int direct)
说明 单轴JOG移动停止
参数 axis - 轴号
direct - 方向
返回值

StopJog

声明 void StopJog(int axis)
说明 单轴JOG移动停止
参数 axis - 轴号
返回值

Move

声明 bool Move(int axis, double step, IntPtr options, bool bAbsolute, ref int pErrCode)
说明 单轴移动
参数 axis - 轴号
step - 移动距离或坐标位置
options - 参数对象句柄
bAbsolute - 是否为绝对位置
pErrCode - 错误码[OUT]
返回值 true 或 false

MoveAny2

声明 bool MoveAny2(int axisX, int axisY, double x, double y, IntPtr options, bool bAbsolute, ref int pErrCode)
说明 两轴插补移动
参数 axisX - X轴号
axisY - Y轴号
x - X轴移动距离或坐标位置
y - Y轴移动距离或坐标位置
options - 参数对象句柄
bAbsolute - 是否为绝对位置
pErrCode - 错误码[OUT]
返回值 true 或 false

MoveAny3

声明 bool MoveAny3(IntPtr axes, double x, double y, double z, IntPtr options, bool bAbsolute, ref int pErrCode)
说明 三轴插补移动
参数 axes - 轴对象句柄
x - X轴移动距离或坐标位置
y - Y轴移动距离或坐标位置
z - Z轴移动距离或坐标位置
options - 参数对象句柄
bAbsolute - 是否为绝对位置
pErrCode - 错误码[OUT]
返回值 true 或 false

MoveAny4

声明 bool MoveAny4(IntPtr axes, double x, double y, double z, double r, IntPtr options, bool bAbsolute, ref int pErrCode)
说明 四轴插补移动
参数 axes - 轴对象句柄
x - X轴移动距离或坐标位置
y - Y轴移动距离或坐标位置
z - Z轴移动距离或坐标位置
r - R轴移动距离或坐标位置
options - 参数对象句柄
bAbsolute - 是否为绝对位置
pErrCode - 错误码[OUT]
返回值 true 或 false

MoveAny

声明 bool MoveAny(IntPtr axes, ref double posArray, int count, IntPtr options, bool bAbsolute, ref int pErrCode)
说明 任意多轴插补移动
参数 axes - 轴对象句柄
posArray - 移动距离或坐标位置数组
count - 数组长度
options - 参数对象句柄
bAbsolute - 是否为绝对位置
pErrCode - 错误码[OUT]
返回值 true 或 false

MoveArcAny2

声明 bool MoveArcAny2(IntPtr axes, double startX, double startY, double endX, double endY, double radius, bool bBigArc, int direct, IntPtr options, bool bAbsolute, ref int pErrCode)
说明 两轴圆弧移动
参数 axes - 轴对象句柄
startX - 起始点位置x坐标
startY - 起始点位置y坐标
endX - 结束点位置x坐标
endY - 结束点位置y坐标
radius - 半径
bBigArc - 是否为大圆弧
direct - 移动方向
options - 参数对象句柄
bAbsolute - 是否为绝对位置
pErrCode - 错误码[OUT]
返回值 true 或 false

StopAxis

声明 bool StopAxis(int axis, IntPtr options, ref int pErrCode)
说明 停止单轴移动
参数 axis - 轴号
options - 参数对象句柄
pErrCode - 错误码[OUT]
返回值 true 或 false

StopAxisAny2

声明 bool StopAxisAny2(IntPtr axes, IntPtr options, ref int pErrCode)
说明 停止任意两轴移动
参数 axes - 轴对象句柄
options - 参数对象句柄
pErrCode - 错误码[OUT]
返回值 true 或 false

StopAxisAny3

声明 bool StopAxisAny3(IntPtr axes, IntPtr options, ref int pErrCode)
说明 停止任意三轴移动
参数 axes - 轴对象句柄
options - 参数对象句柄
pErrCode - 错误码[OUT]
返回值 true 或 false

StopAxisAny4

声明 bool StopAxisAny4(IntPtr axes, IntPtr options, ref int pErrCode)
说明 停止任意四轴移动
参数 axes - 轴对象句柄
options - 参数对象句柄
pErrCode - 错误码[OUT]
返回值 true 或 false

OpenQueue

声明 bool OpenQueue(int id, IntPtr options, ref int pErrCode)
说明 打开移动队列
参数 id - ID
options - 参数对象句柄
pErrCode - 错误码[OUT]
返回值 true 或 false

GetQueueState

声明 bool GetQueueState(int id, ref int state, ref int lineNum, ref int pErrCode)
说明 获取移动队列状态
参数 id - ID
state - 状态 [OUT]
lineNum - 行号 [OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

StopQueue

声明 bool StopQueue(int id, IntPtr options, ref int pErrCode)
说明 停止移动队列
参数 id - ID
options - 参数对象句柄
pErrCode - 错误码[OUT]
返回值 true 或 false

CloseQueue

声明 bool CloseQueue(int id, ref int pErrCode)
说明 关闭移动队列
参数 id - ID
pErrCode - 错误码[OUT]
返回值 true 或 false

SetOutputLevel

声明 bool SetOutputLevel(int bit, int level, ref int pErrCode)
说明 设置输出点输出
参数 bit - 输出点位号
level - 电平, 0(LOW) 或 1(HI)
pErrCode - 错误码[OUT]
返回值 true 或 false

GetOutputLevel

声明 bool GetOutputLevel(int bit, ref int level, ref int pErrCode)
说明 获取输出点输出
参数 bit - 输出点位号
level - 电平, 0(LOW) 或 1(HI)[OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

GetInputLevel

声明 bool GetInputLevel(int bit, ref int level, ref int pErrCode)
说明 获取输入点输出
参数 bit - 输出点位号
level - 电平, 0(LOW) 或 1(HI)[OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

SetBatchOutputLevel

声明 bool SetBatchOutputLevel(long levels, ref int pErrCode)
说明 设置输出点批量输出
参数 levels - 电平值, 使用位表示。
pErrCode - 错误码[OUT]
返回值 true 或 false

GetBatchOutputLevel

声明 bool GetBatchOutputLevel(ref long pLevels, ref int pErrCode)
说明 获取输出点批量电平
参数 pLevels - 电平值, 使用位表示。[OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

GetBatchInputLevel

声明 bool GetBatchInputLevel(ref long pLevels, ref int pErrCode)
说明 获取输入点批量电平
参数 pLevels - 电平值, 使用位表示。
pErrCode - 错误码[OUT]
返回值 true 或 false

GetAuxState

声明 bool GetAuxState(int axis, int item, ref int state, ref int pErrCode)
说明 获取轴辅助状态
参数 axis - 轴号
item - 状态项
state - 状态[OUT]
pErrCode - 错误码[OUT]
返回值 true 或 false

GetVersion

声明 string GetVersion()
说明 获取运动模块版本号
参数
返回值 版本号

GetVendorDesc

声明 string GetVendorDesc()
说明 获取运动模块厂商描述
参数
返回值 厂商描述

GetErrorDesc

声明 string GetErrorDesc(int errCode)
说明 获取运动模块错误码描述
参数 errCode - 错误码
返回值 错误码描述

GetSerialNum

声明 string GetSerialNum()
说明 获取运动模块版序列号
参数
返回值 序列号

图像类型常量

常量 说明
RIT_BIN 二值图像
RIT_GRAY 灰度图像
RIT_RGB RGB 图像,彩色
RIT_RGBA RGBA 图像,彩色带 alpha 通道

图像文件格式常量

常量 说明
IFF_DEFAULT bmp 文件
IFF_ICO ico 文件
IFF_JPG jpg 文件
IFF_JPEG jpeg 文件
IFF_JNG jng 文件
IFF_KOALA koa 文件
IFF_LBM lbm 文件
IFF_iff iff 文件
IFF_MNG mng 文件
IFF_PBM pbm 文件
IFF_PBMRAW pdbmraw 文件
IFF_PCD pcd 文件
IFF_PCX pcx 文件
IFF_PGM pgm 文件
IFF_PGMRaw pgmraw 文件
IFF_PNG png 文件
IFF_PPM ppm 文件
IFF_PPMRAW ppmraw 文件
IFF_RAS ras 文件
IFF_TARGA tga 文件
IFF_TGA tga 文件
IFF_TIFF tiff 文件
IFF_TIF tif 文件
IFF_WBMP wbmp 文件
IFF_PSD psd 文件
IFF_CUT cut 文件
IFF_XBM xbm 文件
IFF_XPM xpm 文件
IFF_DDS dds 文件
IFF_GIF gif 文件
IFF_HDR hdr 文件
IFF_FAXG3 faxg3 文件
IFF_SGI sgi 文件
IFF_EXR exr 文件
IFF_J2K j2k 文件
IFF_JP2 jp2 文件
IFF_PFM pfm 文件
IFF_PICT pict 文件
IFF_RAW raw 文件

GetHandle

声明 IntPtr GetHandle()
说明 获取图像对象句柄
参数
返回值 相机对象 句柄

IsValid

声明 bool IsValid()
说明 判断图像对象是否可用
参数
返回值 true 或 false

Create

声明 bool Create(int type, int width, int height)
说明 创建图像对象
参数
返回值 true 或 false

Destroy

声明 void Destroy()
说明 销毁图像对象
参数
返回值

Flood

声明 void Flood(byte level)
说明 将图像对象所有像素设置为指定灰度值
参数
返回值

SetImageSize

声明 void SetImageSize(int width, int height)
说明 将图像对象的宽度和高度
参数 width - 像素宽度
height - 像素高度
返回值

GetDataSize

声明 uint GetDataSize()
说明 将图像对象的数据长度,单位:字节
参数
返回值 数据长度

GetImageType

声明 int GetImageType()
说明 获取图像对象类型
参数
返回值 图像类型

GetDataHandle

声明 IntPtr GetDataHandle()
说明 获取图像对象数据区句柄
参数
返回值 句柄

GetPitch

声明 int GetPitch()
说明 获取图像对象每行的字节数
参数
返回值 字节数量

GetWidth

声明 int GetWidth()
说明 获取图像对象宽度
参数
返回值 宽度

GetHeight

声明 int GetHeight()
说明 获取图像对象高度
参数
返回值 高度

LoadImage

声明 bool LoadImage(string strFileName, string strFormat = IFF_DEFAULT, int flag = 0)
说明 从文件中获取图像
参数 strFileName - 文件路径名
strFormat - 格式
Flag - 选项
返回值 true 或 false

SaveImage

声明 bool SaveImage(string strFileName, string strFormat = IFF_DEFAULT, int flag = 0)
说明 将图像保存到文件
参数 strFileName - 文件路径名
strFormat - 格式
Flag - 选项
返回值 true 或 false


抖音视频号: 第一感机器视觉
微信公众号: 精浦科技
深圳市软云动力科技有限公司
东莞办事处: 广东省东莞市松湖智谷B6栋225b
公司地址: 广东省深圳市南山区桃园路金桃园大厦2191

二维码1 二维码2 二维码3


深圳市软云动力科技有限公司 版权所有  鄂ICP备2022015826号-2   

统计显示 ▼