The objective of this tutorial is to demonstrate the steps required for converting Robot Tasks to ABB Rapid Language and uploading them to the controller.
Preliminary Work
Create a motion task as described in the basic motion pathing tutorials and ensure you can connect to the robot via the Ethernet by following the steps outlined in the pendant operations tutorial. Place a Machine Code component and connect the Robot Task as seen in the figure above. Make sure you are generating code for the ABB Robot by selecting the AbbRapid option.
The component will emit a list of strings with programming instructions as seen below. The language is called ABB Rapid and resembles the classic Pascal programming language from the 70s. The name of the module, Jeneratiff if not specified through the input parameter, must match the filename, as in jeneratiff.mod when the code is uploaded and must also be the same in the project file (see how to manually create and upload a project). Worry not, we will achieve this through direct file transfer parametrically.
module Jeneratiff !!-- Code: Jeneratiff !!-- Date: 02/04/2017 !!-- Time: 20:08:13 !!-- pers tooldata D := [ TRUE, [ [ 0, 0, 0 ], [ 1, 0, 0, 0 ] ], [ 0.001, [ 0, 0, 0.001 ], [ 1, 0, 0, 0 ], 0, 0, 0 ] ]; var confdata C := [ 1, 1, 0, 0 ]; var extjoint E := [ 9E9, 9E9, 9E9, 9E9, 9E9, 9E9 ]; var speeddata S := [ 100, 500, 5000, 1000 ]; var zonedata Z := [ TRUE, 0, 0, 0, 0, 0, 0 ]; proc Task00B9CE40( ) MoveAbsJ [[ 55.937, 45.594, 5.559, -40.962, 121.307, 65.720], E ], S, Z, D; MoveL [[ 414.567, 396.239, 387.677], [ 0.000, 0.000, 0.707, -0.707], C, E ], S, Z, D; MoveL [[ 464.815, 339.342, 387.677], [ 0.000, 0.000, 0.707, -0.707], C, E ], S, Z, D; MoveL [[ 505.019, 274.956, 387.677], [ 0.000, 0.000, 0.707, -0.707], C, E ], S, Z, D; MoveL [[ 534.401, 204.956, 387.677], [ 0.000, 0.000, 0.707, -0.707], C, E ], S, Z, D; MoveL [[ 553.323, 131.416, 387.677], [ 0.000, 0.000, 0.707, -0.707], C, E ], S, Z, D; MoveL [[ 562.923, 56.074, 387.677], [ 0.000, 0.000, 0.707, -0.707], C, E ], S, Z, D; MoveL [[ 564.612, -19.872, 387.677], [ 0.000, 0.000, 0.707, -0.707], C, E ], S, Z, D; MoveL [[ 559.744, -95.689, 387.677], [ 0.000, 0.000, 0.707, -0.707], C, E ], S, Z, D; MoveL [[ 549.475, -170.972, 387.677], [ 0.000, 0.000, 0.707, -0.707], C, E ], S, Z, D; MoveL [[ 534.741, -245.513, 387.677], [ 0.000, 0.000, 0.707, -0.707], C, E ], S, Z, D; endproc proc Main( ) ConfJ \Off; ConfL \Off; SingArea \Wrist; Task00B9CE40; exit; endproc proc StdSpeed( num position, num rotation, num blending ) !!-- Where position (mm/s), rotation (deg/sec), blending (mm) S := [position, rotation, S.v_leax, S.v_reax]; Z := [blending = 0.0, blending, blending, Z.pzone_eax, Z.zone_ori, Z.zone_leax, Z.zone_reax]; endproc proc StdPause( ) var num result; TPReadFK result, "Operation is Paused. Continue?", stEmpty, stEmpty, stEmpty, "Yes", "No"; if( result = 5 ) then exit; endif endproc endmodule
The code contains a time stamp comment which is helpful for verifying that you are running the latest update of the program. It is followed by a list of module-wide state variables which simplify and compact code. After the global declarations we have a list of task procedures, one per Robot Task connected to the code generator. Tasks transform motions, signals and other controller / robot operations into instructions in this particular programming language. Eventually, there is a Main procedure which is the entry point of the program execution. This is where the program pointer start or goes to when PP to Main is clicked in the pendant. It contains some initialization instructions which can be modified through the header parameter, followed by the list of tasks to be executed serially as passed to the component, and some finalization instructions which map to the parameter passed as footer. The remaining procedures are shortcuts that interface between Jeneratiff and this particular robot programming language.
Uploading Code to the Robot
To upload the code to the robot controller we need to first combine the individual lines of code into one potentially giant string. This is achieved through the Text Join component passing the code and a new line as the merging string (add a text box component, open for edit, click in the yellow area, press enter, click ok). The reason for this step is precautionary as very large strings are clogging Grasshopper. So try not to visualize the content of the merged code text.
Now we need to use the file transfer protocol component in normal mode, specify the controller IP address (192.168.125.1) and FTP port number (21), use the Student username and Secret password, specify the location of the file in URI format (/Users/YourName/jeneratiff.mod) and give it a second to upload the contents. If the transfer succeeds there will be a message such as Transfer Complete in the Result output. Note that if your computer is not connected to the robot then the component will stall execution for a few seconds till the connection request times out. Nothing to worry but maybe disable the component if not connected to avoid this behavior. Also note that if you can connect to the controller via an FTP client such as Filezilla, then the component will work too. In other words, if you have IT problems try to solve externally first.
As for creating the project file you may use the same procedure and send over the formatted XML content. See below the hairy details whereby you just need to specify the Module Name (needs to connect to Code Generator Module parameter too) and the Student User folder name (was Dritsas before). Note that the project file changes are infrequent compared to module changes so it is often faster to just copy and paste one from the pendant that coping with chaos below.