@aubo/aubo_sdk v0.23.1
1. SDK 提供的功能
用户通过 SocketTCP/共享内存等方式与 aubo_control 的扩展功能 aubo_comm 服务端连接,发送指令给 aubo_control 控制器软件,实现对机器人的远程控制和信息获取。
1.1 JsonRPC 接口
提供了基于 SocketTCP 协议的 JsonRPC 通讯接口,主要用于向aubo_control发送指令。
1.2 RTDE 接口
提供了基于 SocketTCP 协议的 RTDE 通讯接口,主要用于获取机器人各类信息。
1.3 Script 接口
提供了基于 SocketTCP 和 Http 协议的 Script 通讯接口,主要用于向机器人发送lua程序脚本和接收变量、错误提示信息。
2. 运行环境和安装
2.1 运行环境要求
- node 8+ ; npm 无版本要求
2.2 安装方法
npm install @aubo/aubo_sdk
3. 使用介绍
可以将sdk视为一个连接机器人的工具,这个工具包含三个连接(rpc
、rtde
、script
)。想要精准的控制机器人和获取机器人信息需要依赖这三个连接。三个连接分别提供不同的功能。
sdk提供了两种使用方法可供选择:
一:独立管理三个连接,三个连接互不影响。
二:使用 Robot-Proxy
统一管理三个连接,只需要关注Robot-Proxy
的状态。
以下是三个连接客户端和Robot-Proxy
对外暴露的方法:
3.1 RpcClient
- connectRpcServer(ip: string, port: number)
- disconnectRpcServer()
- hasConnected()
- getRobotNames()
- login(robotName: string)
- logout()
- hasLogined()
- getSystemInfo()
- getRuntimeMachine()
- getRegisterControl()
- getMath()
- getSocket()
- getSerial()
- getRobotInterface()
Rpc 连接中具体包含了哪些功能性接口请参照common_interface
。
3.2 RtdeClient
- connectRtdeServer(ip: string, port: number)
- disconnectRtdeServer()
- hasConnected()
- registeredMsgCallBack(callBack: Function)
- cancellationMsgCallBack()
- getCurrentWsClientStatus()
- subscribeTopicWithChannel(topicNames: Array, intervalTime: number,channel: number )
- unsubscribeChannel(channel: number)
Rtde 还对外提供了常用话题池 TopicInputPool
和 TopicOutputPool
,方便用户订阅机器人消息。
3.3 ScriptClient
- connectScriptServer(ip: string, port: number)
- disconnectScriptServer()
- hasConnected()
- getCurrentWsClientStatus()
- sendScriptStrByWs(str: string)
- sendScriptStrByHttp(str: string)
- registerVariableChangeEvent(callBack: Function)
- stopCallBackVariableChange()
- registerScriptError(callBack: Function)
- stopCallBackScriptError()
registerErrorCloseEvent(callBack: Function)
3.4 RobotProxy
connectServer(ip: string,rpcPort: number,rtdePort: number,scriptPort: number)
- disConnectFromServer()
- hasConnect()
- getRpcClient()
- getRtdeClient()
- getScriptClient()
- getRobotNames()
- login(robotName: string)
- logout()
- getCurrentRobotName()
- hasLogin()
- getMath()
- getRegisterControl()
- getRuntimeMachine()
- getSerial()
- getSocket()
- getSystemInfo()
- getIoControl()
- getForceControl()
- getMotionControl()
- getRobotAlgorithm()
- getRobotConfig()
- getRobotManage()
- getRobotState()
- getSyncMove()
- getTrace()
- sendScriptStrByWs(str: string)
- sendScriptStrByHttp(str: string)
- registerVariableChangeEvent(callBack: Function)
- stopCallBackVariableChange()
- registerScriptError(callBack: Function)
- stopCallBackScriptError()
- batchAddRtdeTopicCallbacks(topics: Array,callbacks: Array,intervalTime: number)
- deleteRtdeTopicCallbacks(topics: Array)
- addRtdeTopicCallback(topic: string,callback: Function,intervalTime: number)
可以将RobotProxy
理解为对三个连接(rpc
、rtde
、script
)进行了一层封装,使用RobotProxy
时可以不关注三个连接,只专注于功能接口的调用。