<<<<<<< HEAD
Mercury API
使用以下函数接口时,请先进入我们的API库,否则无法成功运行。有关库的下载和导入,请参见Mercurycpp编译和运行。
下面的API使用坐标、角度控制和速度参考范围如下:
坐标范围 (X, + - 466 - mm, Y: + - 466 - mm, Z: - 240 ~ 531 mm, RX/RY/RZ: + - 180 °)
X,Y,Z 速度: 1~200; RX,RY,RZ: 速度 1~40
角度范围 (J1: + - 178 °, J2: - 74 ° ~ 130 ° (机械臂放在工作台上,不超过110°), J3: + - 178 °, J4: - 180 ° ~ 10 °, J5: + - 178 °, J6: - 20 ° ~ 273 °, J7: + - 180 °)
速度: 1~150
1 实例化Mercury
1.1 Mercury(char* portid, int baud)
功能:实例化Mercury
返回值:Mercury类型,Mercury对象的单例实例
参数说明:参数1:串口名 参数2:波特率
注意:在调用下面的API时,不需要在单独实例化,调用此API即可
2 机器人整体运行状态 Overall Status
2.1 PowerOn()
功能:机械臂上电
返回值:无
参数说明:无
注意:机械臂上电后,无法手动移动机械臂
2.2 PowerOff()
功能:机械臂掉电
返回值:无
参数说明:无
注意:机械臂上电后,如果想要手动移动机械臂,可以调用此API
2.3 isPoweredOn()
功能:控制核心连接状态查询
返回值:int类型,0--未上电,1--上电
参数说明:无
2.4 releaseAllServos()
功能:机器人关闭力矩输出
返回值:无
参数说明:无
2.5 FocusAllServos()
功能:机器人打开力矩输出
返回值:无
参数说明:无
3 输入程序控制模式 MDI Mode and Robot Control (Manual Data Input)
3.1 GetAngle()
功能:获取单关节角度
返回值:double类型,对应关节的角度。
参数说明:参数1:关节号(1-7)
3.2 GetAngles();
功能:读取所有角度
返回值:double*类型,指向一个存放1-7关节角度的double数组
参数说明:无
3.3 WriteAngle(int joint, double value, int speed)
功能:发送单独角度
返回值:无
参数说明:参数1:关节号(1-7),参数2:角度,参数3:速度 (1-100)
3.4 WriteAngles(double* angles, int speed)
功能:发送全部关节角度
返回值:无
参数说明:参数1:全部角度,参数2:速度(0-100)
3.5 GetCoords()
功能:获取全部坐标
返回值:double*类型,指向一个double数组
参数说明:无
3.6 WriteCoord(int axis, double value, int speed)
功能:发送单参数坐标
返回值:无
参数说明:参数1:坐标号(1-6(X-RZ)),参数2:坐标(X:+-466mm,Y:+-466mm,Z:-290~641mm,RX/RY/RZ:+-180°),参数3:速度(0-100)
3.7 WriteCoords(double* coords, int speed)
功能:发送全部坐标
返回值:无
参数说明:参数1:坐标,参数2:速度(0-100)
3.8 ProgramPause()
功能:控制核心暂停进行的指令,可以停止所有的移动指令
返回值:无
参数说明:无
3.9 isProgramPaused()
功能:检测程序是否暂停了移动的指令
返回值:int类型,0-未停止/1-停止
参数说明:无
3.10 ProgramResume()
功能:程序恢复移动指令,继续完成上一个指令
返回值:无
参数说明:无
3.11 TaskStop()
功能:控制核心停止所有的移动指令,程序停止
返回值:无
参数说明:无
3.12 checkRunning()()
功能:检测机器人是否在运动
返回值:int类型,1-正在运动/0-未运动
参数说明:无
3.13 IsInPosition(double* coords, bool value)
功能:检查机械臂是否到达指定点(角度或坐标)
返回值:bool类型,返回false——指定的点没有到达,返回true——指定的点已经到达
参数说明:参数1:指向包含所有角度或坐标的数组的指针参数2:0或1 (坐标为1,角度为0)
4 JOG运行与操作 JOG mode and operation
4.1 JogCoord(int axis, int direction, int speed)
功能:使机械臂朝坐标轴方向运动
返回值:无
参数说明:参数1:坐标号(1-6,x y z rx ry rz),参数2:方向(1--正方向,0--反方向),参数3:速度(范围:0-100)
注意:此API会让机械臂一直朝坐标轴正反方向运动,到达限位后或者中途调用TaskStop才会停止运动
4.2 JogAngle(int joint, int direction, int speed)
功能:使某个关节运动直至TaskStop或是到达限位
返回值:无
参数说明:参数1:关节号(1-7),参数2:方向(1--正方向,0--反方向),参数3:速度(范围:0-100)
注意:此API会让机械臂关节一直朝正反方向运动,到达限位后或者中途调用TaskStop才会停止运动
4.3 JogIncrement(int joint, double increment, int speed)
功能:使某个关节运动设定的角度增量
返回值:无
参数说明:参数1:关节号(1-7),参数2:关节增量值,速度(范围:0-100)
注意:机械臂进行步进运动:比如当前关节1坐标为-100,增量值为50,运动完后,关节1将为50
5 坐标控制姿态偏转角Coordinate Control Attitude Deflection Angle
5.1 GetSolutionAngles()
功能:获取零空间偏转角数值
返回值:double类型零空间偏转角数值
参数说明:无
5.2 SetSolutionAngles(double angle ,int speed)
功能:设置零空间偏转角数值
返回值:无
参数说明:参数1:零空间偏转角数值(范围+-90°);参数2:速度(范围0-100)
6 底座basicIO控制 basic IO Control
6.1 setBasicIOutput(int pin_number, int pin_signal)
功能:设置底座IO输出
返回值:无
参数说明:参数1:引脚号(basic输出引脚号),参数2:状态(0--低电平,1--高电平)
6.2 getBasicIInput(int pin_number)
功能:读取底座IO输出
返回值:引脚状态,0--低电平,1--高电平
参数说明:参数1::basic输入引脚号
7 设置软件关节限位 Software Joint Limit
7.1 getJointMin(int joint)
功能:读取关节最小角度
返回值:double类型,关节最小能运行到的角度
参数说明:参数1:关节号(1-6)
7.2 getJointMax(int joint)
功能:读取关节最大角度
返回值:double类型,关节最大能运行到的角度
参数说明:参数1:关节号(1-6)
7.3 setJointMin(int joint, double angle)
功能:设置关节最小角度
返回值:无
参数说明:参数1:关节号(1-6),参数2:最小角度(关节最小能运行到的角度)
7.4 setJointMax(int joint, double angle)
功能:设置关节最大角度
返回值:无
参数说明:参数1:关节号(1-6),参数2:最大角度(关节最大能运行到的角度)
8 拖动示教 Drag and play
8.1 DragTechSave()
功能:启动拖动示教录制点位
返回值:无
参数说明:无
8.2 DragTechExecute()
功能:执行示教点位
返回值:无
参数说明:无
8.3 DragTechPause()
功能:暂停点位录制
返回值:无
参数说明:无
注意:暂停之后机械臂处于放松状态
9 笛卡尔空间坐标参数设定 Cartesian space coordinate parameter setting
9.1 setToolReference(double x,double y, double z, double rx, double ry, double rz)
功能:设置工具坐标系
返回值:无
参数说明:参数1:x ,参数2: y ,参数3: z ,参数4: rx ,参数5: ry ,参数6: rz (参数范围:x(-2800~280.00) (10xmm),y (-2800~280.00)(10xmm),z(-2800~280.00)(10xmm),rx (-3140~3140) (1000xRd),ry(-3140~3140) (1000xRd),rz (--3140~3140)(1000xRd))
9.2 getToolReference()
功能:获取工具坐标系
返回值:double *类型,指向存放6个double类型数据(x,y,z,rx,ry,rz)的数组
参数说明:无
9.3 setWorldReference(double x, double y, double z, double rx, double ry, double rz)
功能:设置世界坐标系
返回值:无
参数说明:参数1:x ,参数2: y ,参数3: z ,参数4: rx ,参数5: ry ,参数6: rz (参数范围:x(-2800~280.00) (10xmm),y (-2800~280.00)(10xmm),z(-2800~280.00)(10xmm),rx (-3140~3140) (1000xRd),ry(-3140~3140) (1000xRd),rz (--3140~3140)(1000xRd))
9.4 getWorldReference()
功能:获取世界坐标系
返回值:double *类型,指向存放6个double类型数据(x,y,z,rx,ry,rz)的数组
参数说明:无
9.5 setMovementType(int movement)
功能:设置移动类型
返回值:无
参数说明:参数1:1-movel, 0-moveJ
9.6 getMovementType()
功能:获取移动类型
返回值:int类型,1-movel, 0-moveJ
参数说明:无
9.7 setEndType(int endtype)
功能:设置末端坐标系
返回值:无
参数说明:参数1:0-法兰 1-工具
9.8 getEndType()
功能:获取末端坐标系
返回值:int类型,0-法兰 1-工具
参数说明:无
10 圆弧运动
10.1 WriteMovC(float transpointx, float transpointy, float transpointz, float transpointrx, float transpointry, float transpointrz, float endpointx , float endpointy , float endpointz, float endpointrx, float endpointry, float endpointrz, int speed)
功能:圆弧轨迹运动
返回值:无
参数说明:transpoint为圆弧途径点,endpoint为圆弧结束点。参数1: transpointx, 参数2: transpointy, 参数3: transpointz,参数4: transpointrx, 参数5: transpointry, 参数6: transpointrz,参数7: endpointx , 参数8: endpointy , 参数9: endpointz ,参数10: endpointrx, 参数11: endpointry, 参数12: endpointrz, 参数13: 速度(1-100)
11 关节电机状态 servo state value
11.1 GetServoSpeeds()
功能:获取关节运行速度,运行时才有速度,单位:步/s
返回值:int*类型的指针,指向一个存放1-7关节速度大小的int[7]数组,范围:+-3000
参数说明:无
11.2 GetServoCurrents()
功能:获取关节电流
返回值:int*类型的指针,指向一个存放1-7关节电流大小的int[7]数组,范围:0-5000
参数说明:无
11.3 GetServoStatus()
功能:获取关节状态,0-->各关节正常
返回值:int*类型的指针,指向一个存放1-7关节状态的int[7]数组,状态:0--ok,1-欠压,2-过温,3-过流
参数说明:无
Mercury API
When using the following function interface, please first enter our API library, otherwise it will not run successfully. For the download and import of libraries, please see Mercurycpp compile and run.
The following API uses coordinates, Angle control, and speed reference ranges as follows:
coordinates (X, + - 466 - mm, Y: + - 466 - mm, Z: - 240 ~ 531 mm, RX/RY/RZ: + - 180 °)
X,Y,Z speed: 1~200; RX,RY,RZ: Speed 1~40
Angle (J1: + - 178 °, J2: - 74 ° ~ 130 ° (robotic arm on the table, not more than 110 °), J3: + - 178 °, J4: - 180 ° ~ 10 °, J5: + - 178 °, J6: - 20 ° ~ 273 °, J7: + - 180 °)
Speed: 1~150
1 Instantiate Mercury
1.1 Mercury(char* portid, int baud)
Function: Instantiate Mercury
Return value: Mercury type, singleton instance of Mercury object
Parameter description: Parameter 1: serial port name Parameter 2: baud rate
Note: When calling the following API, you do not need to instantiate it separately, just call this API
2 Overall running Status of the robot
2.1 PowerOn()
Function: The mechanical arm is powered on
Returned value: None
Parameter Description: None
Note: After the robot arm is powered on, the robot arm cannot be moved manually
2.2 PowerOff()
Function: mechanical arm power off
Returned value: None
Parameter Description: None
Note: After the robot arm is powered on, if you want to move the robot arm manually, you can call this API
2.3 isPoweredOn()
Function: Query core connection status
Returned value: int type,0-- not powered on, 1-- powered on
Parameter Description: None
2.4 releaseAllServos()
Function: Robot off torque output
Returned value: None
Parameter Description: None
2.5 FocusAllServos()
Function: Robot opens torque output
Returned value: None
Parameter Description: None
3 MDI Mode and Robot Control (Manual Data Input) MDI mode and Robot control (manual data input)
3.1 GetAngle()
Function: Obtain single joint Angle
Return value: Type double, corresponding to the Angle of the joint.
Parameter Description: Parameter 1: Joint number (1-7)
3.2 GetAngles();
Function: Read all angles
Return value: Type double*, pointing to a double array of 1-7 joint angles
Parameter Description: None
3.3 WriteAngle(int joint, double value, int speed)
Function: Send individual Angle
Returned value: None
Parameter description: Parameter 1: joint number (1-7), parameter 2: Angle, parameter 3: speed
3.4 WriteAngles(double* angles, int speed)
Function: Send all joint angles
Returned value: None
Parameter description: Parameter 1: a pointer to the full array of angles, parameter 2: speed
3.5 GetCoords()
Function: Get all coordinates
Return value: Type double*, pointing to a double array
Parameter Description: None
3.6 WriteCoord(int axis, double value, int speed)
Function: Send single parameter coordinates
Returned value: None
Parameter description: Parameter 1: coordinate number (1-6 (X-RZ)), parameter 2: coordinate, parameter 3: speed
3.7 WriteCoords(double* coords, int speed)
Function: Send all coordinates
Returned value: None
Parameter description: Parameter 1: a pointer to the array holding all coordinates, parameter 2: speed
3.8 ProgramPause()
Function: Control the core to suspend the instruction, you can stop all the moving instructions
Returned value: None
Parameter Description: None
3.9 isProgramPaused()
Function: Detect whether the program has paused the moving instruction
Return value: int type,0- not stopped /1- stopped
Parameter Description: None
3.10 ProgramResume()
Function: The program resumes the moving instruction and continues to complete the previous instruction
Returned value: None
Parameter Description: None
3.11 TaskStop()
Function: The control core stops all moving instructions, and the program stops
Returned value: None
Parameter Description: None
3.12 checkRunning()
Function: Detect whether the robot is moving
Return value: int type,1- moving /0- not moving
Parameter Description: None
IsInPosition(double coords, bool is_linear = true)
Function: Check whether the robot arm has reached the specified point (Angle or coordinate)
Return value: bool type, return false-- the specified point has not been reached, return true-- the specified point has been reached
Parameter Description: Parameter 1: a pointer to an array containing all angles or coordinates parameter 2:0 or 1 *(coordinates are 1, angles are 0)
4 JOG mode and operation JOG mode and operation
4.1 JogCoord(int axis, int direction, int speed)
Function: Make the mechanical arm move in the axis direction
Returned value: None
Parameter description: Parameter 1: Coordinate number (1-6, x y z rx ry rz), parameter 2: Direction (1-- positive direction, 0-- negative direction), parameter 3: Speed (range: 0-100)
Note: This API will keep the robot arm moving in the positive and negative direction of the axis, until it reaches the limit or calls TaskStop in the middle of the motion
4.2 JogAngle(int joint, int direction, int speed)
Function: Make a joint move until TaskStop or reach the limit
Returned value: None
Parameter description: Parameter 1: Joint number (1-7), Parameter 2: Direction (1-- positive direction, 0-- reverse direction), parameter 3: Speed (range: 0-100)
Note: This API will keep the robot arm joint moving in a positive and negative direction until it reaches the limit or calls TaskStop in the middle
4.3 JogIncrement(int joint, double increment, int speed)
Function: Make a joint movement set Angle increment
Returned value: None
Parameter description: Parameter 1: Joint number (1-7) , Parameter 2: joint increment value, speed (Range: 0-100)
Note: step movement of the robot arm: for example, the current joint 1 coordinate is -100, the increment value is 50, and after the movement, joint 1 will be 50
5 Coordinate Control Attitude Deflection Angle. Coordinate control attitude deflection Angle
5.1 GetSolutionAngles()
Function: Obtain zero space deflection Angle value
Return value: double null space deflection Angle value
Parameter Description: None
5.2 SetSolutionAngles(double angle,int speed)
Function: Set zero space deflection Angle value
Returned value: None
Parameter Description: Parameter 1: zero space deflection Angle value (range +-90°); Parameter 2: Speed (range 0-100)
6 Base basicIO Control basicIO Control
6.1 setBasicIOutput(int pin_number, int pin_signal)
Function: Set the base I/O output
Returned value: None
Parameter description: Parameter 1: Pin number (basic output pin number), parameter 2: Status (0-- low, 1-- high)
6.2 getBasicIInput(int pin_number)
Function: Read the base I/O output
Return value: Pin status, 0-- low, 1-- high
Parameter Description: Parameter 1: :basic Enter the pin number
7 Set the Software Joint Limit
7.1 getJointMin(int joint)
Function: Read the minimum joint Angle
Return value: Type double, the minimum Angle to which the joint can run
Parameter Description: Parameter 1: Joint number (1-6)
7.2 getJointMax(int joint)
Function: Read the maximum Angle of joint
Return value: Type double, the maximum Angle to which the joint can run
Parameter Description: Parameter 1: Joint number (1-6)
7.3 setJointMin(int joint, double angle)
Function: Set the minimum joint Angle
Returned value: None
Parameter description: Parameter 1: Joint number (1-6), parameter 2: Minimum Angle (minimum Angle to which the joint can operate)
7.4 setJointMax(int joint, double angle)
Function: Set the maximum joint Angle
Returned value: None
Parameter description: Parameter 1: Joint number (1-6), parameter 2: Maximum Angle (maximum Angle to which the joint can operate)
8 Drag the teaching Drag and play
8.1 DragTechSave()
Function: Start and drag the teaching recording point
Returned value: None
Parameter Description: None
8.2 DragTechExecute()
Function: Perform teaching point position
Returned value: None
Parameter Description: None
8.3 DragTechPause()
Function: Pause point recording
Returned value: None
Parameter Description: None
Note: The robot arm is in a relaxed state after the pause
9 Cartesian space coordinate parameter setting
9.1 setToolReference(double x,double y, double z, double rx, double ry, double rz)
Function: Set the tool coordinate system
Returned value: None
Parameter description: Parameter 1: x, parameter 2: y, parameter 3: z, parameter 4: rx, parameter 5: ry, parameter 6: rz(Parameter range: x(-2800~280.00) (10xmm), y (-2800~280.00)(10xmm), z(-2800~280.00)(10xmm), rx (-3140~3140) (1000xRd), Ry (3140 ~ 3140), 1000 (XRD), rz (3140 ~ 3140), 1000 (XRD))
9.2 getToolReference()
Function: Get tool coordinate system
Return value: Type double *, pointing to an array containing six doubles (x,y,z,rx,ry,rz)
Parameter Description: None
9.3 setWorldReference(double x, double y, double z, double rx, double ry, double rz)
Function: Set the world coordinate system
Returned value: None
Parameter description: Parameter 1: x, parameter 2: y, parameter 3: z, parameter 4: rx, parameter 5: ry, parameter 6: rz(Parameter range: x(-2800~280.00) (10xmm), y (-2800~280.00)(10xmm), z(-2800~280.00)(10xmm), rx (-3140~3140) (1000xRd), Ry (3140 ~ 3140), 1000 (XRD), rz (3140 ~ 3140), 1000 (XRD))
9.4 getWorldReference()
Function: Get the world coordinate system
Return value: Type double *, pointing to an array containing six doubles (x,y,z,rx,ry,rz)
Parameter Description: None
9.5 setMovementType(int movement)
Function: Set the movement type
Returned value: None
Parameter Description: Parameters 1:1-movel, 0-moveJ
9.6 getMovementType()
Function: Get movement type
Return value: int type, 1-movel, 0-moveJ
Parameter Description: None
9.7 setEndType(int endtype)
Function: Set the end coordinate system
Returned value: None
Parameter Description: Parameter 1:0- Flange 1- tool
9.8 getEndType()
Function: Get the end coordinate system
Returned value: int type, 0- flange 1- tool
Parameter Description: None
10 Circular motion
10.1 WriteMovC(float transpointx, float transpointy, float transpointz, float transpointrx, float transpointry, float transpointrz, float endpointx , float endpointy , float endpointz, float endpointrx, float endpointry, float endpointrz, int speed)
Function: arc trajectory movement
Returned value: None
Parameter description: transpoint is the arc path point, endpoint is the endpoint of the arc. Parameter 1: transpointx, parameter 2: transpointy, parameter 3: transpointz, parameter 4: transpointrx, parameter 5: transpointry, parameter 6: transpointrz, parameter 7: endpointx, parameter 8: endpointy, parameter 9: endpointz, parameter 10: endpointrx, parameter 11: endpointry, parameter 12: endpointrz, parameter 13: Speed
11 servo state value of joint motor
11.1 GetServoSpeeds()
Function: Get the joint running speed, running speed, unit: step /s
Return value: A pointer of type int* to an int[7] array containing the size of 1-7 joint velocities in the range +-3000
Parameter Description: None
11.2 GetServoCurrents()
Function: Obtain joint current
Return value: A pointer of type int* to an array of int[7] containing 1-7 joint currents in the range 0-5000
Parameter Description: None
11.3 GetServoStatus()
Function: Obtain joint status,0--> All joints are normal
Return value: A pointer of type int* to an array of int[7] holding the states of the 1-7 joint, 0--ok, 1- undervoltage, 2- overtemperature, 3- overcurrent
Parameter Description: None
b4cbb522d469c9fae1bce398ab2eea533b152ea9