6. Gcode
UFACTORY Gcode refers to the RS-274 standard and is compatible with LinuxCNC Gcode: http://linuxcnc.org/.
6.1 Interface Overview
- Run: Run the Gcode program.
- Pause: Pause the running Gcode program.
- Save: Save change to Gcode program.
- Withdraw: Withdraw 1 step.
- File Operation: New, Import, Downlaod, Rename, Delete.
- Run: Run 1 gcode command.
6.2 G Command
G Command | Format | Description |
---|---|---|
G0 | G0 X Y Z A B C | Rapid Move |
G1 | G1 X Y Z A B C F | Linear Move |
G2 | G2 X Y Z R P FG2 X Y Z I J K P F | Arc Move, clockwise arcR-radius, I- X offset, J- Y offset, K- Z offset, P-number of turns, default is 1 |
G3 | G3 X Y Z R P FG3 X Y Z I J K P F | Arc Move, counterclockwise arc |
G4 | Dwell, Unit: s | |
G17 | Z-axis, XY-plane | |
G18 | Y-axis, XZ-plane | |
G19 | X-axis, YZ-plane | |
G20 | to use inches for length units | |
G21 | to 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 |
6.3 M Command
M Command | Format | Description |
---|---|---|
M2/M30 | end program | |
M62 | M62 P | turn on digital output synchronized with motion |
M63 | M63 P | turn off digital output synchronized with motion |
M64 | M64 P | turn on digital output immediately |
M65 | M65 P | turn off digital output immediately |
M67 | M67 E Q | set an analog output synchronized with motion |
M68 | M68 E Q | set an analog output immediately P: IONUM(0-15, 0-7: CO0-CO7, 8-15: DO0-DO7) E: IONUM(0-1), Q: value(0-10) |
M100 | M100 P Q | enable or disable the robotP1-enable, P0-disable, Q-joint ID(8 by default, stands for all joints). |
M101 | clear error | |
M102 | clear warning | |
M103 | M103 P | set mode |
M104 | M104 P | set state |
M115 | M115 P Q | set TGPIOP: IONUM 0/1/2/3/4Q: 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 | M116 P Q | control the end effectorP1: xArm Gripper, Q-positionP2: 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: openP4/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) |
6.4 Firmware Request
- Firmware Version: v2.2.0+
- Port: 504
- Response: 5 bytes
- byte0: return value. 0 is success
- byte1: mode and states
- byte2: error code
- byte3&byte4: buffer
- Recommend to send 1-non-empty data at a time(with line breaks)
python
sock.send(b'G0 X300\n')
- Need to receive the response, otherwise the buffer will be full.
python
sock.recv(5)
- A maximum of 2000 commands can be accepted.