Through my latest project, "Robot Arm Recording Path," I discovered a promising application for the Universal Robot UR5 CB3.1 - 3D metal printing using a robot arm. The concept was simple: use CAD/CAM or 3D Slicer Software to generate GCode and then import it to the robot. However, the challenge arose when I realized that different robot brands have their own scripts for controlling the robot arm, and UR was the only brand that allowed for the development of custom applications.
While exploring other robot arm brands like Omron TM, I faced numerous roadblocks due to the lack of information available online. Fortunately, UR provided valuable resources like a simulator and software development documentation that enabled me to work efficiently. The UR Script, a powerful programming language used to command and control the robot, became the focal point of my project.
After developing an application that can be installed on the controller, I successfully bridged the gap between GCode and UR Script. The application seamlessly translates GCode from 3D Slicer software to UR Script, opening the door to the potential of 3D metal printing using robot arms.
During the initial test of converting 3D print GCode to URScript, some abnormal movements occurred due to the G code setting speed, such as "G1 F1500 E0." However, I have since updated the code to resolve this issue.
Most 3D printing GCode utilizes G0 and G1 codes. Within the G0 and G1 codes, there are two additional essential codes: E and F.
G0 represents a rapid move, which is equivalent to movej() in URScript.
G1 represents a linear move, which is equivalent to movel() in URscript.
E represents the extruder position, and it can be related to the event trigger for the welder set_digital_out().
F represents the speed of movement, which is a variable for both movej() and movel().
Zero position is the current position of the tool: p[-0.120113, -0.431763, 0.146072, -0.001220, 3.116276, 0.038891]
Ex: G1 Z15.0 F6000 -> movel(p[-0.120113,-0.431763, 0.146072 + (15.0/1000)Â
,-0.001221,3.116276,0.038892],a=6.000000,v=1.200000)
Where Z of Zero 0.146072 + Z of G1 15.0 / 1000 (convert mm to M) = 0.161073
;FLAVOR:Marlin
;TIME:99
;Filament used: 1.30951m
;Layer height: 2
;MINX:45.223
;MINY:45.218
;MINZ:0.3
;MAXX:154.789
;MAXY:154.784
;MAXZ:8.3
;Generated with Cura_SteamEngine 5.3.0
G1 Z15.0 F6000 ;Move the platform down 15mm
G1 F1500 E-6.5
;LAYER_COUNT:5
;LAYER:0
G0 F3600 X60.902 Y61.631 Z0.3
;TYPE:SKIRT
G1 F1500 E0
G1 F1800 X61.623 Y60.918 E0.09537
G1 X62.786 Y59.807 E0.24664
G1 X63.333 Y59.3 E0.31679
G1 X64.026 Y58.695 E0.40331
G1 X65.287 Y57.626 E0.55879
G1 X65.715 Y57.274 E0.61091
G1 X66.589 Y56.595 E0.71501
G1 X67.875 Y55.632 E0.86611
G1 X68.441 Y55.222 E0.93185
G1 X69.227 Y54.686 E1.02133
G1 X70.58 Y53.792 E1.17385
G1 X71.098 Y53.461 E1.23167
movel(p[-0.120113,-0.431763,0.161073,-0.001221,3.116276,0.038892],a=6.000000,v=1.200000)
set_digital_out(0,True)
set_digital_out(0,False)
movej(p[-0.059211,-0.370132,0.146373,-0.001221,3.116276,0.038892],a=3.600000,v=1.200000)
set_digital_out(0,True)
movel(p[-0.058490,-0.370845,0.146073,-0.001221,3.116276,0.038892],a=1.800000,v=1.200000)
movel(p[-0.057327,-0.371956,0.146073,-0.001221,3.116276,0.038892],a=1.800000,v=1.200000)
movel(p[-0.056780,-0.372463,0.146073,-0.001221,3.116276,0.038892],a=1.800000,v=1.200000)
movel(p[-0.056087,-0.373068,0.146073,-0.001221,3.116276,0.038892],a=1.800000,v=1.200000)
movel(p[-0.054826,-0.374137,0.146073,-0.001221,3.116276,0.038892],a=1.800000,v=1.200000)
movel(p[-0.054398,-0.374489,0.146073,-0.001221,3.116276,0.038892],a=1.800000,v=1.200000)
movel(p[-0.053524,-0.375168,0.146073,-0.001221,3.116276,0.038892],a=1.800000,v=1.200000)
movel(p[-0.052238,-0.376131,0.146073,-0.001221,3.116276,0.038892],a=1.800000,v=1.200000)
movel(p[-0.051672,-0.376541,0.146073,-0.001221,3.116276,0.038892],a=1.800000,v=1.200000)
movel(p[-0.050886,-0.377077,0.146073,-0.001221,3.116276,0.038892],a=1.800000,v=1.200000)
movel(p[-0.049533,-0.377971,0.146073,-0.001221,3.116276,0.038892],a=1.800000,v=1.200000)