3. Robotics Basics
3.1. Instantiated Robot
Prototype |
|
|---|---|
Description |
Instantiating a robot object |
Required parameter |
|
Optional parameter |
NULL |
Return value |
|
3.2. Close the RPC connection
Prototype |
|
|---|---|
Description |
Close RPC connection |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
NULL |
3.3. Query SDK version number
prototype |
|
|---|---|
Description |
Query SDK version number |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
3.4. Get controller IP
Prototype |
|
|---|---|
Description |
Query Controller IP |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
3.5. Controlling the robot into and out of drag-and-drop instructor mode
Prototype |
|
|---|---|
Description |
Controls the robot into and out of drag-and-drop demonstration mode. |
Mandatory parameter |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
3.6. Queries whether the robot is in drag mode
Prototype |
|
|---|---|
Description |
Queries whether the robot is in drag-and-drop demonstration mode. |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
3.7. Control robot up-enable or down-enable
prototype |
|
|---|---|
Description |
Control robot up-enable or down-enable |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
3.8. Control of robot hand-automatic mode switching
prototype |
|
|---|---|
description |
control robot hand auto mode switching |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
3.9. Shut down the robot operating system
Added in version python: SDK-v2.1.1
Prototype |
|
|---|---|
Description |
Shut down the robot operating system |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
3.10. Initialize the log parameters
Added in version python: SDK-v2.1.1
Prototype |
|
|---|---|
Description |
Initialize the log parameters |
Mandatory parameters |
NULL |
Default parameters |
|
Return Value |
Error Code Success-0 Failure- errcode |
3.11. Setting the log filter level
Added in version python: SDK-v2.0.2
Prototype |
|
|---|---|
Description |
Set log filter level |
Mandatory parameters |
NULL |
Default Parameters |
|
Return Value |
Error Code Success-0 Failure- errcode |
3.12. Robot base control code example
1time.sleep(1)
2error,version = robot.GetSDKVersion()
3print(f"SDK version: {version}")
4error,ip = robot.GetControllerIP()
5print(f"controller ip: {ip}")
6
7robot.Mode(1)
8time.sleep(1)
9robot.DragTeachSwitch(state=1)
10time.sleep(1)
11error,state = robot.IsInDragTeach()
12print(f"drag state: {state}")
13time.sleep(3)
14robot.DragTeachSwitch(state=0)
15time.sleep(1)
16error,state = robot.IsInDragTeach()
17print(f"drag state: {state}")
18time.sleep(3)
19robot.RobotEnable(0)
20time.sleep(3)
21robot.RobotEnable(1)
22robot.Mode(0)
23time.sleep(1)
24robot.Mode(1)
25time.sleep(1)
26rtn = robot.HiSpeedManualSwitch(1)
27print(f"change high speed mode : {rtn}")
28time.sleep(1)
29rtn = robot.HiSpeedManualSwitch(0)
30print(f"change low speed mode : {rtn}")
31time.sleep(3)
32robot.ShutDownRobotOS()
33
34robot.CloseRPC()
3.13. Get the software version of the robot
Added in version python: SDK-v2.0.1
Prototype |
|
|---|---|
Description |
Get the software version of the robot |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
3.14. Getting robot hardware version information
Added in version python: SDK-v2.0.1
Prototype |
|
|---|---|
Description |
Get robot hardware version information |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
3.15. Getting robot firmware version information
Added in version python: SDK-v2.0.1
Prototype |
|
|---|---|
Description |
Get information about the robot’s firmware version. |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
3.16. Get the robot software firmware version code sample
1from fairino import Robot
2# Establish a connection with the robot controller and return a robot object if the connection is successful
3robot = Robot.RPC('192.168.58.2')
4rtn,robotModel, webversion, controllerVersion = robot.GetSoftwareVersion()
5print(f"Getsoftwareversion rtn is: {rtn}")
6print(f"robotmodel is: {robotModel}, webversion is: {webversion}, controllerVersion is: {controllerVersion}\n")
7rtn,ctrlBoxBoardversion, driver1version, driver2version,driver3version, driver4version, driver5version,driver6version, endBoardversion = robot.GetHardwareversion()
8print(f"GetHardwareversion rtn is: {rtn}")
9print(f"GetHardwareversion get hardware version is: {ctrlBoxBoardversion}, {driver1version}, {driver2version}, "
10 f"{driver3version}, {driver4version}, {driver5version}, {driver6version}, {endBoardversion}\n")
11rtn,ctrlBoxBoardversion, driver1version, driver2version,driver3version, driver4version, driver5version,driver6version, endBoardversion = robot.GetFirmwareVersion()
12print(f"GetFirmwareversion rtn is: {rtn}")
13print(f"GetFirmwareversion get firmware version is: {ctrlBoxBoardversion}, {driver1version}, {driver2version}, "
14 f"{driver3version}, {driver4version}, {driver5version}, {driver6version}, {endBoardversion}\n")
15robot.CloseRPC()