UFACTORY Gcode
UFACTORY Gcode is compatible with LinuxCNC gcode: http://linuxcnc.org/, and refers to the RS-274 standard.
Updated: 2024-07-24
Firmware version: v2.5.0 or later
UFACTORY Studio version: V2.5.0 or later
TCP port: 504
1. G command
G0 X Y Z A B C // The speed is 240mm/s by default
G1 X Y Z A B C F // XYZ(mm), ABC(RPY,degree), F(speed,mm/min)
G2 //Arc move, clockwise arc (G2 X Y Z R P F ) (G2 X Y Z I J K P F), R-radius, I- X offset, J- Y offset, K- Z offset, P-number of turns, default is 1
G3 //Arc move, counterclockwise arc (G3 X Y Z R P F) (G3 X Y Z I J K P F)
G4 P // Dwell, Unit: s
G17 //Z-axis, XY-plane
G18 //Y-axis, YZ-plane
G19 //X-axis, YZ-plane
G20 // use inches for length units
G21 // use millimeters for length units
G90 //absolute distance mode
G90.1 //absolute distance mode for I, J & K offsets
G91 //incremental distance mode
G91.1 //incremental distance mode for I, J & K offsets
You can debug and check more examples via 'UFACTORY Studio-Gcode' page.
2. M command
M2/M30 //end program
M62 P //turn on digital output synchronized with motion(wait=True).
M63 P //turn off digital output synchronized with motion(wait=True).
M64 P //turn on digital output immediately(wait=False).
M65 P //turn off digital output immediately(wait=False).
E67 E Q //set controller analog output synchronized with motion(wait=True).
E68 E Q //set controller analog output immediately(wait=False). P: IONUM(0-15, 0-7: CO0-CO7, 8-15: DO0-DO7)
E: IONUM(0-1), Q: value(0-10)
M100 P{} Q{} //enable or disable the robot. P1-enable, P0-disable, Q-joint ID(8 by default, stands for all joints).
M101 //clear error
M102 //clear warning
M103 P{} //set mode
M104 P{} //set state
M115 P{} Q{} //set TGPIO
P: IONUM 0/1/2/3/4
Q: 0/ 1/ 10/ 11
Q0:turn off(low level) tool digital output synchronized with motion(wait=True).
Q1:turn on(high level) tool digital output synchronized with motion(wait=True).
Q10: turn off tool digital output immediately(wait=False).
Q11: turn on tool digital output immediately(wait=False).
M116 P{} Q{} //control the end effector
P1: xArm Gripper, Q-position
P2: xArm Vacuum Gripper
Q0:open(wait=True), Q1:close(wait=True),
Q10:open(wait=False), Q11:close(wait=False)
P3: xArm BIO Gripper
Q0: close, Q1: open
P4/P5: Robotiq-2F-85 Gripper, Robotiq-2F-140 Gripper, Q:position(0~255)
P11: Lite6 Gripper
Q0:close(wait=True), Q1:open(wait=True),
Q10:close(wait=False), Q11:open(wait=False)
P12: Lite6 Vacuum Gripper
Q0:close(wait=True), Q1:open(wait=True),
Q10:close(wait=False), Q11:open(wait=False)
3. Python Example
Note:
1. Response:
byte0: return value. 0 is success
byte1: mode and state
byte2: error code
byte3 & byte4: buffer
2. Recommend to send 1 non-empty data at a time(with line breaks)
3. Need to receive the response, otherwise the buffer will be full.
Last updated