Generating and Transmitting ABB Rapid Code to the Robot

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.

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 ( 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.