Programming Multiple Robot Systems Effectively

Filed under: Workflow FANUC TP Programming

When dealing with multiple robot systems, I usually find that maintaining consistency from robot-to-robot is usually the most difficult part. Simply getting backups of all your robots can be a pain if you don’t have the right tool for the job. If you’re using Windows (you probably are), just a little knowledge of the command line and the ftp utility will make your life a lot easier.

The Command Prompt

If you’ve never used the Windows command prompt before, read this quick intro from the Princeton CS department.

FTP

Go read my very first blog post about using FTP with FANUC robots. It describes how to use the Windows command line FTP client to connect to your robots and download/upload files.

This client allows you to specify a command file which lists a series of commands to be executed when you connect to the ftp server. The command looks something like this:

> ftp -s:commands.txt 192.168.1.101

In essence, connect to 192.168.1.101 and execute the commands listed in commands.txt.

What does commands.txt contain? How about this:

anon
bin
prompt
lcd backups
lcd R1
mget *.*
quit

What does this do? Let’s go over each line:

  1. anon - You don’t have to use anon here, but you have to login to the FTP server when you connect.
  2. bin - Switch to a binary mode connection. If you stay in the default ASCII mode, your binary TP and VR files may be corrupt.
  3. prompt - Don’t prompt the user to enter yes/no to confirm commands
  4. lcd backups - Change the local directory to ./backups
  5. lcd R1 - Change the local directory to ./backups/R1
  6. mget *.* - Download all files on the robot MD:/ device to ./backups/R1
  7. quit - Quit the FTP connection

You can type help after establishing your FTP connection to get a list of possible commands. You can also type ftp --help on the command line to get a list of options for the client.

Windows Batch Files

Now that you know how to use the command prompt and the command line FTP client, let’s learn a little bit about batch files. From the Wikipedia article:

A batch file is a type of script file in DOS, OS/2 and Windows. It consists of a series of commands to be executed by the command line interpreter, stored in a plain text file. A batch file may contain any command the interpreter accepts interactively and use constructs that enable conditional branching and looping within the batch file, such as "if", "for", "goto" and labels.

Batch files let us create little command scripts to automate repetitive tasks. I won’t go over the entire command interpreter here, but this seems to be a pretty comprehensive guide.

Batch Files + FTP

Finally, the good stuff: this is how I maintain consistency when working on multiple robot cells.

First, TP programs. Whenever possible, I try to keep the programs exactly the same on each robot. I usually start by developing my programs locally and using a simple batch file to load them on all the robots:

ftp -s:deploy.txt 192.168.1.101
ftp -s:deploy.txt 192.168.1.102
ftp -s:deploy.txt 192.168.1.103
...

deploy.txt might look something like this if you have the ASCII upload option.

anon
bin
prompt
mput src/*.ls
quit

If you don’t have the ASCII upload option, but you do have ROBOGUIDE, you can use the maketp utility to convert your LS files to binary TP files with another batch file, translate.bat:

for %%f in (bin/*.tp) do del bin/%%f
for %%f in (src/*.ls) do maketp src/%%f bin/%%~nf.tp

First I delete all the existing binary files in the ./bin directory, just in case maketp fails and I don’t notice. Second, I translate each LS file in the ./src directory to its corresponding TP file in the ./bin directory. See more on the for command (including what that %%~nf does) here.

My process then for keeping things in sync is as follows;

  1. Make a program change. If it’s on the robot, make sure to update my local LS files
  2. > translate
  3. > deploy

A couple of things to watch out for:

  1. maketp may not succesfully translate your LS file if there’s a parse error or if it doesn’t feel like it. (It fails inexplicably sometimes.) Watch the command prompt output for these errors. (Bonus points for anyone who can write another batch file to watch out for these errors.)
  2. The robot will not let you overwrite a file if it’s currently selected, being edited or running. Make sure to ABORT ALL and SELECT some other program before deploying. (Bonus points for anyone who can write a batch program to do this automatically… telnet?)

What else?

Maybe you want to sync the position and numeric registers on all your robots. Write one program to grab the files from your “master” robot:

get_regs.bat
------------
ftp -s:get_regs.txt 192.168.1.101

get_regs.txt
------------
bin
anon
prompt
get numreg.vr
get posreg.vr
quit

…and another one to update your other robots:

put_regs.bat
------------
ftp -s:put_regs.txt 192.168.1.102
ftp -s:put_regs.txt 192.168.1.103
ftp -s:put_regs.txt 192.168.1.104
...

put_regs.txt
------------
bin
anon
prompt
put numreg.vr
put posreg.vr
quit

Combine them into a single program or create another one that does everything:

update_regs.bat
---------------
get_regs
put_regs

As you can see, just a little command line automation can make your robot programming go a lot smoother. Let me know in the comments if you have any other little scripts that make your life as a robot programmer easier.


There's more where that came from.

I email (almost) every Tuesday with the latest insights, tools and techniques for programming FANUC robots. Drop your email in the box below, and I'll send new articles straight to your inbox!

No spam, just robot programming. Unsubscribe any time. No hard feelings!