from fairino import Robot
import time
# Establish a connection with the robot controller and return a robot object if the connection is successful
robot = Robot.RPC('192.168.58.2')
retval = robot.AuxServoSetParam(1, 1, 1, 1, 131072, 15.45)
print(f"AuxServoSetParam is: {retval}")
servoCompany = 0
servoModel = 0
servoSoftVersion = 0
servoResolution = 0
axisMechTransRatio = 0.0
retval, servoCompany, servoModel, servoSoftVersion, servoResolution, axisMechTransRatio = robot.AuxServoGetParam(1)
print(f"servoCompany {servoCompany}\n"
f"servoModel {servoModel}\n"
f"servoSoftVersion {servoSoftVersion}\n"
f"servoResolution {servoResolution}\n"
f"axisMechTransRatio {axisMechTransRatio}\n")
retval = robot.AuxServoSetParam(1, 10, 11, 12, 13, 14)
print(f"AuxServoSetParam is: {retval}")
retval, servoCompany, servoModel, servoSoftVersion, servoResolution, axisMechTransRatio = robot.AuxServoGetParam(1)
print(f"servoCompany {servoCompany}\n"
f"servoModel {servoModel}\n"
f"servoSoftVersion {servoSoftVersion}\n"
f"servoResolution {servoResolution}\n"
f"axisMechTransRatio {axisMechTransRatio}\n")
retval = robot.AuxServoSetParam(1, 1, 1, 1, 131072, 36)
print(f"AuxServoSetParam is: {retval}")
time.sleep(3)
robot.AuxServoSetAcc(3000, 3000)
robot.AuxServoSetEmergencyStopAcc(5000, 5000)
time.sleep(1)
emagacc = 0.0
emagdec = 0.0
acc = 0.0
dec = 0.0
error,emagacc, emagdec = robot.AuxServoGetEmergencyStopAcc()
print(f"emergency acc is {emagacc} dec is {emagdec}")
error,acc, dec = robot.AuxServoGetAcc()
print(f"acc is {acc} dec is {dec}")
robot.AuxServoSetControlMode(1, 0)
time.sleep(2)
retval = robot.AuxServoEnable(1, 0)
print(f"AuxServoEnable disenable {retval}")
time.sleep(1)
servoErrCode = 0
servoState = 0
servoPos = 0.0
servoSpeed = 0.0
servoTorque = 0.0
retval, servoErrCode, servoState, servoPos, servoSpeed, servoTorque = robot.AuxServoGetStatus(1)
print(f"AuxServoGetStatus servoState {servoState}")
time.sleep(1)
retval = robot.AuxServoEnable(1, 1)
print(f"AuxServoEnable enable {retval}")
time.sleep(1)
retval, servoErrCode, servoState, servoPos, servoSpeed, servoTorque = robot.AuxServoGetStatus(1)
print(f"AuxServoGetStatus servoState {servoState}")
time.sleep(1)
retval = robot.AuxServoHoming(1, 1, 5, 1,100)
print(f"AuxServoHoming {retval}")
time.sleep(3)
retval = robot.AuxServoSetTargetPos(1, 200, 30,100)
print(f"AuxServoSetTargetPos {retval}")
time.sleep(1)
retval, servoErrCode, servoState, servoPos, servoSpeed, servoTorque = robot.AuxServoGetStatus(1)
print(f"AuxServoGetStatus servoSpeed {servoSpeed}")
time.sleep(8)
robot.AuxServoSetControlMode(1, 1)
time.sleep(2)
robot.AuxServoEnable(1, 0)
time.sleep(1)
robot.AuxServoEnable(1, 1)
time.sleep(1)
robot.AuxServoSetTargetSpeed(1, 100, 80)
time.sleep(5)
robot.AuxServoSetTargetSpeed(1, 0, 80)
robot.CloseRPC()
13.17. Parameter configuration for UDP extended axis communication
New in version python: SDK-v2.1.2
prototype | ExtDevSetUDPComParam(ip, port, period, lossPkgTime, lossPkgNum, disconnectTime, reconnectEnable, reconnectPeriod, reconnectNum, selfConnect) |
Description | UDP Extended Axis Communication Parameter Configuration |
Mandatory parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
13.18. Get UDP extended axis communication parameters
New in version python: SDK-v2.0.4
Prototype | ExtDevGetUDPComParam() |
Description | Get UDP extended axis communication parameters |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value |
|
13.19. Load UDP communication
New in version python: SDK-v2.0.4
Prototype | ExtDevLoadUDPDriver() |
Description | Load UDP communication |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
13.20. Offloading UDP communication
New in version python: SDK-v2.0.4
Prototype | ExtDevUnloadUDPDriver() |
Description | Offloading UDP communication |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
13.21. UDP Extended Axis Communication Recovery after Abnormal Disconnection
New in version python: SDK-v2.0.4
prototype | ExtDevUDPClientComReset() |
Description | UDP Extended Axis Communication Abnormally Disconnected After Restoring Connection |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
13.22. UDP extension axis communication is closed after abnormal disconnection.
New in version python: SDK-v2.0.4
Prototype | ExtDevUDPClientComClose() |
Description | UDP Extended Axis Communication Abnormal Disconnect Closes Communication |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
13.23. UDP Extended Axis Parameter Configuration
New in version python: SDK-v2.0.4
Prototype | ExtAxisParamConfig(axisId, axisType, axisDirection, axisMax, axisMin, axisVel, axisAcc,axisLead, encResolution, axisOffect. axisCompany, axisModel, axisEncType) |
Description | UDP Extended Axis Parameter Configuration |
Mandatory parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
13.24. Setting the extended robot position relative to the extended axis
New in version python: SDK-v2.0.4
Prototype | SetRobotPosToAxis(installType) |
Description | Set the position of the extended robot relative to the extended axis |
Mandatory parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
13.25. Setting the extended axis system DH parameter configuration
New in version python: SDK-v2.0.4
Prototype | SetAxisDHParaConfig(axisConfig,axisDHd1,axisDHd2,axisDHd3,axisDHd4,axisDHa1,axisDHa2,axisDHa3,axisDHa4) |
Description | Sets the extended axis system DH parameter configuration |
Mandatory parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
13.26. UDP Extended Axis Enable
New in version python: SDK-v2.0.4
Prototype | ExtAxisServoOn(axisID, status) |
description | UDP Extended Axis Enable |
Mandatory parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
13.27. UDP Extended Axis Zero Return
New in version python: SDK-v2.0.4
Prototype | ExtAxisSetHoming(axisID, mode, searchVel, latchVel) |
Description | UDP extended axis back to zero |
Mandatory parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
13.28. UDP Extended Axis Tap Start
New in version python: SDK-v2.0.4
Prototype | ExtAxisStartJog( axisID, direction, vel, acc, maxDistance) |
Description | UDP Extended Axis Tap Start |
Mandatory parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
13.29. UDP Extended Axis Tap Stop
New in version python: SDK-v2.0.4
Prototype | ExtAxisStopJog(axisID) |
Description | UDP Extended Axis Tap Stop |
Mandatory parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |