top of page

Python 6. Common Robot Settings

6.1. Setting Tool Reference Points - Six-Point Method

Prototype

SetToolPoint(point_num)

Description

Setting Tool Reference Points - Six Point Method

Mandatory parameters

  • point_num: point number, range [1~6]

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

6.2. Calculation tool coordinate system - six-point method

Prototype

ComputeTool()

Description

Calculate the tool coordinate system - six-point method (after setting the six tool reference points)

Mandatory parameters

NULL

Default parameters

NULL

Return Value

  • errorcode Success-0 Failure- errcode

  • tcp_pose=[x,y,z,rx,ry,rz]: tool coordinate system

6.3. Setting Tool Reference Points - Four Point Method

Prototype

SetTcp4RefPoint(point_num)

Description

Setting Tool Reference Points - Four Point Method

Mandatory parameter

point_num: point number, range [1~4]

Default parameters

NULL

Return Value

  • errorcode Success-0 Failure- errcode

  • tcp_pose=[x,y,z,rx,ry,rz]: tool coordinate system

6.4. Calculation Tool Coordinate System - Four Point Method

prototype

ComputeTcp4()

Description

Calculate tool coordinate system - four-point method (after setting the four tool reference points)

Mandatory parameters

NULL

Default parameters

NULL

Return Value

  • errorcode Success-0 Failure- errcode

  • tcp_pose=[x,y,z,rx,ry,rz]: tool coordinate system

6.5. Calculate the tool coordinate system based on the point information

New in version python: SDK-v2.0.8

Prototype

ComputeToolCoordWithPoints(method, pos)

Description

Calculate the tool coordinate system based on the point information

Mandatory parameters

  • method:Calculation method; 0-four point method; One - six point method

  • pos:The array length of the joint position group is 4 in the four-point method and 6 in the six-point method

Default parameters

NULL

Return Value

  • Error Code Success-0 Failure- errcode

  • tcp_offset=[x,y,z,rx,ry,rz]:Tool coordinate system calculated from point information, unit [mm][°]

6.6. Setting the tool coordinate system

Prototype

SetToolCoord(id,t_coord,type,install,toolID,loadNum)

Description

Setting the tool coordinate system

Mandatory parameters

  • id: coordinate system number, range [1~15];

  • t_coord: Position of the tool center point relative to the center of the end flange in [mm][°];

  • type: 0 - tool coordinate system, 1 - sensor coordinate system;

  • install: installation position, 0 - robot end, 1 - robot exterior

  • toolID: tool ID

  • loadNum: load number

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

6.7. Setting the tool coordinate system list

Prototype

SetToolList(id,t_coord ,type, install, loadNum)

Description

Set up a list of tool coordinate systems

Mandatory parameters

  • id: coordinate system number, range [1~15];

  • t_coord: [x,y,z,rx,ry,rz] Tool center point relative to end flange center position in [mm][°];

  • type: 0 - tool coordinate system, 1 - sensor coordinate system;

  • install: installation position, 0 - robot end, 1 - robot exterior

  • loadNum: load number

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

6.8. Get the current tool coordinate system

Prototype

GetTCPOffset(flag=1)

Description

Get current tool coordinate system

Mandatory parameters

NULL

Default parameters

flag: 0-blocking, 1-non-blocking Default 1

Return Value

  • errorcode Success-0 Failure- errcode

  • tcp_offset=[x,y,z,rx,ry,rz]: Relative position of the current tool coordinate system in [mm][°]

6.9. Robot tool coordinate system manipulation code example

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')
p1Desc = [186.331487.913209.850149.0300.688-114.347]
p2Desc = [69.721535.073202.882-144.406-14.775-89.012]
p3Desc = [146.861578.426205.598175.997-36.178-93.437]
p4Desc = [136.284509.876225.613178.9871.372-100.696]
p5Desc = [138.395505.972298.016179.1342.147-101.110]
p6Desc = [105.553454.325232.017-179.4260.444-99.952]
p1Joint = [-127.876-75.341115.417-122.741-59.82074.300]
p2Joint = [-101.780-69.828110.917-125.740-127.84174.300]
p3Joint = [-112.851-60.19186.566-80.676-97.46374.300]
p4Joint = [-116.397-76.281113.845-128.611-88.65474.299]
p5Joint = [-116.814-82.333109.162-118.662-88.58574.302]
p6Joint = [-115.649-84.367122.447-128.663-90.43274.303]
exaxisPos = [0000]
offdese = [000000]
posJ = [p1Joint, p2Joint, p3Joint, p4Joint, p5Joint, p6Joint]
rtn,coordRtn = robot.ComputeToolCoordWithPoints(1, posJ)
print(f"ComputeToolCoordWithPoints    {rtn}  coord is {coordRtn[0]} {coordRtn[1]} {coordRtn[2]} {coordRtn[3]} {coordRtn[4]} {coordRtn[5]}")
robot.MoveJ(joint_pos=p1Joint,tool=0, user=0, vel=100)
robot.SetToolPoint(1)
robot.MoveJ(joint_pos=p2Joint,tool=0, user=0, vel=100)
robot.SetToolPoint(2)
robot.MoveJ(joint_pos=p3Joint,tool=0, user=0, vel=100)
robot.SetToolPoint(3)
robot.MoveJ(joint_pos=p4Joint,tool=0, user=0, vel=100)
robot.SetToolPoint(4)
robot.MoveJ(joint_pos=p5Joint,tool=0, user=0, vel=100)
robot.SetToolPoint(5)
robot.MoveJ(joint_pos=p6Joint,tool=0, user=0, vel=100)
robot.SetToolPoint(6)
rtn,coordRtn = robot.ComputeTool()
print(f"6 Point ComputeTool        {rtn}  coord is {coordRtn[0]} {coordRtn[1]} {coordRtn[2]} {coordRtn[3]} {coordRtn[4]} {coordRtn[5]}")
robot.SetToolList(1, coordRtn, 000)
robot.MoveJ(joint_pos=p1Joint,tool=0, user=0, vel=100)
robot.SetTcp4RefPoint(1)
robot.MoveJ(joint_pos=p2Joint,tool=0, user=0, vel=100)
robot.SetTcp4RefPoint(2)
robot.MoveJ(joint_pos=p3Joint,tool=0, user=0, vel=100)
robot.SetTcp4RefPoint(3)
robot.MoveJ(joint_pos=p4Joint,tool=0, user=0, vel=100)
robot.SetTcp4RefPoint(4)
rtn,coordRtn = robot.ComputeTcp4()
print(f"4 Point ComputeTool        {rtn}  coord is {coordRtn[0]} {coordRtn[1]} {coordRtn[2]} {coordRtn[3]} {coordRtn[4]} {coordRtn[5]}")
robot.SetToolCoord(2, coordRtn, 0010)
rtn,getCoord = robot.GetTCPOffset(0)
print(f"GetTCPOffset    {rtn}  coord is {getCoord[0]} {getCoord[1]} {getCoord[2]} {getCoord[3]} {getCoord[4]} {getCoord[5]}")
robot.CloseRPC()

6.10. Setting External Tool Reference Points-Six-Point Method

Prototype

SetExTCPPoint(point_num)

Description

Setting the external tool reference point - three-point method

Mandatory parameters

  • point_num: point number, range [1~3]

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode


robotic arm
FAIRINO ROBOTIC ARMS

Contact

Location: 10637 Scripps Summit Court,

San Diego, CA. 92131
Phone: (619) 333-FAIR
Email: hello@fairino.us

© 2023 Fairino US official site Proudly created By G2T

bottom of page