last revision 2008-06-18

ROBOFORTH II v11

© David N Sands 1982-2008

PROGRAMMERS REFERENCE MANUAL

CONTENTS

----+----+----
  • Foreword.....................................1.1
  • Introduction.................................1.2
  • Getting Started..............................1.3
  • FORTH and ROBOFORTH II rudiments.............1.4
  • FORTH words you need to know.................1.5
  • INITIALISING 2
  • Initialising.................................2.1
  • Motor drive controls.........................2.2
  • Gripper......................................2.4
  • Home Position................................2.5
  • Calibration..................................2.6
  • Calibration axis sequence....................2.7
  • MOVEMENT 3
  • Joint co-ordinates...........................3.1
  • DSP moves....................................3.1
  • Positional data..............................3.1.1
  • Cartesian co-ordinates.......................3.2
  • Cartesian Points.............................3.2.1
  • Tool transformations.........................3.2.2
  • Encoders.....................................4
  • Speed .......................................5
  • Acceleration ................................5.1
  • Micro stepping ..............................5.2
  • Teach Pad....................................6
  • Stop button..................................6.1
  • TEACHING 7
  • Starting a new project.......................7
  • Learning positions...........................7.1
  • Routes.......................................7.2
  • Putting FORTH words into Robot Programs......7.2.1
  • Sub-Routes...................................7.2.2
  • Matrices.....................................7.2.3
  • DSP commands, continuous path................7.2.4
  • Vectored execution...........................7.2.5
  • Speed and acceleration with continuous path..7.2.6
  • Straight Lines...............................7.2.7
  • Relative Cartesian routes....................7.2.8
  • Curve generation.............................7.2.9
  • Places.......................................7.3
  • Objects......................................7.4
  • Programming the procedure....................7.5
  • INTERACTION WITH THE ENVIRONMENT 8
  • Outputs......................................8.1
  • Inputs.......................................8.2
  • Searching....................................8.3
  • Timers ......................................8.4
  • Interrupts ..................................8.5
  • COMMUNICATION AND SAVING ON COMPUTER 9
  • Disk files ..................................9.1
  • Text files...................................9.1.1
  • Saving your work ............................9.1.2
  • Reloading your work .........................9.1.3
  • Saving/Reloading ROBOFORTH II ...............9.2
  • Data transfer protocol.......................9.3
  • Supervisory software.........................9.4
  • ActiveX controls ............................9.5
  • Serial ports ................................9.6
  • Turnkey operation............................10
  • INFORMATION 11
  • Testing......................................11.1
  • Errors.......................................11.2
  • Using a nest.................................11.3
  • Programming Techniques ......................12

  • 1.1
    FOREWORD

    by Dr. Ernest Appleton,
    Engineering Department, University of Cambridge, 1987
    
    Anyone who has sufficient interest in the rapidly developing  
    technologies of computing and robotics will probably be aware of  
    languages for programming computers and they may even have  
    already used a small desk-top robot. Although there are some  
    significant differences between these robots and their larger  
    relations used in modern industry the underlying technology is  
    essentially  the  same  and the amateur  and  professional  
    technologist can both learn much from such systems. Most readers  
    will be aware of the computer language BASIC and have used or  
    know of other languages such as FORTRAN or PASCAL. Those readers  
    who have used a desk-top robot and those who are familiar with  
    industrial robots that use programming languages will already  
    know that the natures of these systems are essentially similar  
    and that their programming languages can be described as BASIC-  
    like.  However, the computer language FORTH is quite different  
    from the languages BASIC, PASCAL etc. in its construction and as  
    a  consequence the FORTH based robot programming  language  
    ROBOFORTH II is quite different to the usual robot programming  
    languages found in other commercial robot systems. 
    
    By way of introduction to ROBOFORTH II a brief outline of the  
    language FORTH is useful.  FORTH was developed by Charles H.  
    Moore in 1969 and was specifically intended as a computer  
    language for the control of equipment.  As a high level language  
    which is fast to execute but requires little memory space it is  
    ideally suited to the control of robots and there are several  
    research groups around the world who have recognised this fact.  
    One of the most powerful features of FORTH and its derivative  
    ROBOFORTH II is the fact that it is extensible. The programmer  
    is able to define new instruction words which consist of  
    combinations  of existing instructions allowing the  system  
    designer to develop a task specific language which is not only  
    appropriate to the particular application but is optimum in terms  
    of the the instruction set required for that task. The fact that  
    the programmer generates his own language means that the words  
    and phrases used within the language are those usually applied to  
    the task and can be understood by the expert and newcomer alike. 
    
    Thus ROBOFORTH II is a new approach to robot programming and the  
    possibilities have not been fully explored. ROBOFORTH II offers  
    a low cost opportunity for the expert and beginner to be at the  
    very forefront of a new and exciting technology.
    
  • Back to contents page

    1.2
    INTRODUCTION

               by David N. Sands, author of ROBOFORTH II
    ROBOFORTH II is an extensive robot control language designed to cover every eventuality in programming your robot, whether it be coating, assembly, laboratory handling, testing, or whatever. There are diverse means of acquiring spacial data and using it such as matrices, continuous path, object tracking, collision avoidance, plus numerous input-output features making it easy to interface with and control peripheral equipment at the same time as control the robot arm. Above all ROBOFORTH II is a real language i.e. has an extensive vocabulary of words which, like a natural language, help you express your ideas to the system. As a language ROBOFORTH II is a means of communication between the human user and the robot arm: for the user to tell the robot what to do and how to do it; for the robot to tell the user what it is doing and what it knows.

    FORTH and ROBOFORTH II are organized as a linked list of words known as the dictionary. Together with each word in the dictionary is its definition which is usually in terms of words lower down in the dictionary except for 'primitives' at the bottom which are coded in machine language. Programming in FORTH and ROBOFORTH consists of entering new words into the dictionary whose definitions are in terms of words already defined. New words may include data e.g. positional information about the robot. Data (or arguments) are passed between words on a stack.

    Any given position of the arm may be specified as co-ordinates relative to a central position for the arm known as the HOME position. In ROBOFORTH II these co-ordinates are in terms of the movement required by the motors of the arm to reach that position i.e. number of stepping motor pulses counted from the HOME position. Alternatively they may be expressed in millimetres in Cartesian X,Y,Z co-ordinates. To teach the robot you first move the arm to the required position using any of the means provided and secondly record the co-ordinates of that position. When replayed the arm moves from one position to the next in turn (point-to-point programming). Each position is a list of 16 bytes containing flags to indicate what kind of data it is e.g. Cartesian co-ordinates etc.

    In ROBOFORTH II there are various means of moving the robot and various ways of teaching the robot. These are distinctly separate. In practice the procedure is to first move the robot to the desired position then learn it. Similarly the gripper must be operated and learned as two separate operations. All positions and motions have names which are then used to create the 'program' or words which define the global function of the robot. Error conditions can be re-programmed so, for example, you can determine what the robot does and what happens to the associated equipment in the event of the stop button being pressed or a stall because of jammed product. These and other features make ROBOFORTH II the most powerful robot control system in existence.
  • Back to contents page

    1.3
    GETTING STARTED

    Assuming all robot software is loaded into a directory ROBOT then communication is established by running robwin.exe

    ROBWIN v6.5.1 (Visual Project Management System)

    Double click on robwin.exe or the blue robot icon. . IMPORTANT: Press caps lock. All ROBOFORTH commands are in upper case.

    Once Robwin is loaded you will see two windows. The lower window is for direct communication with the robot, called the console window. It can be stretched vertically and a scroll bar enables you to look back at things you typed before. Any keystrokes in this window go straight to the robot controller. Commands are interpreted by the robot controller and not by the computer. Some commands have shortcuts in Robwin, for example the row of buttons across the top of the upper window. Clicking a button simply inserts that command into the communication window. Robwin permits easier teaching and programming of the robot by organizing commands and data and sending them directly to the robot controller.

    Press enter in the console window and you should see OK. If not try the following: 1. turn the key to cold start. 2. Press reset. You should see a simple herald and the words cold start. Type the word ROBOFORTH (in caps) and press enter. you should see OK, a new line and a > prompt. The system is now ready for use.

    Any command you type goes direct to the controller and any controller response is sent to this window.

    In the upper window click 'project', 'new', and give your project a name such as 'test'. Three panes appear in the upper window. One is labelled 'routes' (see later), one 'places' (see later) and one labelled (name).ed2 in this example test.ed2. See later for this also.


    1.4
    FORTH AND ROBOFORTH II RUDIMENTS


    ROBOFORTH II may be used without any knowledge of FORTH but some ground rules are helpful. A glossary of the FORTH words used in the ST robot systems is given in the system manual. I recommend you read one of the books listed in section 12.

    Throughout this manual the user's entry will be written in UPPER CASE, GREEN UNDERLINED but not the computer's response e.g.:-
    TELL OK
    You press the return key after typing TELL and the computer answers OK. I won't keep repeating that you need the return key after the command or after a line of commands.

    Where commands have ROBWIN shortcuts the ROBWIN key, button or mouse sequences are indicated with the ROBWIN icon:

    1.4.1 Command Line

    Commands are words which you type in followed by the return key. All commands in FORTH and ROBOFORTH are in upper case. Commands may have lower case but they are different commands. It is easier just to press caps lock and stay in upper case. Sometimes a string of commands are required; these are typed on one line separated by spaces e.g.
    ( don't type this )
    TELL TRACK OK

    You press the return key after the last word and the computer answers OK when it successfully completes the whole line - provided there has been no mistake as in the following:-
    TELL TRUCK TRUCK NOT DEFINED - the word 'TRUCK' was not understood.

    As stated in the introduction, all the words in FORTH and ROBOFORTH II are organized as a linked list or "dictionary". With each word in the dictionary is kept its definition, as with a conventional dictionary. Each word in the command line is looked up in the dictionary and its "meaning" is executed. If FORTH cannot find the word it tries it as a number and converts it to a value. If that fails the word is rejected and the rest of the line ignored. One thing to remember is that all words are stored in the dictionary as a length plus the first 5 characters of the word. Therefore ambiguities are possible and should be avoided (such as ROBOT1 and ROBOT2 which are the same length and have the same 5 starting characters). Note that sometimes two English words make up one ROBOFORTH word e.g. GOTO or ISAT.

    Words may be made up of any characters and any number of characters. It is a convention that many of the more basic words in the FORTH 'kernel' have agreed pronunciations, for example . (dot) is the shortform (there is no long form) for PRINT and is pronounced "print", ! is pronounced "store", @ is pronounced "fetch" and so on. Pronunciations will be given as they arise.

    1.4.2 Arguments

    Arguments are values used by any function or command e.g. in
    100 MOVE
    the argument is 100 and is typed in before the command which needs it.

    The BASIC expression 5 + 6 uses INFIX notation. In FORTH we write 5 6 + which is POSTFIX notation. This is because the values 5 and 6 are placed on a STACK for use by +. A stack is an area in memory into which values are temporarily stored on a last-in first-out basis. The answer is left on the stack for use by following words for example a period which means print the value on the stack. For example:-
    DECIMAL (return key) OK

    5 6 + . (return key) 11 OK

    What happened above was that the 5 went onto the stack followed by the 6, like playing cards. At this point the 6 is now on top of the stack with the 5 underneath it. + is a FORTH word (words can be spelled from any characters on your keyboard) which takes the 6 and 5 off the stack, adds them together and leaves the answer (11) on the stack. The next word '.' (dot) meaning print, takes the 11 off the stack and prints it on the screen. The stack is now empty again.

    1.4.3 - Definitions

    This principle is fundamental to FORTH. It is the building-block approach to programming.

    FORTH, in its basic form, consists of a "kernel" of some 150 or so "words" or commands, most of which are "primitives" i.e. they directly execute machine code whenever they are used. The programmer must define new words in terms of words already in the kernel. He/she can then define higher level words in terms of words he/she has already defined plus words from the kernel as necessary. These new words are added to the existing dictionary.
    Hence the programmer begins by defining short concise procedures which can be tested individually. In this way the user builds up a range of fully tested modules which are then used to construct more powerful procedures, and so on until the final application 'program' is complete, which can be just one word. The modular approach imparts a very high degree of confidence to the final application.

    New procedures are created using a colon sign, followed by the name of the procedure, then the definition ending with a semi-colon, for example-

    : TANKS? LEFT-TANK RIGHT-TANK + . ;

    Now all you have to do is type TANKS? to yield the total in both tanks, or alternatively TANKS? can be included in the definition of some grander procedure.

    The colon : is also called a word as words may be made from any ASCII characters. Moreover it is called a 'defining word'.

    1.4.4 - Integers

    The standard representation of a number in Forth is a 16 bit integer. A single stack entry is a 16-bit value. Arithmetic is done with 16-bit twos complement values in the range -32768 to +32767 unless unsigned integers are specified (0-65535). If necessary 32 bit values may be used. These occupy 2 stack places and are normally only used to assist with scaling i.e. mixed precision arithmetic. Floating point arithmetic is also possible in FORTH but integer arithmetic is preferred. Even trigonometry can be performed using integers (see controller manual) with an implied decimal point.

    For more detailed information on FORTH and this version of FORTH please see:
    Understanding FORTH
    Structure of FORTH
    Keeping track of the stack

  • Back to contents page

    1.5
    FORTH words you need to know

    The FORTH words are not part of ROBOFORTH but exist at the bottom of the dictionary. They support the higher level ROBOFORTH words. While many of these words are esoteric there are some that are really useful or even essential for writing any kind of software that goes beyond the basics, for example changing speed, I/O etc. The following FORTH words are worth knowing. For details of all the FORTH words see the system manual. It is possible to do really complex tasks using both FORTH and ROBOFORTH.

    1.5.1

    Although the stack is used extensively to pass arguments, variables also exist and are handled with the words ! (pronounced "store") and @ (pronounced "fetch"). A variable is just a word which leaves its address on the stack. The actual address is unimportant.

    A new variable is created with the word VARIABLE e.g.
    VARIABLE TOPSPEED
    creates a new variable with the name TOPSPEED. VARIABLE is a defining word. The word ! (exclamation mark) means "store the second value down on the stack into the address which is the top item on the stack", for example 12 1000 ! means "store the value 12 into address 1000". In the process both numbers are used up leaving the stack empty.

    To put a new value into the variable TOPSPEED use the syntax e.g.
    2000 TOPSPEED !
    Which means store the value 2000 into the address TOPSPEED
    Remember TOPSPEED is just a location in memory which has a name.

    @ means "fetch the contents of the address on the stack and leave it on the stack". In the process it uses up that address. For example
    TOPSPEED @
    gets the current value of TOPSPEED and leaves it on the stack for another word to use up, for example the period . which means "print".

    The current value of TOPSPEED could be found with
    TOPSPEED @ . (pronounced "topspeed fetch print")

    or the easier form
    TOPSPEED ?

    Data can be transferred from one variable to another with e.g.
    TOPSPEED @ SPEED !

    NOTE: all numbers in FORTH are 16 bit twos complement integers i.e. values between 32767 and -32768. There is the option of 32 bit numbers (double precision). In Cartesian mode co-ordinates are expressed as integers times 0.1mm i.e. 1000 equals 100.0 mm. In this version of FORTH the decimal point may be inserted just for readability i.e. you can enter 100.0 or just 1000 as you wish.

    You can also create a variable with the word USER.
    When you use VARIABLE (word) the actual value of the variable is stored in the parameter field of the new word as per standard Forth practice. See the structure of a Forth word in the controller manual. However if the text around this word is edited then recompiled (reloaded) then the actual address of the data may change. There is another way of creating a variable with
    USER TOPSPEED
    This stores an address is the parameter field which points to a location in a reserved memory area called the User memory. The contents of this are unchanged after a reload. If USAVE is used then the contents of user variables are reloaded from FLASH ROM after a reset or power-up. There is a pointer to this memory UVP which is incremented each time a new USER variable is created. If you FORGET a user variable the pointer is restored to the previous user variable. Typing the word ROBOFORTH restores the pointer to the start of the user memory.

    High Memory The controller has two banks of memory. All the positional data you teach the robot is stored in high memory, bank 1. All your software, variables etc are in low memory, bank 0. The words @ and ! refer only to low memory. To access high (extended) memory (which is rare) you would use E! and E@. For example MOVES is a pseudo-variable in high memory so to read it you would use MOVES E@ (see controller manual for details on high memory). MOVES automatically sets BANK to 1.

    1.5.2 Conditional Branching

    Conditional branching words are IF...THEN, BEGIN...UNTIL and DO...LOOP. These words cannot be used in command mode but must be incorporated into new words (new definitions).

    As already stated arguments are passed on a stack. A condition is a numerical argument for such words as IF, WHILE and UNTIL.
    The structure of an IF statement is this:
    (condition) IF (action) THEN
    a condition is false if its value is zero or true if non zero. If the condition is true (non-zero) then all of (action) is executed but if false (zero) then the program flow branches immediately to the words following after THEN. The word THEN closes the IF statement like ENDIF in Pascal. In BASIC the close of an IF statement is the end of the line.
    A condition may be set up with comparing words such as = > and < but the result of any calculation may be used.
    Examples of conditions are:
    2 4 = leaves zero on stack i.e. false
    2 2 = leaves a 1 on stack i.e. true
    PRESSURE 100 > leaves true (non-zero) if the word PRESSURE leaves any value on the stack which is greater than 100.
    Example:
    : PRELIEF PRESSURE 1000 > IF VALVE OFF THEN ;
    Other conditional statements are:
    (condition) IF (action1) ELSE (action2) THEN
    This executes action1 if condition is true and action2 if it is false (zero).
    Example:
    : PCONTROL PRESSURE 1000 > IF VALVE OFF ELSE VALVE ON THEN ;
    or, the same but more efficient:
    : PCONTROL VALVE PRESSURE 1000 > IF OFF ELSE ON THEN ;
    BEGIN (action) (condition) UNTIL
    This executes action in a loop and repeats until the condition is true.

    BEGIN (action1) (condition) WHILE (action2) REPEAT
    This executes action1 then repeats action1 and action2 until condition is met. Then action1 is executed once and action2 is skipped; execution continues after the word REPEAT. Don't forget you do not have to have any action at all e.g.
    BEGIN (condition) WHILE (action2) REPEAT
    does (action2) while (condition) is true then when (condition) is false it drops through.
    or
    BEGIN (condition) UNTIL
    which just 'traps' until the condition is true.
    Example:

    : FILLUP VALVE ON BEGIN PRESSURE 1000 > UNTIL VALVE OFF ;
    Another kind of loop is a counting loop:
    (upper-limit) (lower limit) DO (action) LOOP
    This executes action starting with the index of the loop equal to lower limit and repeats until the index of the loop is equal to the upper limit. The index is incremented by one after each action i.e. by the word LOOP. As soon as the index equals the upper limit the word "drops through" so action is not executed when the index is actually equal to the upper limit. The index itself may be accessed with the word I
    For example:
    : TEST 5 0 DO I . LOOP ; OK

    TEST 0 1 2 3 4 OK

    Other variants are:
    (upper limit) (lower limit) DO (action) (increment) +LOOP in which the increment can be other than one, e.g.

    : TEST 7 0 DO I . 2 +LOOP ; OK

    TEST 0 2 4 6 OK
    The index may be negative, e.g.
    : TEST 0 5 DO I . -1 +LOOP ; OK

    TEST 5 4 3 2 1 0 OK

    (u/limit) (l/limit) DO (action) (condition) IF LEAVE THEN LOOP
    If condition is met then the loop terminates immediately.
    (u/limit) (l/limit) DO (action1) (condition) IF LEAVE THEN (action2) LOOP
    If condition is met then action2 is execute once then the loop terminates.

    To get a task to repeat indefinitely the BEGIN .. UNTIL loop is most common. A good way to terminate the loop is with the word ?TERMINAL which leaves true on the stack if the escape key is pressed. Suppose you have a word TASK which does one cycle of whatever the robot has to do. Then enter a definition thus:
    : TEST
    BEGIN 
     TASK 
    ?TERMINAL UNTIL 
    ; 
    
    Then run it with
    TEST

    This will repeat TASK indefinitely until the escape key is pressed. Note that the robot will not stop until it has completed the current TASK. Then the escape key is tested. So to finish the TEST press escape key, wait for the current TASK to complete, then the OK prompt appears on the screen.

    For all the other low level FORTH words refer to the system manual (section C).
  • Back to contents page

    2.1
    INITIALISING

    When power is switched on or if the reset button is pressed then ROBOFORTH is transferred from flash memory to high speed static RAM. If this is done while the front panel switch is in the cold start position then the FORTH dictionary will be initialized and pointers set to the start of the user's dictionary. (This has to be done at least once with a virgin system.)
    The dictionary can then be extended by the user but this extension will be lost if another cold start is performed or if the word ROBOFORTH is typed.
    After a cold start press return once and enter the word ROBOFORTH.
    Relevant initializing words are:

    ROBOFORTH
    Strips off any user's words from the dictionary and restores the ROBOFORTH vocabulary.

    ORG
    This is the address of the cold start entry point for the FORTH kernel. Hence a cold start may be performed with:
    ORG JUMP

    START
    Initialises the robot controls, energising the motors and setting default values to things like speed etc. These variables may be manipulated after START has been used.
    click

    START should always be followed by CALIBRATE (see later)
    Often it is desirable to redefine START inside your text window (test.ed2). See section 9. for example:

    : START ( this is defining a new word called START
    START ( this is the original definition of START followed by..
    15000 SPEED ! ( change speed according to application needs
    ; ( end of definition

    Remember to type or execute START after loading the text from the .ed2 window. Normally the next thing to type would be CALIBRATE (section 2.6)

    NORMAL
    Restores all the variables like speed which affect the robot motion back to the default values set by START.

    2.2
    MOTOR CONTROL

    DE-ENERGIZE or DE-ENERGISE
    De-energizes all motors. Joints may then be moved by hand.
    ENERGIZE or ENERGISE
    Energizes (or energises) the motors.

    2.3 MOTOR FLAG BYTES


    There are several motor flag bytes in which bit 0 controls motor 1 (waist), bit 1 controls motor 2 etc.
    MEP - Motor Enable Pattern - bit is set by typing the joint name.
    MDP - Motor Direction Pattern - bit is set by system depending on direction motor is to move. Set to a 1 for reverse direction e.g. a negative argument or the word REVERSE.
    MSP - Motor Sense Pattern - invokes a sub-count or local motor step count separate from the main counts - see sub-routes.
    MCP - Motor Calibrate Pattern - determines which motors are to run in ONLIM and OFFLIM.
    EEP - Encoder Enable Pattern - enables encoder check on motor if bit is set.
    EFP - Encoder Fitted Pattern - bit set means motor has an encoder fitted.
    EFP is a constant - to read its value enter:
    EFP .
    The other flag bytes are like variables. To read a value enter:
    EEP ?

  • Back to contents page

    2.4 GRIPPER

    To operate the gripper enter:
    GRIP
    to close gripper

    UNGRIP to open gripper

    With an electric gripper using the command a second time yields an error message "Already open" or "Already closed" and the ERR variable is set to 21, but the system does not abort. The message is for information only.

    Click

    Time is allowed for the gripper to operate so that the robot arm does not move on before the gripper has finished opening/closing. This time, in milliseconds, is in the variable TGRIP. To change use the syntax: (new value in milliseconds) TGRIP ! e.g.
    1000 TGRIP !
    allows 1000 milliseconds before the robot moves on.

    For pneumatic grippers this delay is short e.g. 300 mS. In the case of the electric grippers the delay is longer e.g. 500 mS.

    There is another variable which may be useful:
    FGRIP - a flag set to 1 when the gripper is closed or 0 when open. This variable is used by ROBWIN.
    However to find out whether the gripper is actually open or closed enter
    GRIPPER BIT? which leaves true if the gripper is closed or zero if the gripper is open.

    UNGRIP also clears any object from the WHERE display (i.e. from the variable OBJECT-HELD)

    The gripper can also be operated with
    GRIPPER ON
    or
    GRIPPER OFF

    These by-pass the timer TGRIP and do nothing with FGRIP or OBJECT-HELD.
    The above commands apply only to the pneumatic gripper.
    FOr the electric gripper GRIP closes the gripper and leaves power on the motor. UNGRIP pulses the motor in reverse for a long enough time to open it and this is controlled from PA 1. So while GRIPPER ON will close the electric gripper GRIPPER OFF will not open it but merely de-energize it. To open the electric gripper you also need to pulse PA 1 e.g.
    GRIPPER OFF PA 1 ON TGRIP @ MSECS PA 1 OFF
    To open the electric gripper without waiting for it, for example during a motion:
    GRIPPER OFF PA 1 ON (motion) PA 1 OFF
    We don't advise leaving PA 1 on and the motor energized in the open direction but no harm would result.

    2.4.2 GRIPPER CONFIRMATION

    The gripper confirmation on a gripper is set to give a different state between gripped on an object and gripped on nothing at all. Ungripped may well give the same state as gripped on nothing but is irrelevant. With a vacuum pick-up a vacuum switch provides confirmation. If the object is not picked there is no vacuum.
    The gripper confirmation switch is usually connected to PB 6 but could be any input. A typical code would be:

    : GRIPCHECK
    PB 6 BIT? IF
        ." Grip fail" CR
        15 ABORT
    THEN
    ;
    
    You can re-enter this code in your own text, using a different message or error code.
    You could then use this definition in a new definition of GRIP e.g.
    : GRIP      ( new definition
    GRIP        ( old definition
    GRIPCHECK
    ;
    
    However this could leave the robot in a difficult place from which to recover so it is usually best not to make the check until the robot is in a safe place. For example:
    : GETPART
    TOJIG CONTINUOUS RUN
    JIG
    GRIP
    WITHDRAW
    TOJIG RETRACE
    GRIPCHECK
    ;
    
  • Back to contents page

    2.5 HOME POSITION

    WARNING
    Before trying any of the following commands be sure to
    KEEP OUT OF THE ROBOT ENVELOPE

    As mentioned earlier all spatial positions around the robot arm are expressed (in most circumstances) as co-ordinates relative to the HOME position of the arm where the co-ordinates are all zero. On an R17 this is bolt upright. On an R19 it is with the lift axis near to lowest travel and the extend axis almost fully retracted. In both cases the waist is at mid-point of available travel.
    Wherever the robot happens to be after typing START is assumed to be the HOME position but the true home position must be established with CALIBRATE -- See calibration

    HOME

    click
    Note nothing will happen right now because the robot already is at HOME

    This is a place name which returns the robot to the home position where all counts are zero. You would not normally type this until you had calibrated the robot (See calibration.).

    In some applications the HOME position is not a safe one, for example where there is a ceiling too low for an R17 to be bolt upright. In this event you might want to add some programming to conditionally bar the HOME position, e.g.:

    : HOME
    CR ." Are you sure? "
    KEY DUP EMIT 89 = IF ( looking for capital Y )
       HOME
    THEN
    ;
    
    (for programming such things see later, section 9.1)

    SETHOME
    Wherever the robot happens to be can be made into a home position with this word i.e. all co-ordinates are set to zero. Not to be used without good reason.

    If the system is in LOCAL or RELATIVE mode then use SET-LOCAL-HOME to zero only the LOCAL counts.

  • Back to contents page

    2.6 CALIBRATION

    The home position can be accurately set up by making use of proximity detectors fitted to each axis.

    CALIBRATE

    click

    This drives all the axes to their proximity detectors , reports the errors then corrects them to the values in LIMITS.

    A single axis can be sent to the detector position with the command (e.g.)
    TELL TRACK DATUM
    More than one axis could be datumed with the line
    TELL (axis1) (axis2) (axis3) DATUM
    Suppose that axes 2 and 3 have to move backwards to their datum positions, the correct line would be:-
    TELL (axis2) (axis3) REVERSE (axis1) DATUM

    DATUM has two major components: ONLIM and OFFLIM. During ONLIM the axis moves onto the sensor. When it detects the sensor, i.e. the sensor input goes low, it decelerates. OFFLIM then reverses the axis at slow speed until it just clears the sensor (sensor input goes high).

    Other useful words are:-
    ONSPD is a constant determining the speed the axes move onto the sensors in ONLIM. It can be altered with (n) ' ONSPD !
    OFFSPD is a constant determining the speed the axes clear the sensor in OFFLIM. It can be altered with (n) ' OFFSPD !.
    MCP (Motor Calibrate Pattern) is a motor flag byte determining which motors are to run in ONLIM and OFFLIM.

    CHECK
    This will drive the arm to the proximity detectors and show the errors in positions obtained. The correct positions are to be found in the array LIMITS. Normally the difference would be about 2 or 3 steps and no more than 10 steps.

    LIMITS
    is a simple array of 8 2-byte values. The address of the value for the first axis or joint (waist or track) is LIMITS
    (try LIMITS ?) the value for the second axis (shoulder or extend) is at LIMITS 2 + (try LIMITS 2 + ?), 4 + for the next axis and so on.

    You can change the values of LIMITS by entering new values into individual elements of the array, e.g. 8000 LIMITS 6 + ! changes the value for the hand to 8000 etc. If the values in LIMITS must be changed, for example if a sensor is replaced, then the way to do it is as follows:

    1. Set a good home position using instruments.
    2. Reset the controller (writes a fresh copy of ROBOFORTH to RAM) 3. Enter
    START
    4. drive the robot to the sensors using
    CHECK
    5. Enter SETLIMITS
    6. Enter PSAVE
    which writes the memory image back to flash ROM
    Always be careful when using the command PSAVE. If you have damaged ROBOFORTH in any way you will be saving the damaged image back to flash ROM. If you need to you can reload ROBOFORTH from disk - see section 9.2

    Under some circumstances it may be desirable to re-calibrate a single joint individually. This can be done by driving that joint to datum then storing the correct value into the current position list (WHERE), e.g. for a HAND:-
    : HCAL TELL HAND REVERSE DATUM LIMITS 6 + @ 3 GLOBALS !;

    The accuracy of the robot after calibration depends on the repeatability of each axis and its sensor. This can be improved upon using a NEST

  • Back to contents page

    2.7 CALSEQ

    This word is present in R15 systems only.
    It is an array of 8 bytes used to determine the order in which the robot axes calibrate. To help understand this facility please see the words MEP (Motor Enable Pattern) and MDP (Motor Direction Pattern).
    In these patterns bit 0 (value 1) represents motor/axis 1; bit 1 (value 2) represents motor/axis 2; bit 2 (value 4) represents motor/axis 3; bit 3 (value 8) represents motor/axis 4 and so on.

    Normally the first byte would contain the MEP value for the first axis or axes to calibrate, for example if the first 5 axes were to calibrate simultaneously (like an R17) then the first byte (byte zero) of CALSEQ would contain all 5 least significant bits true, i.e.
    Byte 0: binary 0001 1111 i.e. all 5 bits high. Hex value 1F
    The next byte (byte 1) would contain the MDP required. If all axes need to drive in a positive direction (forward) to reach their proximity detectors except the extend and lift which need to drive in a negative (reverse) direction then this byte would contain as follows:
    Byte 1: binary 0000 0110 i.e. only bits 1 and 2 are high which correspond to motors/axes 2 and 3; hex value 06 All other bytes would be zero so
    CALSEQ DUMP would yield:

         00 01 .... *bb
    aa00 nn nn ..... 1F 06 00 00 00 00 00 00
    where aabb is the exact memory address of the data in CALSEQ and nn is the contents of memory prior to CALSEQ.
    (to continue a DUMP press space bar; to end press return/enter)

    To calibrate the axes one at a time, for example X then Y then Z axis: 01 xx 02 yy 04 zz
    where xx yy and zz would be the directions for these axes.

    Example for a HYPOTHETICAL 3-axis R15:
    04 - datum the Z-axis first
    04 - move it in reverse to find sensor
    02 - next datum the Y-axis
    02 - move it reverse
    01 - next datum the track/X-axis
    00 - move it forward
    18 - next datum the wrist pitch/roll unit, both motors together.
    08 - but the L-hand motor must run in reverse. (hypothetical only)
    So CALSEQ DUMP would yield:

       00 01 .... *bb 
    aa00 nn nn..... 04 04 02 02 01 00 18 08 00 00 
    

    Note: R17s calibrate all axes together and do not have CALSEQ.

  • Back to contents page

    3. MOVEMENT COMMANDS

    3.1 JOINT MODE

    Each joint can be moved by entering commands from the keyboard. Commands are of the form
    TELL [joint-name(s)] [amount] MOVE or MOVETO or STEPS. or
    TELL [joint-names(s)] followed by a mode instruction such as LOCAL, DATUM, FULL etc.

    The joint names for a revolute robot (R17) are WAIST, SHOULDER, ELBOW, HAND, WRIST. The R17 hand is driven by two motors, the WRIST motor and another motor which may be selected individually with the name L-HAND. If only L-hand is driven the wrist will roll while it pitches. Optionally the robot may be mounted on a track (R19T,R17T) and the track is called TRACK.

    The joint names for a cylindrical robot (R13,R19) are WAIST, EXTEND, LIFT and optionally HAND and/or WRIST. Optionally the robot may be mounted on a track and the track is called TRACK.

    The joint names for a Cartesian robot (R14,R15) are TRACK, EXTEND, LIFT and optionally HAND and/or WRIST.

    ALL selects all the joints at once.

    MOVE is a relative command, example:
    >TELL WAIST 500 MOVE OK
    or for a Cartesian robot:
    >TELL TRACK 500 MOVE OK
    The waist or track motor now moves 500 steps and these are counted by the system.

    Since we are still talking to the waist/track it is only necessary to enter:
    500 MOVE
    to get the waist/track to move another 500 steps. The waist/track will now be a total of 1000 steps from the home position.

    When the move is complete you can list the current position of the arm with the command WHERE. This displays the number of steps each motor has moved since it was at the HOME position.
    >WHERE

    For an R17 the result is:

                                     **  
          WAIST  SHOULDER  ELBOW  L-HAND  WRIST    OBJECT  
           1000       0       0       0       0 
    ** This header is because in the R17 hand pitch is achieved by running both motors 4 and 5 together but wrist roll requires only motor 5. If only motor 4 (L-HAND) runs then the wrist rolls in the opposite direction.

    For an R19 this results in:

    
          WAIST    LIFT   EXTEND   HAND   OBJECT  
           1000       0       0       0  

    For an R19T with hand yaw and track this results in:
     
          WAIST    LIFT   EXTEND   HAND   TRACK    OBJECT  
           1000       0       0       0       0  

    For an R15 this results in:
     
          TRACK    LIFT   EXTEND  WRIST  OBJECT  
           1000       0       0       0  

    and various other combinations. The particular heading depends on the model and configuration of the robot. It can be invoked by itself with JOINTHEAD

    click Robot, Joint position.

    Actually there will be two more lines below the motor position. The second line shows the actual counts obtained from the encoders. The third line is the count multiplied by a factor determined by encoder resolution and gear ratios and is the computed true position which should be the same as the motor position within a few bits, for example

          WAIST  SHOULDER  ELBOW  L-HAND  WRIST   OBJECT        (R17)  
    or    WAIST     LIFT  EXTEND   HAND   TRACK   OBJECT        (R19T) 
    or    TRACK     LIFT  EXTEND   HAND   WRIST   OBJECT        (R15)  
           1000       0       0       0       0  
            642       0       0       0       0  
           1001       0       0       0       0  

    If the system is in LOCAL mode then the local position will be the second line with the encoder values in lines 3 and 4.

    More than one joint at a time can be moved with e.g.
    TELL SHOULDER ELBOW 1000 MOVE
    or
    TELL LIFT EXTEND 1000 MOVE

    click Robot, Joint Rel move.

    Repeated use of MOVE continues to move the same joints relative to their previous positions. The joint selection is cancelled with TELL.
    Movement in the reverse direction is achieved with negative values e.g.
    -1000 MOVE

    Another way of moving backwards is with e.g.
    TELL WAIST REVERSE 1000 MOVE (or TRACK or whatever)

    An axis can be made to move to a particular position with e.g.
    TELL WAIST 1500 MOVETO
    click Robot, Joint Abs move

    The waist then moves forward or backward as necessary to finish at 1500 steps from the home position.

    The wrist twist may be moved with TELL WRIST (n) MOVE but may also be moved with (n) TWIST a relative command.
    The wrist may be restored to the zero position with
    UNTWIST an absolute command.

    The array which contains the counts for each motor is called GLOBALS and is addressed with (n) GLOBALS where n is 0 for the first motor, 1 for the next etc. e.g.
    0 GLOBALS ? 1500 OK
    It could be changed with e.g.
    1501 0 GLOBALS !

    The simplest motion command is STEPS e.g.
    >TELL WAIST 500 STEPS OK (or TRACK or whatever)

    The waist or track motor now moves 500 steps, but these are not counted by the system. WHERE will show, in the encoder lines 2 and 3, that the axis has moved but there will be no count in line 1.

    To step a selected motor one only use STEP DELAY. The DELAY is necessary to ensure that the next STEP is not issued too quickly and successive STEP DELAY in a loop will result in continuous motion but at limited speed. To determine the length of DELAY (and therefore speed) put a value in microseconds into the variable TSTEP. Typical value for a low speed would be 100 which means 100 microseconds between system steps. A higher value is a lower speed.
    Example using some of the above words:

    : SHOVE 
    500 TSTEP ! (set speed) 
    TELL EXTEND (select extend joint) 
    100 0 DO STEP DELAY LOOP (move 100 steps at constant speed) 
    100 2 GLOBALS ! (update WHERE) 
    ; 

  • Back to contents page

    DSP Moves

    All moves are controlled by the DSP however the DSP may told to do the move without monitoring by the CPU, freeing the CPU for other action. To move a joint with the DSP alone use the form:
    TELL WAIST 5000 DSPMOVE
    You will notice the system comes back immediately with OK while the robot is still moving. Do not issue another movement command until the robot has stopped moving. You can determine when the DSP has finished with ?RUN and other commands, see section 7.2.4

    WARNING The robot will not stop when you press the stop button. To stop the robot execute the command STOP (part of a program or type it quick)
    This tells the DSP to stop moving the robot.
    When the robot has stopped WHERE will show the robot to be still where it was before you executed DSPMOVE therefore you must, as soon as DSPMOVE has finished, or at worst before you execute the next command, execute
    DSPASSUME - this updates the counts from the DSP.

    WARNING In some circumstances there may be invalid values for the DSP parameters SPEED and ACCEL. For example a SPEED value of 1 would result in incredibly slow motion, appearing to be stationary. A negative value will produce undesirable effects. If in doubt enter realistic values e.g.
    5000 SPEED ! 1000 ACCEL !

    Back to contents page


    3.1.1 POSITIONAL DATA

    A robot arm position is stored in memory as a strip of 16 bytes, 2 bytes per joint followed by other data. The first two bytes are the count for the waist, the next two are for shoulder etc. In Cartesian mode the data is X, Y, Z, W, PITCH, TOOL-LENGTH, two bytes each. The 7th byte contains flags indicating whether the position is joint or Cartesian, relative or absolute.
    A JOINT position contains motor counts. This position GOTO sends the robot to where it's counts are the absolute values in this memory strip.
    A Cartesian position contains real engineering units X, Y, Z, W, Pitch, Tool length. GOTO sends the robot to this absolute position.
    If this position is marked as RELATIVE then the joints move BY the amounts in the memory strip i.e. the values in the position are added to the current position.

    There are 3 forms of GOTO: GOTO, -GOTO and XGOTO.
    (address) GOTO
    sends the robot to the coordinates stored at the address given. The robot arm moves to the position determined by the argument. All GOTOs expect the address of a 16-byte data strip on the stack. For example
    40000 GOTO
    assuming that address 40000 actually contains valid data. If not then the message "INVALID DATA" is issued.
    P1 GOTO
    where P1 is a point created with POINT (see section 3.2.1)

    (number) GOTO
    Sends the robot to the number of the line in a route.

    XGOTO sends the robot to the position stored at an address which can be in high or low memory. If the memory strip is in high memory then first select with BANK C1SET before using XGOTO.
    BANK C1SET 64 XGOTO

    (address) -GOTO ("dash-goto")
    is a faster form of GOTO which assumes that the co-ordinates in the data strip are joint (motor) and not Cartesian co-ordinates and performs no checks. The data must be only in low memory (bank 0). This makes it suitable for use with functions which always produce a result in low memory, for example TRANSFORM -GOTO

    To see what the data is enter:
    VIEW (address of data)

    Two positions may be added together and the robot sent to the result. For example:
    (address1) (address2) ADD GOTO

    A joint position may not be added to a Cartesian position. Two absolute positions may not be added together. If a relative position is added to an absolute position the result is a new absolute position. If two relative positions are added the result is a new relative position.

    You can create positions in the dictionary by use of the word CREATE in your text window, for example
    CREATE NEST 1000 , 2000 , 3000 , 4000 , 5000 , 0 , 0 , 0 ,
    creates a strip of data in the dictionary itself with the name NEST and with the values as shown for each joint. NEST GOTO
    sends the robot to this position.
    The 7th byte of this strip contains flags as follows:
    0 Joint mode
    1 Joint relative mode
    2 Cartesian mode
    3 Cartesian relative mode
    so
    CREATE APR 0 , 0 , 50.0 , 0 , 0 , 0 , 3 , 0 ,
    is a relative Cartesian position. If you type APR GOTO
    Then the robot will move up exactly 50mm. Each time you type APR GOTO it will move up another 50mm.
    The last byte MUST be zero.

    The robot's position can be changed to the data in an address with
    (name or address of position) ASSUME
    for example LIMITS ASSUME
    POSITION is a variable which contains the address of the last position the robot was at.

    If, using MOVE or GOTO (but not DSPMOVE or DSPSMOOTH) the stop button is pressed and a task is programmed (i.e. using STOPVEC, See section 6.1) then the DSP will stop but will continue again when the task is complete.

    You may use the command (position) DSPSMOOTH where (position) is the address of a co-ordinate, for example
    1 LINE DSPSMOOTH
    The DSP will pass control back to the CPU immediately even while the robot is running so the CPU can do something else. You can determine when the DSP has finished with ?RUN and other commands, see section 7.2.4

    WARNING The robot will not stop when you press the stop button. To stop the robot execute the command STOP (part of a program or type it quick)
    This tells the DSP to stop moving the robot.

    In an emergency press the reset button.

    ?STOP
    is a loop which waits for the DSP to finish. If the stop button is pressed during this time the DSP is sent the STOP command and the robot stops. As long as the CPU is in command mode or executing some other command the stop button is ignored.

    When the robot has stopped WHERE will show the robot to be still where it was before you executed DSPSMOOTH therefore you must, as soon as DSPSMOOTH has finished, or at worst before you execute the next command, execute
    DSPASSUME - this updates the counts from the DSP.

  • Back to contents page

    3.2 Cartesian MODE

    Positioning the arm by telling each joint how much to to move is accomplished in JOINT mode. Instead the arm may be positioned by specifying a point in space by distances in 3 axes (x,y,z) from the origin. This is located at the center or rotation of thw waist axis on an R19, or on an R17 it is intersection of the axis of waist rotation and the axis of shoulder rotation. The z-axis is positive for all positions above this point and negative for all positions below this point. The x and y axes are as seen by the robot: x is left-right, positive x is right as seen by the robot or left to the user viewing from the front; y is fore-aft, positive y is in front of the robot. The part of the robot which occupies the set position on an R19 is the center of rotation of the hand or on an R17 it is inside the hand drive at the intersection of the axis of rotation of pitch and axis of rotation of roll.

    The software works to an internal precision of 0.1 mm and 0.01 degrees of angle.

    To select Cartesian positioning mode type:
    CARTESIAN
    click

    To return to joint mode enter
    JOINT
    click

    click Robot, Cartesian Absolute move.
    In the command window the action of MOVE, MOVETO and WHERE are changed. MOVE and MOVETO now require 3 arguments and no joint selection.
    The arm is positioned by commands of the form X Y Z MOVETO where X,Y and Z are integers of 0.1 mm, e.g.
    1000 2000 3000 MOVETO
    though it may look better as:
    100.0 200.0 300.0 MOVETO

    The software then performs a transformation from Cartesian to motor co-ordinates and drives the arm to X=100.0 mm, Y=200.0 mm, Z=300.0 mm. The message "CANNOT REACH" indicates impractical values entered. Also valid is MOVE e.g.
    0 0 -500 MOVE which performs a relative move downwards of 50.0mm.
    click Robot, Cartesian Relative move.

    The current co-ordinates of the end effector are displayed with the command WHERE which in Cartesian mode displays in an altered form:
    WHERE

             X       Y       Z     PITCH    ATT.    LEN.  OBJECT  
          100.0   200.0   250.0    -90.0     0.0     0.0  
    PREV    0.0     0.0     0.0      0.0     0.0     0.0  
    Where the values under X,Y,Z are displacements in mm.

    The line PREV is the previous position of the arm, so the co-ordinates in the first line move down to PREV after each move.
    To return to the PREVious position enter PREVIOUS

    click Robot, Cartesian position

    COMPUTE
    While in Cartesian mode the joint position (motor counts) can be viewed with JOINTWHERE. While in joint mode the Cartesian position can be viewed with COMPUTE CARTWHERE.

    NOTES:
    (1) WHERE only shows the current values of X,Y,Z,W,PITCH and TOOL-LENGTH. These are not necessarily where the robot actually is, for example after moving the robot with a PLACE or a GOTO with an address containing only joint co-ordinates or with the command -MOVETO then the robot will move but leave the contents of the Cartesian variables unchanged.
    To up-date the Cartesian variables use COMPUTE. This computes the Cartesian position from the motor counts. In most circumstances the system issues an error message if the user attempts to use MOVE when the Cartesian positions are not valid.

    (2) If you go back to the original position then type COMPUTE do not expect the co-ordinates to be the same as the ones you first used. There will always be a slight difference due to (a) the accuracy with which the robot can conform to the original Cartesian co-ordinates given and (b) the accuracy with which the conversion back to Cartesian co-ordinates can be made.

    (3) execution time is increased.

    There are 6 variables in Cartesian mode:
    X Y Z PITCH W TOOL-LENGTH
    These can be manipulated individually if required e.g.
    1000 X ! 2000 Y ! 3000 Z ! 900 PITCH ! etc. To make the robot move to these positions enter:
    TRANSFORM -GOTO

    At any time TRANSFORM will calculate the joint position (motor step counts from home position) and leave the address of this joint position on the stack. GOTO drives the motors to that position.

    CAN'T REACH If you get this error at any time it is because you told the robot to go to a position it is physically impossible to reach.

    Physical Constants

    The amount each axis moves for a given number of motor counts is determined by gear ratios which are represented in the software by constants:

    B-RATIO - (B for base) - the number of steps for axis 1 to move 90 degrees (or 1000mm if a linear axis)
    S-RATIO - (S for shoulder) - the number of steps for the shoulder axis (2) to move 90 degrees
    E-RATIO - (E for elbow) - the number of steps for the elbow axis (3) to move 90 degrees
    E-RATIO - (E for extend) - the number of steps for the extend axis to move 1000mm
    L-RATIO - (L for lift) - the number of steps for the lift axis to move 1000mm
    W-RATIO - (W for wrist) - the number of steps for axis 2 to move 90 degrees
    T-RATIO - (T for twist) - the number of steps for axis 2 to move 90 degrees usually the same as W-RATIO

    R15: the limits of travel in X, Y and Z directions are determined by the values in an array WORKSPACE. These values can be checked with:
    VIEW WORKSPACE

    Bytes 0,1: Max X travel (positive) 
    Bytes 2,3: Max Y travel 
    Bytes 4,5: Max Z travel 
    Bytes 6,7: Min X travel (negative) 
    Bytes 8,9: Min Y travel 
    Bytes 10,11: Min Z travel 

    To alter any value use this syntax: 
    (new max X) WORKSPACE ! 
    (new max Y)) WORKSPACE 2+ ! 
    (new max Z)) WORKSPACE 4 + ! 
    (new min X)) WORKSPACE 6 + ! 
    (new min Y)) WORKSPACE 8 + ! 
    (new min Z)) WORKSPACE 10 + ! 
    

    R19: the limits of reach are determined by four constants:
    MAXHT - maximum Z value, MINHT - minimum Z value,
    MAXLEN - maximum extension of extend axis (i.e. maximum radius),
    MINLEN - minimum extension of extend axis (i.e. minimum radius)
    The waist is also limited to plus/minus 180 degrees.
    R17: the limits of reach are determined by the trigonometry and by constants for the length of upper arm and fore-arm. These constants are UPLEN and LOLEN and both have the value 3750 (375.0mm from shoulder pivot to elbow pivot and 375.0mm from elbow pivot to wrist/hand pivot.) and the error is also given if you try to exceed plus/minus 180 degrees of waist rotation.

    3.2.1 POINTS

    Cartesian co-ordinates can be recorded in different ways: one is by using the defining word POINT e.g.
    POINT P1
    The current co-ordinates are recorded in the parameter field of P1 and may be viewed with:
    VIEW P1
    The robot will go to that position with:
    P1 GOTO

    which drives the arm to the co-ordinates of P1.
    To list all points created so far enter:
    POINTS

    Note: because POINT is a defining word, like VARIABLE etc., it cannot itself be compiled into another defining word. However you can include it in your text file by manipulating the Cartesian variables directly then creating a point, for example:
    100.0 X ! 200.0 Y ! 300.0 Z ! 90.0 W ! 0 PITCH !
    POINT P1

    In Cartesian mode all co-ordinates learned into a route are the Cartesian co-ordinates. This also applies to REPLACE.

    The joint co-ordinates may be learned instead with JL or a line can be replaced with joint co-ordinates with (line-number) JR. When in joint mode the equivalent Cartesian co-ordinates may be learned into a route by using CL instead of LL . For example it takes about 3 milliseconds on an R17 to convert Cartesian co-ordinates to motor movements. When a PLACE name is created the co-ordinates learned are already converted eliminating this time.

    Another way of using Cartesian commands is to position the robot, but then to create a PLACE name which will always contain joint co-ordinates even though the system is in Cartesian mode. You could then enter, say, 0 0 500 MOVE to lift the arm vertically, or use PLUNGE with a negative value then set the approach position with APPROACH (place-name).

  • Back to contents page

    3.2.2 TOOL TRANSFORMATIONS:-

    Initially it is the wrist pivot which actually occupies the specified co-ordinates. To make specified co-ordinates apply to the tip of the end effector enter the length of the end effector or tool into the variable TOOL-LENGTH. e.g.
    1000 TOOL-LENGTH !
    Alternatively use the command:
    TOOL
    This asks for the pitch of the wrist, the attitude of the wrist and the tool length, all of which can be different for the same x-y-z location in space. At the end of this sequence is the question EXECUTE? If you press Y the tool is immediately re- positioned but if you press N the TOOL parameters are not acted upon until the next time MOVE or MOVETO are used.

    R17 only:
    PLUNGE
    is similar to the VAL word APPRO. Whichever direction the end effector is pointing PLUNGE will move the end effector in that direction. For example suppose the end effector is at a PITCH of 45.0 degrees. then
    1000 PLUNGE
    will move the end effector 100.0 mm in the direction 45 degrees to Z-plane. This is a Cartesian word but works whether the system is in Cartesian or JOINT mode.

    ALIGN

    If the hand is vertical (i.e. PITCH = 90 degrees or -90 degrees) then the wrist will adjust so that angle W is relative to the home position rather that the hand position. Therefore each time the waist is moved the wrist will rotate so as to leave no change in angle of the grippers relative to the X-Y axes. This mode remains until
    NONALIGN is typed. This cancels align mode.

  • Back to contents page

    4
    ENCODERS

    The encoder system comprises additional hardware and software in the DSP card for up to six incremental encoders, one encoder per axis.

    When WHERE is typed 3 lines are displayed. Line 1 is the regular motor count, line 2 is the actual encoder count, line 3 is what the motor count should be, calculated from the encoder count e.g.

     
          WAIST  SHOULDER  ELBOW   HAND   WRIST    OBJECT  
          TRACK     LIFT  EXTEND   HAND   WRIST    OBJECT  
           1000    2000    3000       0       0  
            642    2406    3604       0  
           1001    2005    3003       0  
    
    In this example there is a slight error in each axis according to the encoders, but these errors are within the encoder tolerances, ENCTOLS. They represent very small angles or displacements indeed when you consider, for example that there are 18000 counts for 90 degrees of shoulder movement.

    The words which may be used are:-
    EFP - Encoder Fitted Pattern - This is a constant in which each bit corresponds to an axis. A bit set means that axis has an encoder fitted. The value of this constant can only be changed by typing (val) ' EFP ! START transfers this value to the variable EEP (encoder enabled pattern).

    ENCOFF - disables all encoders but leaves their values displayed by WHERE and ENCWHERE.

    ENCON - re-enables the encoders by transferring EFP to EEP.

    ENCRATIOS - this is an 8 element (16-byte) array containing the number of encoder steps for each 10000 counts (or rather the value in S/REV) of the stepping motor.
    It may be viewed with
    VIEW ENCRATIOS
    The value of each element is:

    (value from MICROS) * (number of lines on encoder) * 4 * (value of S/REV)
    ----------------------------------------------------------------------
    (motor full steps per rev) * (micro-steps per full step)

    Encoders generally have 128 lines per rev. Because of the quadrature algorithm this produces counts of 512 per rev. So, for example, if there were an encoder coupled 1:1 to a motor in half step mode the value in ENCRATIOS would be 12800 for a 128 line encoder. For the more common 5 microstep plus 2 for MICROS (e.g. 2.5 counts per full step) then the value in ENCRATIOS would be 10240. The array can be addressed as follows: ENCRATIOS @ or ! - 1st element (waist), ENCRATIOS 2+ @ or ! - 2nd element, ENCRATIOS 4 + -3rd, ENCRATIOS 6 + -4th.

    ENCSET - this presets the encoder counters to correspond with the stepper count e.g. after calibration.

    ENCASSUME - this adjusts the motor counts to the values indicated by the encoders. Main uses are: (1) after a stall detect (encoder-stepper mismatch) the system can continue by using ENCASSUME first or (2) if an axis moves while de-energized ENCASSUME will correct the motor counts so the system can continue without error. See also ASSUME (3.1.1, 7.2

    ENCCHECK - this checks the encoder count against the stepper count, using the conversion factors in ENCRATIOS. If the error in the encoder count is more than the corresponding value in the array ENCTOLS then the system tries again the number of times in the variable TRIES. If, after this number of tries, the error still persists then the quits with a message. The number of tries can be set with, e.g.
    3 TRIES !
    ENCCHECK only operates on motors which are selected with the variable EEP (encoder enable pattern) which has bit 0 set to enable motor 1, bit 1 for motor 2 etc. To enable the first two motors only enter 3 EEP !. The word START enables all encoders which are fitted, and this is the result of a constant EFP (encoder fitted pattern). To change EFP enter n ' EFP !
    START loads EFP into EEP, but EEP may be manipulated during program flow, for example to deliberately disable an encoder to permit a stall situation, then re-enable it to correct the error on the next move.

    ENCVEC - is an execution vector for ENCCHECK. START initialises this to ENCABORT which issues an error message and aborts. To force some other action instead of ENCABORT then define a new word and put its code field address into ENCVEC. You do this with the syntax SET ENCVEC (word), for example:-
    : ALARM BEEP PA 5 ON ENCABORT ;

    SET ENCVEC ALARM

    If a place or a route is executing at the time the error occurs it will continue after (word) finishes. The word itself may include some robot movement but not another place or route.

    Note: Instead of SET ENCVEC (word) you may also enter ['] (word) 2- ENCVEC !

    ENCTOLS - is an array containing limits of error referred to the encoder. Only when an error exceeds the limit is any action taken by ENCCHECK.

    If the system re-adjusts often it may be because the values in ENCTOLS are too small. To change them proceed as follows:
    To change the value for the first axis (waist or track) enter:
    (value) ENCTOLS !
    To change the value for the second axis enter: (value) ENCTOLS 2 + !

    Use 4 + for axis 3, 6 + for axis 4, 8 + for axis 5.

    To check current value enter ENCTOLS ? for axis 1, ENCTOLS 2 + ? for axis 2 etc. Or enter
    ENCTOLS DUMP to see all the values.

    ENCERR? - puts the bit value of the channel which is in error onto the stack.

    ENC1, ENC2, ENC3, ENC4, ENC5, ENC6 - reads the count for channel 1,2,3,4,5 or 6 onto the stack.

    LATCH (v5.1 only) - latches the current count into registers which can be read with ENC1-6.

    ENCTEST - continually prints on the screen the output of the four encoders.

    ENCLEARN - same as LEARN but learns joint co-ordinates from the encoder counts instead of motor counts.

  • Back to contents page

    5
    SPEED

    You will have noticed that every time the arm moves it accelerates and decelerates. At low speeds the stepping motors move in pulses, stopping between each step ("Pull-in" speed). The software accelerates ("ramps") the motors to a speed where motion is more continuous and does not stop between steps ("pull- out" speed). The controller creates a rotating magnetic field which the motor armature follows. The armature and the robot have inertia so the controller must accelerate the motors then decelerate to the pull-in speed before stopping. Diagram 3 shows a typical speed profile.

    The DSP is used for all motion control and values are passed to it from the CPU. The speed of the robot in SMOOTH and CONTINUOUS modes is determined by SPEED.

    The effect of changing SPEED is to change the height of the plateau in diagram 3. To see what speed is currently set enter:-
    SPEED ? 10000 OK (example)
    The maximum speed achieved can be changed by entering a new value for the variable SPEED as follows e.g.
    (n) SPEED ! OK
    A value of 1000 is a low speed, 10000 is a moderate speed, 30000 is a high speed. Maximum is 65535.

    For short moves maximum speed (i.e. the value of SPEED) may not be reached before deceleration must begin.

    Regardless of the value in SPEED the speed of the track may be limited by the variable TRACKSPEED. Put a bigger value in TRACKSPEED to make the track go faster. The speed of the track is the lowest of the two values in SPEED and TRACKSPEED. In compound moves as in GOTO and PLACE names the speed of the whole robot is limited to TRACKSPEED if the track is one of the axes which is moving. As soon as the track finishes moving the speed increases to SPEED.

    SETTINGS permits simultaneous display and editing of all the above variables.

    Click Settings, Variables.

    All default values will be restored by START or NORMAL

    Speed may be changed during the progress of a route with 'LEARN e.g.
    'LEARN SPEED 7500 (or other value or other variable)
    Associated commands are:
    (line number) 'REPLACE SPEED (new value)
    (line number) 'INSERT SPEED (new value)
    See section 7.2.1

    5.1
    ACCELERATION

    Changing the value of SPEED does not affect acceleration, just as in diagram 3. Acceleration is determined by the variable ACCEL e.g.
    ACCEL ?
    change with (val) ACCEL !
    100 is very low acceleration, 5000 would be a high acceleration.
    If the robot cannot reach SPEED within the distance programmed (depending on ACCEL) then a lower speed is reached as in the short move in diagram 3.

    5.2. Micro-stepping

    Generally a stepping motor has 200 steps per rev or in half step mode 400 counts per rev. In micro-stepping mode at 5 micro-steps per full step and a scaling factor of 2 in the software then there are 500 counts per rev. The physical microstep rate is set on the IM804/5 drive module and is typically 5 but can be higher. The scaling factor is the constant MICROS. For example if you changed the module settings from 5 to 25 then the scaling factor would have to change also, from 2 to 10, using the form
    10 ' MICROS ! (10 tick micros store)

    Gecko drives (see rear of controller) are always set to a micro-step rate of 10 and the value of MICROS is 4.

  • Back to contents page

    6
    TEACH PAD

    To start moving the arm enter:-
    TEACH
    click

    With this method pressing a key on the teach box moves the arm. Since you might let go of the key at any time and expect the robot to stop it is not possible to accelerate to high speed. Moreover a slow speed may be more desirable to achieve precision, and the teach speed is determined by the value of CREEP-FACTOR, which is requested after you enter TEACH. If you just hit the return key then the value entered last time TEACH was used will be retained. CREEP-FACTOR defaults to 16 after typing START.

    After entering TEACH you are now in "TEACH mode". To move the arm first select the joint to move J1 to J6. When a joint is selected the terminal will beep. Next press either + or - for motion in a positive or negative direction. On an R17 the hand is driven by two motors, 4 and 5, selected with J4 and the wrist twist is motor 5 only selected by J5.

    While the robot is moving it can be stopped with the large red soft stop key. This button is the same as the stop mushroom on the front panel and is always active even when TEACH has not been invoked.
    To exit TEACH mode click escape on the ROBWIN box or press the ESC key.

    Teach pad

    LED lamps are self explanatory
    directio.gif

    R17 joints
    Key designations:
    JointR15R17R19Cartesian
    J1trackwaistwaist X
    J2extend/liftshoulderlift Y
    J3lift/extendelbowextend Z
    J4hand/axis4L-handhandPitch
    J5wrist/axis5wristwristW/Roll/Yaw
    J6axis6tracktrackplunge

    The gripper is selected with the key marked 'GRIP', then to close the gripper press the + key and to open the gripper press the - key.

    To see where you are press the key marked 'WH?'. The home key (bottom left) returns the arm to the HOME position.

    If you are learning a route then when you are ready to learn press the tick key. This simultaneously learns/adds line to the selected route in ROBWIN and to the route in the controller. To delete the last step learned press the FN key, then while still holding the FN key press the cross key.
    Note that tick-learning a GRIP or UNGRIP is not possible in version 10.

    You can change the speed up or down by pressing SPEED then + (to increase) or - (to decrease). A message appears on screen to confirm this.

    If the system is in Cartesian mode when the TEACH box is used then the new Cartesian co-ordinates are COMPUTEd after each move of an axis. The tick key learns these Cartesian co-ordinates.

    If the robot is de-energized and moved by hand then when the tick key is pressed JOINT co-ordinates are taken from the encoders and learned.

    The FN key can be programmed to execute some other word if pressed - chosen with SET. Suppose the word you wanted was TEST:-
    SET FN TEST OK

    Now whenever the FN key is pressed the word TEST will execute. Typing START restores the action of the FN key to NUSPEED.

    By default (after START) if pressed FN invokes NUSPEED which requests you to enter a new value for CREEP-SPEED through the computer keyboard. You can also change speed on the ROBWIN screen by clicking "New Speed"

    JOG mode

    If in Cartesian mode you may enter:-
    JOG
    click

    This is similar to the normal mode of the teach pad except that the end effector moves in increments in X, Y or Z directions.

    When Jog is entered (or when the Jog icon is first clicked) the increment size is announced - this is the amount the robot will move as a multiple of 0.1mm i.e. 10 means 1.0 mm. You can change it by clicking 'New Increment' on the ROBWIN box or by pressing the space bar.

    To move the robot in this mode press J1/X to select the X-axis or J2/Y for the Y-axis or J3/Z for the Z-axis. Then press '+' or '-' as appropriate. The robot will move by the increment size in the direction selected, for example after pressing J3 then each time the '-' key is pressed the robot moves up a fixed amount determined by the increment size.

    The J4 key selects the hand (variable PITCH) and the J5 key selects wrist roll or yaw (variable W).
    For these two axes the increment is a multiple of 0.1 degrees, i.e. to rotate hand by 90 degrees change the increment to 90.0

    On the style 2 keypad you can change the increment size by pressing the SPD key followed by the + key to increase the increment or the - key to decrease the increment.

    All other keys behave the same as in the normal TEACH mode.
    The WH? key displays the current Cartesian position of the robot.
    The tick or LRN key learns the current Cartesian position.
    To delete a line on style 2 pad press FN and the cross.

    To exit JOG mode click 'escape' on the ROBWIN box or press the esc key.

    (TEACH)

    This word is the same as TEACH but does not ask for CREEP-FACTOR first. Thus it can be used without the terminal.

    The teach pad may also be used for other purposes, using the following words:
    KEYPRESSED? returns a true if a key is being pressed, 0 of not.

    INKEYPAD
    this returns a zero if no key is being pressed, but if a key is being pressed it returns (puts onto the stack) a value corresponding to the key being pressed (similar to INKEY). The value returned is according to the following table:

    Key: J1 J2 J3 J4 J5   J6 home WH?
    hex 11 12 14 18 48 44 41 42
    decimal 17 18 20 24 72 68 65 66
    Key: GRIP FN tick  X  +  - SPEED STOP
    hex 21 81 22 82 24 84 28 88
    decimal 33 129 34 130 36 132 40 136

    Note that 88hex/136dec is always the stop key and is polled continuously by the system while motors are running.
    (except where control has been passed to the DSP)

    KEYPAD

    This is the same as INKEYPAD except that the system stops and waits for a key to be pressed (similar to KEY). When a key is pressed it returns a value from the table above.

  • Back to contents page

    6.1
    STOP BUTTON

    The stop button on the front panel (and teach pad) causes immediate deceleration of all moving motors - EXCEPT when the DSP is controlling motion by itself e.g. with the commands DSPMOVE, DSPSMOOTH or CRUN (then you must invoke the command STOP yourself or in following code). Normally STOPABORT is then executed which issues a message and sets ERR to 3. But the response to the stop button may be re-programmed to another word with the syntax :-
    SET STOPVEC (word)
    For example (assumes a terminal or terminal emulator is in use. (27 or 1Bhex is the ASCII value of the escape key)
    : ESTOP
    CR ." Stop button pressed - hit esc to abort or any other key to continue"
    KEY 27 = IF STOPABORT THEN
    ;

    : SET STOPVEC (word) ;

    If a place or a route is executing at the time the stop button is pressed it will continue after (word) finishes. The word itself may include some robot movement but not another place or route. For example:
    : ESTOP
    CR ." Stop button pressed - hit esc to abort, spacebar to withdraw and continue or any other key to ignore"
    KEY DUP 27 = IF STOPABORT THEN
    ASPACE = IF TELL EXTEND 0 MOVETO THEN
    ;

    SET STOPVEC (word)
    STOP? Checks stop button and leaves true if pressed.
    STOPCHECK Checks stop button and aborts if pressed. - if it's pressed executes STOPABORT

    Note: Instead of SET STOPVEC (word) you may also enter ['] (word) 2- STOPVEC !

    For more examples of how to re-program the stop button see end of manual.

    IMPORTANT - the DSP does not check the stop button, only the CPU does. Normally the CPU polls the stop button and if pressed it sends a STOP command to the DSP. If the CPU is doing something else the robot will not stop when the button is pressed. To stop the robot your CPU software must execute the command STOP

    ?STOP
    is a loop which waits until the DSP has finished. In addition it checks the stop button. If the stop button is pressed it sends the STOP command to the DSP, sets a flag FSTOP to '1' then waits for the DSP to finish.
    As long as the CPU is in command mode or executing some other command the stop button is ignored.

  • Back to contents page

    7
    TEACHING

    Starting a new project

    Before you can teach the robot anything you have to start a new project (or load an existing one) as follows:

    Run RobWin

    Double-click on the ROBWIN icon. Along the top are the menu buttons, below that is the robot tool bar and below that is the macro bar.

    On the menu bar click settings, open file. If you have an R17 click on R17.CFG; if an R19 click on R19.CFG, if an R15 click on R15.CFG. Values may be manually set using settings, configuration – make sure DSP, bank memory and hide mode are checked. caps lock – All ROBOFORTH commands are in upper case, ensure CAPS LOCK is on.
    Switch the key switch to cold start and switch on the robot controller.
    In the communications window (the console) you should see a herald which includes the words ‘cold start’ (see next page) and a chevron prompt >.

    Type ROBOFORTH into the console. The response should be OK and a new line with a chevron prompt >

    Note: When you type anything in the console all buttons are greyed out. If you back off what you typed they will still be greyed. Press esc if in doubt.
    In the tool bar press the start button or type START into the communications window. This energizes motors, zeros all position counts, sets default values for SPEED etc.
    Press the Calibrate button or type CALIBRATE Robot moves to the calibrate position and calibrates all axes.
    Press the Home button or type HOME Robot moves to the HOME position in which all motor counts are zero.

    Open a project

    Click project, new and choose a name for your project for example myprog.
    When the project is open you will see three more windows: routes, places and a window labeled myprog.ed2
    We advise (from experience) to move the communications window to the bottom and to re-arrange the other three so all are visible.
    The system sends commands ROBOFORTH and STARTOVER to the controller which you can see in the communications window. This clears out the controller ready for the new session.

    7.1
    LEARNING POSITIONS

    All data is stored in a data area in memory bank 1 which begins at the location given by the constant RUN-LIST e.g. RUN-LIST X. Each co-ordinate learned occupies 16 bytes. The first 16 bytes at RUN-LIST is a block header. The next 16 bytes will be the first co-ordinate or the header of a named entity (see later) also 16 bytes. The address of the next available 16 byte strip is maintained in a variable NEXT (enter NEXT @ X.).

    Nothing can be learned until the data area is initialized with:
    STARTOVER
    Among other things this sets NEXT to RUN-LIST plus 16.
    Starting a new project executes STARTOVER so there is no need to type the word.

    You can learn co-ordinates by creating various named data entities. Teaching the robot is normally achieved by first deciding which type of named entity to use. There are two kinds of named entities for robot positions: ROUTEs are lists of co-ordinates which are learned one at a time and which may be executed one at a time with the command RUN. PLACEs are single named positions which are automatically learned when the PLACE is created. Just by entering the name of the place the robot automatically goes there. A ROUTE is an array of positions which may be executed sequentially or used as list of co-ordinates for reference, for example for a matrix. When a ROUTE or PLACE is created it occupies space in the dictionary (called the dictionary entry) and space in the data area (RUN-LIST) for the co-ordinates.

    A route is created with the form:
    ROUTE (name)
    using a (name) of your own choosing, then learn some co-ordinates. A place is created with the form:
    PLACE (name)
    using a (name) of your own choosing.
    However, you should NEVER use these commands. Always allow ROBWIN to create the controller entries for you.

    When you have created the ROUTE or PLACE, then ROBWIN immediately enters the same form into a text file, extension .ED1 and in the same order they were created. At the start of this file ROBWIN places the words ROBOFORTH and STARTOVER. When this file is re-loaded the controller is put in OLD mode and the routes and places are re-created using old (existing) data i.e. the co-ordinates you learned in the first place. The same thing happens if this text file is loaded in DOS using Z380.BAT but type the word OLD first. Normally routes and places are created in NEW mode.

    ROBWIN should always be used to learn new positions. It then keeps track of the changes in computer memory. To save computer memory to disk click 'project', 'save'. If you create new data in the command window you must upload it to ROBWIN by clicking

  • Back to contents page

    7.2
    ROUTES

    A ROUTE is a named list of positions which can be RUN. When the route is run the arm moves from one arm position to the next. Each position is a list of motor co-ordinates, one for each motor in the same form as shown after entering WHERE. The method of teaching the robot is as follows:
    First choose a name for the route e.g. TEST1
    Click the Routes window and click New. Enter the name TEST1 in the dialog box. ROBWIN sends the string ROUTE TEST1 to the controller.
    By default ROBOFORTH creates a Cartesian route if in Cartesian mode but in ROBWIN you can choose whether a route will have JOINT or Cartesian learned positions. When the name of a route is typed the system changes to whichever mode the route was specified, Cartesian or Joint. Using the name of the route changes the context for commands such as GOTO, REPLACE etc.
    When a route is created space must be reserved for the expected number of learned lines. This may be increased later if necessary. The route create dialog box asks how many lines to reserve. By default it is 20. ROBWIN sends the string (n) RESERVE to the controller which moves up the NEXT pointer (inspect with NEXT @ X.) to reserve space for this route before another named entity is added.
    If you need to change the reserved space (either increase for more lines or decrease to save memory) then first close the route, highlight its name in the route list box and click 'change size'.

    1. To begin learning positions highlight the new route (click on its name) and click 'Open route'. Then learn the positions as follows:-

    Using motion commands
    2. Click 'robot' then absolute or relative Cartesian or joint move and enter the desired target position or relative move.
    OR enter motion commands e.g. TELL WAIST 1000 MOVE (Joint) or 100.0 200.0 300.0 MOVETO (Cartesian)
    Generally it is best to use the robot drop down menus for Cartesian positioning but may be more convenient to use commands for joint positioning.
    3. On the open route box click the next available space then click 'insert position'. ROBWIN sends the command LEARN to the controller. To change a position once learned move the robot to the correct position, highlight the line and click 'set to here'. ROBWIN sends the command (n) REPLACE to the controller (where n is the line number to replace).
    To undo the last line learned highlight the line and click 'delete'. ROBWIN sends UNLEARN
    To delete a line within the route highlight the line and click 'delete'. ROBWIN sends (n) DELETE where n is the line number to delete. These commands are for information only, you don't need them.
    Repeat from 2.

    Using the teach pad
    2. Click on the or button
    3. Move the arm to the desired position using the teach pad
    4. Press the escape key or click 'esc' on the teach dialog box to exit teach mode.
    5. On the open route box click the next available space then click 'insert position'.
    To change a position once learned move the robot to the correct position, highlight the line and click 'set to here'.
    To undo the last line learned highlight the line and click 'delete'.
    Repeat from 2.

    Using the teach pad
    2. Click on the or button
    3. Move the arm to the desired position using the teach pad
    4. Press the tick key on the teach pad. 5. To undo the last line learned press and hold the FN key then press the cross key; release both.
    Repeat from 3.
    To make changes press the escape key or click 'esc' on the teach dialog box to exit teach mode, highlight the line then choose 'set-to-here' to edit the values or 'delete' to delete the line.

    To delete a route highlight it in the routes window and click Delete. ROBWIN sends the word FORGET followed by the route name which recovers the space allocated to it in the data area but also removes the entry from the dictionary together all the other dictionary entries that come after it. Therefore all these other words are automatically reloaded by ROBWIN.

    A route may be executed simply by typing
    RUN
    The robot follows the learned list from point to point. The default mode is SEGMENTED in which the robot stops at each line. In CONTINUOUS mode the robot moves continuously through each line without stopping.

    When there is more than one route first select the route you wish to run by typing its name e.g. TEST1 RUN
    Click the route you wish to run in the routes window; click open route. In the window for the selected route click 'run'.

    A route can also be run in reverse order with the command
    RETRACE

    EDITING

    If you wish to list or edit another route type the name of the route first.
    To edit a route click the route name in the routes list window then click 'open route'. You can then do various things:
  • edit a line
  • delete a line insert a line
  • add to all - this will add the same value to all the lines at once, useful for shifting an entire route up or down.
    Typical editing dialog:

    Typing the name of the route makes it the currently active route. All commands thereafter such as LISTROUTE, RUN, LINE, GOTO etc. will apply to the currently active route and no other route.
    A route which is not currently active may be listed without selecting it with e.g. LIST: TEST2

    To see which route is currently active enter:-
    WHICH TEST1 ABSOLUTE

    The routes window lists all the routes created so far or in the command window enter:-
    ROUTES

    nnnn 6 TEST2        nnnn 9 TEST1  
    2 words  
    OK  
    
    The "nnnn n" in the above are the RAM address and lengths of each word in the dictionary. See VLIST under INFORMATION.

    Editing in DOS or in the console alone
    The route window provides all necessary editing buttons. However if you use any of the following commands they will change data in the controller but not in ROBWIN. To update ROBWIN click on

    LEARN - adds one line to the route.
    (n) DELETE deletes the line number (n) and moves all the following lines down one.
    (n) INSERT moves all lines from (n) up one and inserts a new line (n) with the current co-ordinates of the robot.
    INSERT may produce a FULL error even when no recent entities have been added, in which case reserve more space with (n) RESERVE.
    (n) REPLACE
    replaces the co-ordinates of line n with the current co-ordinates of the robot. This command can also be used in user's software (new definitions).

    You would not normally use any of the above commands while using ROBWIN as ROBWIN sends these commands when you click the various buttons.
    However (n) REPLACE is often used within a program to self-learn a particular position, for example by computation or to synchronize the end of one route with the start of another. See below and example in section 13.

    ERASE erases the entire list.

    UNLEARN deletes the last line learned.

    STARTOVER would do the same but would also restore the NEXT pointer to initial value which would be disastrous for any entities which had been created. If no entities have been created then it is OK to use STARTOVER. Normally STARTOVER and ROBOFORTH are used together. ROBOFORTH clears out all the user's words from the dictionary requiring a fresh load from the text file.

    A list of co-ordinates is not necessarily to be RUN in sequence. It can also be used as an array or matrix of positions for example a grid of test tubes. See Matrices. To access the data in individual lines:
    (n) LINE returns the memory address of the data in line (n).
    This address is suitable for words like GOTO and ASSUME. e.g. (n) LINE GOTO
    GOTO requires the address of some positional data. If you leave out LINE then GOTO assumes the argument is a line number and finds the data e.g.
    (n) GOTO
    Click 'goto' on the route window.

    For ASSUME the syntax is (n) LINE ASSUME
    For VIEW the syntax is VIEW LINE (n)
    To run the route type RUN
    Click 'run' on the route window. In CONTINUOUS mode the robot moves through each line without stopping. In SEGMENTED mode the robot pauses at each line.

    To RUN a limited amount of the route enter:
    (n1) (n2) SEQUENCE RUN which runs the route only from line n1 to line n2 (inclusive).
    Note that n1 can be bigger than n2 in which case the route runs in reverse order.

    In segmented mode as a route is being executed it is listed out line by line. This actually takes a significant time and can slow down the robot, especially for small movements. The listing can be turned off with the command LISTFLAG C0SET (pronounced "list-flag see-nought-set").
    To turn listing back on enter LISTFLAG C1SET ("list-flag see-one-set").
    NOTE: in C0SET the 0 is a zero not letter O.

    Segmented mode only: To introduce a delay into the program highlight the line before which you wish to insert the delay and click 'insert func'. In the dialog box enter the word MSECS and in the lower space enter the number of milliseconds to pause. Click the space after the last line to 'insert' the delay onto the end of the route.

    To abort the route while it is running press the escape key - the robot will stop after executing the current line. The stop button stops the robot immediately. The line at which the route aborted is contained in the variable LINE#. Inspect with LINE# ?

    FIRST# and LAST# are variables containing the first and last lines to be RUN (set by SEQUENCE).

    MOVES is a pseudo-variable i.e. a routine which behaves like a variable and contains the total number of lines in the list or route. e.g.:
    MOVES ?
    The address left by MOVES is in high memory so must be accessed with E@ and E!.
    Example use to self learn the last position in a route: MOVES E@ REPLACE
    See example in section 13.

    To have the gripper operate during progress of the program first enter GRIP or UNGRIP as appropriate to immediately operate the gripper then 'insert func' GRIP or UNGRIP. Leave the value at 0.

    In Cartesian mode LEARN learns the Cartesian co-ordinates instead of the joint co-ordinates. The same applies to REPLACE and INSERT. However, you can force the system to learn the joint co-ordinates instead with:
    JL
    Likewise a line containing any kind of data may be replaced with joint co-ordinates with
    JR
    Then upload the data to the computer with

  • Back to contents page

    7.2.1
    PUTTING FORTH WORDS INTO ROBOT PROGRAMS

    ( "TICK" COMMANDS )

    It is possible during the progress of a route to have the controller execute a FORTH program or "word" for example GRIP and UNGRIP, GET and PUT, PLACE names, other routes, changes in SPEED or other variables, or user defined words.
    Use insert func

    However it is not a good idea to 'LEARN (insert func) words which you have created because your word is looked up in the dictionary and it's code field address (CFA) is compiled into the route. This is then executed when that line is reached (using the word EXECUTE). In FORTH this is known as "vectored execution ". This address could change if you edit the text file rendering the address in the route invalid and the system will crash (and probably the robot as well). You would have to edit all occurrences of your word using edit line. Therefore stick to words in ROBOFORTH. Any ROBOFORTH words can be inserted as functions, leaving the argument (value) at zero. Words which can have values are: MSECS GRIPPER SPEED SETPA
    If you must use new definitions and subsequently re-compile a number of words from the editor so that the address of the word changes then a better practice is to put the line 'REPLACE (word) in your text file to re-install the correct CFA each time the text file is reloaded. Don't forget to precede it with the name of your route or it will be put in the wrong route e.g. if the route is called PATH1 and you have your function in line 2 then enter
    PATH1 2 'REPLACE PRESENT
    If you wish to update the listing in ROBWIN then click the red up-arrow

    Example FORTH word to make the robot wait until an object is present to be picked up, indicated by bit 7 of port PB going to a logical '1':-
    : PRESENT BEGIN PB 7 BIT? UNTIL ;

    Then click insert func and enter PRESENT
    In DOS you can type 'LEARN PRESENT

    WARNING: If you remove or FORGET a word which you have 'LEARNed or 'insert func' into a route then you must also DELETE the line in the route which holds it. Otherwise you will leave an invalid address in the route to be executed and the system will crash.

  • Back to contents page

    7.2.2
    SUB-ROUTES

    The following procedures apply only to JOINT mode operation. To do something similar in Cartesian mode go to Relative Cartesian routes.

    In the majority of cases we want the arm to do a similar movement in many different positions, that is to say that the movement should be relative to its starting position and not to its home position. To make this happen first put the robot into RELATIVE mode BEFORE creating the route. Enter:
    RELATIVE

    Let's call the relative route WAVE.

    Click 'new' in routes window, then in the route create dialog box click 'relative' and enter the name WAVE.
    (In DOS and Z380.BAT you can enter SUB ROUTE WAVE)

    WAVE is now a sub-route.

    WHERE now has an additional line labelled LOCL and with initial starting values of zero. (example values, typical headers):

     
          WAIST  SHOULDER  ELBOW   HAND   WRIST    OBJECT  
          TRACK     LIFT  EXTEND   HAND   WRIST    OBJECT  
    GLOB   1000    2000    3000       0       0  
    LOCL      0       0       0       0       0  
            642    2406    3604       0  
           1001    2005    3003       0  
    
    If a joint is moved now, say the shoulder by 1000, the result is:-
     
          WAIST  SHOULDER  ELBOW   HAND   WRIST    OBJECT  
          TRACK     LIFT  EXTEND   HAND   WRIST    OBJECT  
    GLOB   1000    3000    3000       0       0  
    LOCL      0    1000       0       0       0  
            642    3600    3604       0  
           1001    3000    3003       0  
    
    When co-ordinates are LEARNed into the new sub-route, WAVE, the LOCL (local) position rather than the GLOBal position are learned. These are given ABSOLUTE type flags and will list as absolute positions but when WAVE is RUN it will run the co-ordinates in the list relative to the initial position of the robot before RUN was typed, rather than relative to the HOME position.

    By inserting another route name into a route using 'insert func' (or in DOS by using 'LEARN or 'INSERT or 'REPLACE ) a robot route can be made to execute the other route then return to complete the first (calling) route.

    If the sub-route WAVE is tick-learned into an absolute route using 'insert func' and the absolute route is run then when the line containing the sub-route is executed the sub-route will run relative to the robot's position at the previous line.

    If RELATIVE is typed AFTER THE ROUTE IS CREATED then the route will be absolute but LEARN will learn the LOCAL positions. These positions are given RELATIVE type flags indicated by an 'R' e.g.

     
          WAIST SHOULDER  ELBOW    HAND   WRIST    OBJECT  
          TRACK     LIFT  EXTEND   HAND   WRIST    OBJECT  
    01     1000    3000    3000       0       0 R  
    

    If a route is already created and you want to change it into a sub-route then type:-
    RELATIVE MIXED or RELATIVE RTYPE then upload to the computer with

    ALL 0 MOVETO makes the arm go back to the LOCAL home position

    ABSOLUTE cancels RELATIVE mode.

    Individual joints can be made to be relative with the command LOCAL, taking joint selection from MEP in the usual way e.g.:-
    TELL SHOULDER ELBOW LOCAL
    designates the shoulder and elbow axes to be local, but all other axes to be global. The where list shows this:-

     
          WAIST  SHOULDER  ELBOW   HAND   WRIST    OBJECT  
          TRACK     LIFT  EXTEND   HAND   WRIST    OBJECT  
    GLOB   1000    3000    3000       0       0  
    LOCL           1000       0  
            642    3600    3604       0  
           1001    3000    3003       0  
    

    Alternatively TELL WAIST GLOBAL designates the waist as in global or absolute mode, and all other joints as local/relative. The motor flag byte MSP contains a '1' for each motor which is in local mode.

    The array which contains the local counts for each motor is called LOCALS and is addressed with (n) LOCALS where n is 0 for the first motor, 1 for the next etc. e.g.
    1 LOCALS ? 1000 OK

    NOTES
    (1) RELATIVE or SUB designates the next ROUTE created to be a sub-route, designates all joints to be local and zeros all the local position counts. Thereafter LEARN will learn the LOCAL positions but with absolute type flags.

    (2) When a RELATIVE route is executed it saves the current position (i.e. the position last at before the route is executed) on the stack. If the current position is itself relative (e.g. when sub-routes are nested) it is the local position which is saved. When the route finishes the position values are 'popped' off the stack again. If the sub-route does not actually finish at the same position it started then the difference between starting and finishing positions is added to the saved position values as they are restored from the stack.

    (3) If the escape key is pressed any route will abort after the current line is complete. In the case of nested sub-routes each level will abort leaving a true GLOBAL position.

    (4) For information in nested sub-routes, each route announces itself as it begins (unless LISTFLAG is zero). When a sub-route finishes it announces the name of the route which called it.

  • Back to contents page

    7.2.3
    MATRICES

    ROW


    Click 'new' in routes window; in route create box click 'row'. Then enter the number of points in the row in the columns box. Make sure the number of lines reserved is at least 1 greater than the number in the columns box. Move robot to first position, click the first line in the route window and click 'set-to-here'. Then move robot to last position in the row, click the last line in the route window and click 'set-to-here'. Finally press 'interpolate'.

    The number of positions in the row is held in the variable POSNS

    GRID

    This sets up a 2-dimensional array.

    1. Click 'new' in routes window; in route create box click 'grid'. Select whether the numbers should be JOINT or Cartesian co-ordinates. Then enter the number of rows and columns. Make sure the number of lines reserved is at least 1 greater than rows times columns.
    2. Guide robot to the first position in the matrix, that will be row 1 column 1. Highlight line 1 (which has an asterisk next to it) and press 'set-to-here'. 3. Guide robot to the end of the last column, row 1 i.e. the next corner of the matrix. Highlight the next line with an asterisk and click 'set-to-here'. 4. Guide robot to the last position i.e. last row last column. Highlight the last line (which has an asterisk) and click 'set-to-here'. 5. Click 'interpolate'.

    Dialog box showing creation of a new matrix TRAY1 in Cartesian mode, 10 columns by 5 rows.

    The number of positions in each row of the GRID is held in the variable POSNS. The number of rows is in ROWS.

    A number of words are provided to work with ROWs and GRIDs. They all require an extra line added to the list which contains a relative (type R) co-ordinate which is added to any line to make an approach position for every line. This line is always the last line and the address of the data is data is MOVES E@ LINE

    You can create this approach position as follows:

    JOINT mode
    1. Guide the robot to one of the target positions (one of the lines). The robot might already be there after learning the third corner.
    2. Enter RELATIVE
    3. Guide the robot to an approach position using commands or the teach pad - for example a vertical movement on lift alone might suffice for a position over a test tube rack.
    4. Press 'set aproach'
    5. Enter ABSOLUTE

    Cartesian mode
    1. Guide the robot to one of the target positions (one of the lines). The robot might already be there after learning the third corner.
    3. Command the robot to an approach position using a Cartesian MOVE or use JOG. For example a vertical movement on Z alone might suffice for a position over a test tube rack.
    4. Press 'set aproach'

    In joint mode the co-ordinates learned are those shown against LOCL in the WHERE display and in Cartesian mode the co-ordinates learned are the difference between the current position and the PREVious position shown in the WHERE display.
    Method A is best suited to joint mode and method B is best suited to Cartesian mode.

    Once the relative position, line n+1 has been learned a number of other words may be used:

    (n) GONEAR
    This sends the robot to the approach position for line (n) obtained by ADDing the co-ordinates in the last (type R) line to the co-ordinates of line (n). NOTE in v10.0 and below this command was just NEAR not GONEAR

    (n) NEAR
    This looks up the memory address of the near position and leaves it on the stack. It does nothing otherwise. NOTE in v10.0 and below this command actually sent the robot to the near position. The new form of this command is useful for tail-ending other routes. For example suppose you have a matrix route TRAY with an approach position and another route PATH to get you to the general area of the tray from somewhere else. You can amend the last line of PATH so the robot finishes up at the required near position of the tray. The command string would be: TRAY (n) NEAR AXES PATH LASTLINE REPLACE
    where TRAY is the name of the matrix route, (n) is the position within that matrix you want to go to. NEAR produces the address of the approach position of line (n) and AXES extracts the Cartesian co-ordinates of that approach position into the variables X Y Z W etc. Next PATH invokes the route which gets the robot there. LASTLINE leaves the line number of the last line of that route on the stack and REPLACE replaces that (last) line with the co-ordinates in the variables X Y Z W etc. extracted from the NEAR position of TRAY. So to get smoothly from the starting position of PATH to, say position 5 of TRAY you could use this sequence of commands.

    TRAY 5 NEAR AXES
    PATH LASTLINE REPLACE RUN
    TRAY DOWN
    
    or a generic word to take the line number off the stack:
    : GOTRAY
    TRAY NEAR AXES
    PATH LASTLINE REPLACE
    RUN
    TRAY DOWN
    ;
    usage
    (n) GOTRAY
    

    (n) INTO
    This sends the robot to line (n) of the row or grid via the approach position.

    DOWN
    Moves the robot from the approach position to the target position - use only after (n) GONEAR.

    UP
    Moves the robot up from the target position to the approach position. (Actually moves the robot up from any position!)

    Before using any of the above words the route to which they refer must be selected. If in doubt enter the name of the route again; Remember to use the route name in any definitions.

    An example of how to use these commands.
    Suppose you were taking parts from a TRAY and putting them on a BELT

    : EMPTY-TRAY
    TRAY
    MOVES E@ 1 DO
      I INTO
      GRIP
      UP
      BELT
      UNGRIP
    LOOP
    ;
    
    Note the use of MOVES E@ above. In the first place MOVES is one more than we need, being the number of the line with the RELATIVE position. In the second place, due to a FORTH idiosyncracy DO LOOPs require one more than the actual number of loops, e.g. 9 1 DO LOOP will do 8 loops not 9. Remember also that MOVES is in high memory so must be read with E@ not just @.

  • Back to contents page

    7.2.4
    Continuous Path

    A route may be used to generate an almost continuous path. For this the CPU passes all the route data to the DSP line by line and the DSP executes the motion without the CPU being involved (see later, three phases of operation). Learn a route as normal but to RUN it first enter
    CONTINUOUS
    to put the system into continuous path mode.
    SMOOTH is an identical command (v9.0) with ADJUST included (v10.8) (see 7.2.6)click
    Then when you type RUN
    the robot will run through all the points without stopping. Even if the route is small enough to be loaded into the DSP in one go the CPU waits for the DSP to finish driving the robot before control comes back to the user or the software moves to the next word.
    To run the route backwards enter
    RETRACE

    To cancel CONTINUOUS mode enter
    SEGMENTED
    which returns motion to line by line mode.

    The speed in continuous path mode is determined by the variable SPEED. A value of 1000 is a low speed, 10,000 is a high speed. Highest possible is 32767 but of course the robot may not be able to do that. Acceleration is determined by the variable ACCEL 100 is very low acceleration, 5000 would be a high acceleration.

    The route may contain contain joint or Cartesian values.

    To change speed within the route go to the route box and highlight the required line before which the speed must change. Click 'insert func' then enter SPEED in the dialog box and the required speed below it.

    To turn the gripper on or off within the route go to the route box and highlight the required line at which the gripper should operate. Click 'insert func' then enter GRIPPER in the dialog box and the value 1 below it to turn it on, or 0 to turn it off. You cannot use the word GRIP which only works in segmented mode.

    Other output bits may also be operated by inserting the word SETPA with other values:
    SETPA 5 - turns on PA 1
    SETPA 4 - turns off PA 1
    SETPA 7 - turns on PA 2
    SETPA 6 - turns off PA 2
    SETPA 9 - turns on PA 3
    SETPA 8 - turns off PA 3
    SETPA 11 - turns on PA 4
    SETPA 10 - turns off PA 4
    SETPA 13 - turns on PA 5
    SETPA 12 - turns off PA 5
    Note these functions only work with RUN not with CRUN - see three phase operation below.

    STOP BUTTON:
    If the stop button is pressed while a continuous path is running then the entire route is abandoned even if the stop button does not itself cause an abort (i.e. re-programmed with STOPVEC). The task programmed into STOPVEC will be executed but the run will not resume and the next word will be executed.

    CRUN

    WARNING If you use this command the robot will not stop when you press the stop button. To stop the robot execute the command STOP.
    WARNING If the value of SPEED is invalid the robot will go out of control. Always test the route first with RUN or DRY RUN and reduce speed, increase acceleration or use ADJUST (7.2.6) if necessary.

    CRUN passes the route data to the DSP but does not wait for it to finish. If the route is short enough control passes straight back to the CPU i.e. you will get OK or the next word will be executed while the DSP is still running the robot. If the route is a long one then the CPU will be held up for a while. CRUN ought not be used with routes that contain SETPA or GRIPPER commands because the CPU must remain monitoring the DSP to get these commands as they arise. When the robot has stopped WHERE will show the robot to be still where it was before you executed CRUN therefore you must, as soon as robot motion finished, or at worst before you execute the next command, execute
    DSPASSUME - this reads back from the DSP the position the robot got to when it was stopped and changes the counts to the correct values.

    To determine if the DSP has finished use EITHER:
    1. ?STOP - this traps until the DSP has stopped.
    It also checks the stop button and stops the DSP prematurely if pressed. As long as the CPU is in command mode or executing some other command the stop button is ignored.
    If the stop button is pressed while executing ?STOP then a flag FSTOP is set to a '1', see below.
    OR 2. ?RUN

    This leaves a value on the stack as follows:

       0 - DSP is not running anything
       1 - DSP is running a route
       2 - DSP has read a line GRIPPER 0 which normally means turn off gripper
       3 - DSP has read a line GRIPPER 1 which normally means turn on gripper
       4 - DSP has read a line SETPA 4 which normally means turn off PA 1
       5 - DSP has read a line SETPA 5 which normally means turn on PA 1
       6 - DSP has read a line SETPA 6 which normally means turn off PA 2
       7 - DSP has read a line SETPA 7 which normally means turn on PA 2 
       8 - DSP has read a line SETPA 8 which normally means turn off PA 3
       9 - DSP has read a line SETPA 9 which normally means turn on PA 3 
      10 - DSP has read a line SETPA 10 which normally means turn off PA 4
      11 - DSP has read a line SETPA 11 which normally means turn on PA 4 
      12 - DSP has read a line SETPA 12 which normally means turn off PA 5
      13 - DSP has read a line SETPA 13 which normally means turn on PA 5 
    All values for SETPA and ?RUN from 14 to 255 are available to operate other functions.

    For example the following definition will call another routine to turn on or off a device depending on the state of another input:

    : CYLINDER PA 5 ; 
    : MONITOR 
    BEGIN 
      ?RUN 
      DUP 15 = PB 7 BIT? 0 > AND IF CYLINDER ON THEN ( SETPA 15 learned 
      DUP 14 = PB 7 BIT? 0= AND IF CYLINDER OFF THEN ( SETPA 14 learned 
    0= UNTIL
    ;

    Three phases of operation

    A DSP controlled move may proceed in three phases. In the first phase the CPU is downloading positions (route lines) to the DSP. The DSP fills up a buffer with a capacity of about 50 lines. If there are not enough lines to fill the buffer then once all the lines are downloaded then the robot begins to move. If there are more lines than the buffer can hold then when the buffer is full the robot begins to move and while the DSP is moving the robot it gradually empties the buffer. After each line is executed space is freed and the next line is downloaded into the DSP. When there are no more lines to download the second phase ends. If RUN is being executed the CPU enters phase 3, a loop monitoring the DSP, polling for a motion complete flag. RUN finishes only when all motion is finished. If CRUN is being executed it (CRUN) finishes after phase 2 when there are no lines left to download. At this point there could be up to 50 lines in the DSP buffer so the robot will carry on moving, but the CPU will either be waiting for a command or executing the next word in the definition.

    During the first phase (loading buffer) no other activity takes place. During the second and third phases ?GRIP is executed which transfers SETPA or GRIPPER flags to the PA output port. Therefore if you use CRUN, when control is returned to the CPU, no further SETPA commands will be executed. The DSP continues to issue flags but the CPU is not reading them. You must therefore include ?GRIP or ?RUN in the code following CRUN if you want to use SETPA. ?GRIP is a self contained word that operates the output register directly. ?RUN polls the DSP and leaves a flag on the stack as listed above.

    STOP
    This tells the DSP to stop moving the robot.

    ESTOP?
    If the flag FSTOP is set then ESTOP? executes the stop procedure, normally STOPABORT i.e. aborts with "stop button pressed" message, or else whatever word is SET into STOPVEC (See section 6.1).
    For example the above definition could be expanded to test the stop button and stop the robot if pressed:

     
    : MONITOR
    BEGIN
      ?STOP  ( Waits for DSP to finish
      ESTOP? ( Executes new definition
      ?RUN   ( Gets status of DSP
      DUP 15 = PB 7 BIT? 0 > AND IF CYLINDER ON THEN ( SETPA 15 learned
      DUP 14 = PB 7 BIT? 0= AND IF CYLINDER OFF THEN ( SETPA 14 learned
    0= UNTIL
    ;
    
    Words of the above type are only necessary if you intend to send a command to the DSP and do something else while the DSP controls motion. The definition above could be expanded further to do all kinds of things, for example take analog measurements, while the robot is running a route in continuous path mode.

    If ?RUN ever returns a true value when it should not be, for example due to confusing the DSP with a programming error you can send the command:
    CLRDSP

    See example program in <