Adept SmartMotion Developer's Guide


Customizing Calibration

When Customization May Be Required

Standard Calibration Process

Creating a Custom Calibration Process

Examples of Custom Calibration

Program Listings for Calibration Utilities

Overview

V+ provides a standard application package that can be used for calibration. If your application contains complex mechanisms which require special calibration processes, the standard package can be used to write your own V+ programs for customized calibration.  The standard package includes utility programs that perform many of the primitive functions of calibration, for example, searching for a limit switch or zero index.

The calibration utility package is available to all users of Adept SmartMotion. For users who have no need to customize the calibration process, the changes to V+ and the use of the calibration utility package is transparent.

When Customization May Be Required

For most mechanisms that calibrate to a nest location, or to some combination of hardstops, home sensors, and zero indices, the standard calibration process can be used. It is set up entirely through the SPEC utility program. The standard process and the SPEC parameters that guide it are defined from the Robot Specifications Menu. The standard calibration process is also outlined in the next section.

Examples of mechanisms that may not be able to use the standard calibration process are:

Standard Calibration Process

This section describes the process flow for calibration in V+, and how the STANDARD.CAL utility is used for calibration.

Calibration Process Flow

When the CALIBRATE monitor command or program instruction is invoked, the disk file CAL_UTIL.V2 is loaded. This file is normally present on every boot disk. It contains a main routine that oversees robot calibration, and a number of utility routines that perform primitive calibration functions. These calibration primitives may be used by custom calibration programs.

Normally when the CALIBRATE monitor command or program instruction is invoked, the main routine of CAL_UTIL is executed, and it performs the following operations:

  1. The calibration file whose name is specified in SPEC (STANDARD.CAL by default) is loaded from disk.

  2. All uncalibrated robots are calibrated sequentially. For each robot:

    a. the amps are disabled and the brakes engaged to put the robot in a known state;

    b. the calibration routine loaded in step 1 is executed;

    c. if an error is returned from the calibration routine, power is disabled, the error is reported to the monitor, and the error code is returned;

    d. if no error is returned, the robot is marked as calibrated.

  3. All calibration files are deleted from memory.

The CALIBRATE monitor command and CALIBRATE program instruction can also perform a subset of the above operations.

How STANDARD.CAL Works

STANDARD.CAL is a package of routines that performs generic calibration of motors that use hard stops, home sensors, and/or zero indices. It handles split-axis calibration, self-commutating motors, and motors commutated by a servo board. Motors are calibrated in the order defined by the calibration groups identified in the SPEC utility.

The main calling routine of STANDARD.CAL is a.standard.cal. This routine is called when the CALIBRATE monitor command or program instruction is invoked. Its primary purpose is to calibrate each motor in the proper order.

An unprotected version of the standard calibration program is available in the file STANDARD.V2 in the \CALIB\ directory of Adept boot disks. This file can be copied and modified as a starting point for all custom calibration procedures.

The sequence of operations in a.standard.cal is as follows:

  1. Determine the order of motor calibration based on the calibration groups defined using the SPEC utility. Motors within a given group will be calibrated at the same time. Note that a given motor may show up in more than one group, allowing it to be calibrated more than once. This can be useful for mechanisms with kinematics coupling between axes.

  2. Power-up the motor to be calibrated. This involves enabling the amplifier, releasing the brake, and determining a commutation reference (twanging) for motors that are not self-commutating. The robot is now ready to move under program control. Note that robot HIGH POWER has already been enabled before the CALIBRATE monitor command or program instruction was issued.

  3. For split-axis mechanisms, put the companion axis of a split-axis pair into slave mode so it follows along while the primary axis calibrates.

  4. Perform the standard homing sequence for the current calibration group of motors. The homing sequence used for a given motor is defined by the homing configuration entered in the SPEC utility. The homing operation is achieved by a state machine that makes multiple calls to the low-level utility program "ca.home()". The motor is left with its calibrated flag set after successful completion of the homing sequence. (The individual motor-calibrated flags are internal and later used by V+ to determine if each robot is calibrated.)

Standard Homing Sequence

The standard homing sequence for a given motor is outlined below. Not all of the operations may be required: the homing configuration defined for each motor will determine which will be used.

  1. Find one of the following calibration features:

  1. home sensor

  2. hard stop

  3. current location (if calibrating in a nest.)

  1. Find the zero index.

  2. Move to a safe position.

If the order of the operations above needs to be rearranged, or if the algorithm to perform the search for the calibration feature or zero index must be changed, a custom calibration program is required.

Creating a Custom Calibration Process

This section describes the features of a custom calibration process and how calibration primitives may be used to simplify writing the calibration program.

Features of a Custom Calibration Program

A custom calibration program must perform the following general tasks:

  1. Prepare motors for motion under program control: enable amps, release brakes, and enable position servoing.

  2. For each motor, find the position of calibration features in uncalibrated encoder counts. This is the central task of a custom calibration program.

  3. For each motor, set the calibrated motor position based on the known position of the calibration feature in encoder counts. This value is defined in SPEC. When the calibration primitives are used, the calibrated flag is set for the motor.

Note do NOT set the NOT.CALIBRATED system parameter for the robot within the custom calibration program. This parameter will be set at a higher level of the calibration utility package after successful completion of the custom calibration program.

  1. If an error occurs at any time during calibration, return a standard V+ error code. Robot HIGH POWER will automatically be disabled and the message corresponding to the error code will be sent to the terminal or monitor window.

To make these tasks easier, the calibration primitives included in the calibration utility package handle the details of robot motions and basic procedures for searching for various calibration features. For additional details, see Calibration Primitives.

Procedure for Setting Up a Custom Calibration Program

The following procedure outlines the steps required to set up the V+ system to use a custom calibration program.

  1. Store the custom calibration program in a file in the same directory and on the same disk as the CAL_UTIL.V2 file. This will normally be the \CALIB\ directory on the boot disk for the system. The suggested suffix for the file name is ".CAL". The calibration primitives provided by Adept should not be stored in the file since they will be loaded automatically from the CAL_UTIL.V2 file.

  2. The main calling routine for the custom calibration package must have the same name as the file in which it is stored, except with the prefix "a." preceding the name. For example, a custom calibration program stored in the file CUSTOM.CAL must have a main calling routine named "a.custom.cal".

  3. Enter the name of the custom calibration file in the calibration menu of the SPEC utility.

The routine for custom calibration will now be called whenever the CALIBRATE monitor command or program instruction is invoked.The calling parameters are described in the following table:

Type Parameter name Description
Input
mtr_mask
Bit mask indicating which motors to calibrate. Bit n (counting from 1) is set when motor n should be calibrated. Normally all motors of a robot will be calibrated unless they have been disabled in the SPEC motor configuration menu.
Output
mtr
If a motor-related error occurs during calibration (stt > -1000,) this parameter contains the corresponding motor number.
If no error occurs, or if the error is not motor-related (stt <= -1000,) this parameter is not used.
Output
stt
Standard V+ error code. A custom calibration routine should return a standard V+ error code as defined in the V+ Language Reference Guide. Error messages particularly useful for calibration have predefined global variables that may be used - see Error Codes.

Calibration Primitives

The utility routines in Standard Calibration Utility Routines are used for standard calibration, and may be called by a custom calibration to perform primitive calibration functions. For details on the inputs and outputs for these routines, see Program Headers for Calibration Primitives.

The primitives for searching for various calibration features are implemented as "state machines": repeated calls to the routine are required to step through the search algorithm. This is useful because searches for multiple joints can be started at the same time, rather than forcing searches to proceed sequentially on a joint-by-joint basis. For details of how these state machines can be used, refer to the program listings for STANDARD.CAL, and the example programs in Examples of Custom Calibration.

Standard Calibration Utility Routines
Calibration Primitive
Function
ca.clr.cala
Clears the calibrated flag for a particular motor. Before each motor is calibrated, the calibrated flag should be cleared. When the motor position is set using the calibration primitive ca.set.pos, the calibrated flag will automatically be set.
ca.find.home
Finds a home sensor in the direction defined in SPEC. Implemented as a state machine.
ca.find.index
Finds zero index in the direction defined in SPEC. After calling this routine, the index position should be checked and corrected by calling "ca.fix.index" (described below.) Implemented as a state machine.
ca.find.stop
Finds a hardstop according to the parameters defined in SPEC. Implemented as a state machine.
ca.fix.index
Corrects index position based on "expected distance from sensor to zero index" defined in SPEC. Normally ca.fix.index should always be called after "ca.find.index" to ensure that the correct index has been found.
ca.home
Performs standard calibration of a single motor, including finding a hardstop or home sensor, finding a zero index, and moving to a safe position. Implemented as a state machine.
ca.move
Start a motor motion
ca.move.safe
Move a motor to its safe position defined in SPEC.
ca.power
Prepare a motor for motion under program control.
ca.rd.pos
Reads current motor position in encoder counts.
ca.rd.cal.parm
Reads the calibration parameters entered using SPEC. See listing of parameters that can be accessed in Parameter Options for ca.rd.cal.parm.
ca.rd.cal.posa
Reads position of the calibration feature that will be used to calibrate the motor. This value, in encoder counts, is defined in SPEC. It may be the actual position of a hard stop, home sensor, zero index, or zero position of an absolute encoder. The calibration feature actually used depends on the homing configuration defined in SPEC.
ca.clr.cala
Clears the calibrated flag for a particular motor. Before each motor is calibrated, the calibrated flag should be cleared. When the motor position is set using the calibration primitive ca.set.pos, the calibrated flag will automatically be set.
ca.set.posa
Sets motor position in encoder counts. This routine is used to set the calibrated position of motor. It also sets the calibrated flag for the motor.

 

The table below lists the parameter names that must be used with ca.rd.cal.parm to retrieve the values set in SPEC for calibration.

Parameter Options for ca.rd.cal.parm
Parameter Type
Parameter Name
Motion Calibration Group
ca.calgrp
Homing Configuration
ca.homcfg
Homing Speed and Direction for initial search for home switch or hard stop
ca.homvel
Speed and direction for fine search
ca.homslo
Maximum Search Distance
ca.homdst
'Motor Stalled' timeout during calibration
ca.satcal
Maximum Home switch width
ca.homwid
'Hard-stop Found' Position Error
ca.hrderr
Distance from edge of home switch (or hard stop or current position) to first zero index
ca.homzid
Motor position at zero index (or home switch or hard stop or current position)
ca.hompos
Park Position After Homing
ca.homsaf

Advanced Customization

There are some mechanisms for which the above calibration primitives cannot provide the necessary degree of control over the motion of the robot or the algorithms used for searching for calibration features. In these cases, the Advanced Servo Library should be used to augment the capabilities of the calibration primitives. The Advanced Servo Library gives access to many low-level functions and parameters of the servo code. For example:

The Advanced Servo Library must be purchased from Adept.

Examples of Custom Calibration

The following example programs illustrate how calibration primitives may be used to write a custom calibration program.

Single-Axis Mechanism

The simplest case of calibration might be for a single-axis mechanism that calibrates based on the position of a hardstop at one end of its work envelope. While this case is a subset of standard calibration and thus does not require a custom calibration program, it shows how to use calibration primitives.

.PROGRAM a.custom.cal(mtr_mask, mtr, stt, io[], $io[]) 
; ABSTRACT:	Custom calibration program to calibrate a single-axis  
;		mechanism based on a hardstop. 
; 
; INPUT PARM: 
;	mtr_mask	Bit mask indicating which motors to calibrate.  Bit "n" (counting 
;		from 1) is set when motor "n" should calibrate.
;        io[]     (Optional) Custom I/O real variables.
;        $io[]    (Optional) Custom I/O string variables
;                 
; 
; OUTPUT PARM:	 
;	mtr 	If a motor-related error occurs (stt <= -1000,) contains the motor 
;		number associated with the error. If no error occurs, or the error 
;		is not motor-related (stt > -1000,) value may not be valid. 
; 
;	stt	Standard V+ error code.
;        io[]     (Optional) Custom I/O real variables.
;        $io[]    (Optional) Custom I/O string variables

	AUTO motor.no, state, hardstop.pos, cal.pos 
	AUTO current.pos, correction, corrected.pos 
	motor.no = 1	;Motor number 
;  Check to make sure that the motor is selected for calibration. If so, mark it as  
; "uncalibrated." If not, return an error. 
	IF mtr_mask BAND BMASK(motor.no) THEN 
	    CALL ca.clr.cal(motor.no, stt) 
	    IF stt < 0 GOTO 100 
	ELSE 
	    stt = ca.er_cfg	;*Not configured as accessed* 
	    GOTO 100 
	END 
; Power up motor:  enable amp, release brakes, and begin servoing. 
	CALL ca.power(BMASK(motor.no), BMASK(motor.no), mtr, stt) 
	IF stt < 0 GOTO 100 
; Search for the hardstop. The search direction and speed, and other search  
; parameters, are defined in SPEC. The search routine is set up as a "state ma-chine." 
; It is called repeatedly as each step, or state, in the search is completed. The current  
; step is identified by the value of "state," which starts with a value of zero. Each  
; time the search routine is executed, "state" is incremented by one, stepping  
; sequentially through the search algorithm. When the algorithm is complete, state is  
; again set to zero. The error flag is checked after each call to the search rou-tine. 
; If an error occurs, this program is exited. 
	state = 0			;Initial value of state machine 
	DO 
	    CALL ca.find.stop(motor.no, state, hardstop.pos, stt) 
	    IF stt < 0 GOTO 100	;Exit if error 
	UNTIL state == 0 
; Read the nominal position of the hardstop. This will have been entered  
; as the "Motor position at hardstop" in the calibration menu of SPEC. 
	CALL ca.rd.cal.pos(motor.no, cal.pos, stt) 
	IF stt < 0 GOTO 100 
; Calculate and set the calibrated position of the motor. This will be based on  
; three values: the "motor position at hardstop" defined in SPEC, the "uncalibrat-ed"  
; hardstop position determined in the search above, and the current position of  
; the motor. When the motor position is set the "calibrated" flag for the motor  
; is automatically set. Note that this is different than marking the entire  
; robot as calibrated; this will be done at a higher level of the calibration utility  
; package upon successful completion of this program. 
	CALL ca.rd.pos(motor.no, current.pos, stt)	;Read current motor position 
	IF stt < 0 GOTO 100 
	correction = hardstop.pos-cal.pos	 
	corrected.pos = current.pos-correction 
	CALL ca.set.pos(motor.no, corrected.pos, stt)  ;Set corrected motor pos 
	IF stt < 0 GOTO 100 
; Move motor to safe position as defined in SPEC. As with the hardstop search,  
; this operation is implemented as a state machine: multiple calls are required to 
; sequence through the steps in the operation. 
	state = 0					;Initial state 
	DO 
	    CALL ca.move.safe(motor.no, state, stt) 
	    IF stt < 0 GOTO 100			;Exit if error 
	UNTIL state ==0 
100	RETURN 
.END

Absolute Encoders

During normal robot motion, Adept SmartMotion uses incremental encoder information to control the motors. Some encoders have a mode in which they can provide their absolute position. To read the absolute position, special hardware and software provided by the user is required.

The following example program assumes that custom hardware and software are present that provide the absolute position in encoder counts of all the encoders on the robot. Even though the encoders are "absolute," it is still necessary to relate the absolute position of the encoder to the absolute position of the robot. This is accomplished using the offset between the zero position of the absolute encoder and the zero position of a given axis. The offset can be defined in the SPEC calibration menu as "Motor position at nest location."

NOTE: The "Homing Configuration" in SPEC has an absolute setting. This is reserved for use by Adept and not be selected.

For the example program to function properly, the absolute encoder offset must be calculated as follows:

.PROGRAM a.absolute.cal(mtr_mask, mtr, stt, io[], $io[]) 
; ABSTRACT:	Custom calibration program to calibrate a robot with absolute 
;		encoders. The robot will not be moved during the calibration process. 
; 
; INPUT PARM: 
;	mtr_mask	Bit mask indicating which motors to calibrate. Bit "n" (count-ing 
;		from 1) is set when motor "n" should calibrate.
;        io[]     (Optional) Custom I/O real variables.
;        $io[]    (Optional) Custom I/O string variables
; 
; OUTPUT PARM:	 
;	mtr      	If a motor-related error occurs (stt <= -1000,) contains the motor 
;		number associated with the error. If no error occurs, or the error 
;		is not motor-related (stt > -1000,) value may not be valid. 
;			  
;	stt	Standard V+ error code.
;        io[]     (Optional) Custom I/O real variables.
;        $io[]    (Optional) Custom I/O string variables
 
	AUTO mtrs, absolute.offset 
	mtrs = ID(3,8)	;Number of motors 
; Loop through all motors, calibrating one at a time. 
	FOR mtr = 1 TO mtrs 
	; Check to see that this motor is selected for calibration. If not, skip it. 
	    IF NOT mtr_mask BAND BMASK(mtr) THEN 
		NEXT	;Skip this motor 
	    END 
	; Mark the motor as "uncalibrated." 
	    CALL ca.clr.cal(mtr, stt) 
	    IF stt < 0 GOTO 100 
	; Read absolute encoder offset defined in SPEC. 
	    CALL ca.rd.cal.pos(mtr, absolute.offset, stt) 
	    IF stt < 0 GOTO 100 
	; Read the current absolute encoder position. Note that the routine below 
	; that reads the absolute encoders must be provided by the user. 
	    CALL read.abs.encoder(mtr, absolute.pos) 
	; Set the motor position based on the offset between "absolute encoder 
	; space" and "motor space." When the motor position is set, the  
	; "calibrated" flag for this motor will automatically be set. 
	    motor.pos = absolute.position-absolute.offset 
	    CALL ca.set.pos(mtr, motor.pos, stt)	;Set calibrated position 
	    IF stt < 0 GOTO 100 
	END 
100	RETURN 
.END

Program Listings For Calibration Utilities

STANDARD.CAL Listing

.PROGRAM a.standard.cal(mtr_mask, mtr, stt, io[], $io[]) 
; ABSTRACT: Main calling program for standard robot calibration. This  
;	program performs calibration of all specified motors using hardstops,  
;	home sensors, and/or zero-index marks, as determined by the "homing 
;	configuration" defined in SPEC. It handles split-axes, self-commutating 
;	motors, and motors commutated by the servo board. 
; 
;	In order for this program to be called when a CALIBRATE monitor  
;	command or program instruction is invoked, the STANDARD.CAL  
;	file containing this program should be present in the /CALIB/ directory of  
;	the boot disk, and the file name "STANDARD.CAL" should be entered  
;	in the calibration menu of the SPEC utility. 
; 
; INPUT PARM: 
;	mtr_mask	Bit mask indicating which motors to calibrate. Bit "n" (count-ing 
;		from 1) is set when motor "n" should calibrate.
;        io[]     (Optional) Custom I/O real variables.
;        $io[]    (Optional) Custom I/O string variables
; 
; OUTPUT PARM:	 
;	mtr      	If a motor-related error occurs (stt <= -1000,) contains the motor 
;		number associated with the error. If no error occurs, or the error 
;		is not motor-related (stt > -1000,) value may not be valid. 
;			  
; 	stt	Standard V+ error code.
;        io[]     (Optional) Custom I/O real variables.
;        $io[]    (Optional) Custom I/O string variables
 
	AUTO calgrp[12], group, mask, mtrs, state[12] 
	mtrs = ID(3,8)	;No. of motors in mechanism 
; Read calibration groups defined in SPEC. Mark each motor as uncalibrated. Ignore 
; those motors that are not to be calibrated, as determined by the bit mask "mtr_mask." 
	FOR mtr = 1 TO mtrs 
	    IF mtr_mask BAND BMASK(mtr) THEN 
		CALL ca.rd.cal.parm(mtr,ca.calgrp,calgrp[mtr],stt) 
		IF stt <0 GOTO 100 
		CALL ca.clr.cal (mtr,stt) 
		IF stt <0 GOTO 100 
	    ELSE 
	        calgrp[mtr] = 0	;Don't calibrate this motor 
	    END 
	END 
	FOR group = 1 TO 16 
	; Prepare for calibration by creating a bit mask indicating 
	; motors to be calibrated in this group, and initializing 
	; calibration state to 0. Motors within each group will be 
	; calibrated at the same time. 
	    mask = 0		;Initialize bit mask 
	    FOR mtr = 1 TO mtrs 
		IF calgrp[mtr] BAND BMASK(group) THEN 
		    state[mtr] = 0 
		    mask = mask BOR BMASK(mtr) 
		END 
	    END 
	    IF NOT mask THEN	;If no motors in this group,		 
	        NEXT		;  skip to next group 
	    END 
	; Power up motors in current group: enable amps, release brakes, twang if  
	; necessary, and begin servoing. 
	    CALL ca.power(mask, , mtr, stt) 
	    IF stt < 0 GOTO 100 
	; If a motor is part of a split-axis pair, put the companion motor into slave mode 
	; so it follows along as the primary motor calibrates. 
	    FOR mtr = 1 TO mtrs 
		IF mask BAND BMASK(mtr) THEN 
		    CALL ca.slave(mtr, ON, stt) 
		    IF stt < 0 GOTO 100 
		END 
	    END 
	; Run through calibration state machine until calibration is complete 
	; on all motors in this group. Each call to "ca.home" initiates one of the  
	; steps below, or returns if not complete.  
	; The steps are: 
	; 1) find calibration feature (home sensor, hard stop)   
	; 2) find zero index 
	; 3) set calibrated motor position,  
	; 4) move to safe position. 
	    DO 
		FOR mtr = 1 TO mtrs 
		    IF mask BAND BMASK(mtr) THEN 
		    ; Perform next step in calibration state machine. 
			CALL ca.home(mtr, state[mtr], stt) 
			IF stt < 0 GOTO 100 
		    ; Check if calibration is complete. If so, remove motor 
		    ; from calibration group, and disable split axes. 
			IF state[mtr] <= 0 THEN 
			    mask = mask BXOR BMASK(mtr) 
			    CALL ca.slave(mtr, OFF, stt) 
			    IF stt < 0 GOTO 100 
			END 
		    END 
		END 
	    UNTIL NOT mask 
	END 
 100	RETURN 
.END

Program Headers for Calibration Primitives

.PROGRAM ca.clr.cal(mtr, stt) 
; ABSTRACT: This routine clears the "calibrated" flag of a particular motor.  For each 
; motor to be calibrated, the flag should be cleared before calibration begins, and set 
; after successful calibration. 
; 
; INPUT PARM:	mtr	motor number whose calibration flag is to be cleared	 
; 
; OUTPUT PARM:	stt	Standard V+ error code. 
; 
; SIDE EFFECTS: NONE 
; 
; Copyright (c) 1994, 1995 by Adept Technology, Inc..PROGRAM ca.find.home(mtr, state, pos, stt) 
; ABSTRACT:  Calibration utility program for finding home sensor. 
;	The home sensor search state machine is described in the 
;	AdeptMotion User's Guide. 
; 
; INPUT PARM:   mtr     Motor number 
;               state   State entering this routine 
;                         Set to 0 to start state machine. 
; 
; OUTPUT PARM:  state   State exiting this routine 
;                         Value is 0 if state machine complete. 
;               pos     Raw position at which home sensor was found 
; 		  stt     Standard V+ error code. Of special interest: 
;			  *Calibration sensor failure* if home sensor 
;			    is not detected after motion completes, or 
;			    if too many home sensor transitions are 
;			    detected between samples. 
;			  *Robot power off* if the POWER switch is off. 
; 
; SIDE EFFECTS:	Motor will be moved. 
; 
; Copyright (c) 1994, 1995 by Adept Technology, Inc..PROGRAM ca.find.index(mtr, state, pos, stt) 
; ABSTRACT:  Calibration utility program for finding zero index. 
;       The motor will only be moved if "zero-index found" bit is 
;	not set on entry.  The zero-index search state machine is 
;	described in the Adept SmartMotion Developer's Guide. 
; 
; INPUT PARM:   mtr     Motor number 
;               state   State entering this routine 
;                         Set to 0 to start state machine. 
; 
; OUTPUT PARM:  state   State exiting this routine 
;                         Value is 0 if state machine complete. 
;               pos     Raw position at which zero index was found 
; 		  stt     Standard V+ error code. Of special interest: 
;			   *Invalid argument* if homing configuration 
;			     specifies absolute calibration. 
;			   *No zero index* if no zero-index declared 
;			     after search completes. 
;			   *Robot power off* if the POWER switch is off. 
;			   *Unexpected zero index* if index errors 
;			     occurred during search. 
; 
; SIDE EFFECTS:		 Motor may be moved. 
; 
; Copyright (c) 1994, 1995 by Adept Technology, Inc..PROGRAM ca.find.stop(mtr, state, pos, stt) 
; ABSTRACT:  Calibration utility program for finding hard stop. 
;	The motor is left at the edge of the hard stop.  To avoid 
;	possible "Motor stalled" errors, it should be moved off 
;	the hard stop to a safer location as soon as possible. 
; 
; INPUT PARM:   mtr     Motor number 
;               state   Input state of state machine.        
;                         Set to 0 to start state machine. 
; 
; OUTPUT PARM:  state   State exiting this routine 
;                         Value is 0 if state machine complete. 
;               pos     Raw position at which hard stop was found 
;		  stt     Standard V+ error code. Of special interest: 
;			  *Calibration sensor failure* if hard stop 
;			   is not detected after motion completes. 
;			  *Robot power off* if the POWER switch is off. 
; 
; SIDE EFFECTS: Moves motor.  Motor is at edge of hard-stop. 
; 
; Copyright (c) 1994, 1995 by Adept Technology, Inc..PROGRAM ca.fix.index(mtr, expected, raw, delta, stt) 
; ABSTRACT:  Adds to the current calibration correction using the 
;       actual and expected positions of the zero index. 
;	This routine will never make a change of greater than 
;	1/2 turn.  If the difference between the expected and 
;	actual positions is greater than 1/2 turn, then it is 
;	assumed you found a different index than the expected 
;	one, and it uses the predicted position of that index. 
; 
; INPUT PARM:   mtr		Motor number to correct 
;		expected		Expected position for calibration feature 
;               raw		Actual position for calibration feature 
;               delta		Current calibration correction delta 
; 
; OUTPUT PARM:  delta		Calibration correction delta, updated 
;			  	 to contain any zero-index correction. 
;			 	 This may vary by +/- turn/2 from 
;			  	 the value that was input. 
; 		stt    		Standard V+ error code. Of special interest:	;S09 
;				*Illegal value* if zero-index spacing <=0. 	;S09 
; 
; SIDE EFFECTS: None 
; 
; Copyright (c) 1994, 1995 by Adept Technology, Inc..PROGRAM ca.home(mtr, state, stt) 
; ABSTRACT:     Standard calibration of a motor.  Depending on the 
;	homing configuration, this routine will use the home sensor, 
;	hard-stop, and/or zero-index to calibrate a motor.  If the 
;	motor is not configured, it immediately returns with no error. 
; 
; INPUT PARM:   mtr      Motor number 
;               state    State entering this routine 
;                         Set to 0 to start state machine. 
; 
; OUTPUT PARM:  state    State exiting this routine 
;                         Value is 0 if state machine complete. 
; 		  stt      Standard V+ error code. Of special interest: 
;			    *Invalid argument* if homing configuration 
;			     specifies absolute calibration. 
; 
; SIDE EFFECTS: Moves motor through calibration sequence. 
; 
; Copyright (c) 1994, 1995 by Adept Technology, Inc..PROGRAM ca.move(mtr, abs, pos, speed, type, tol, stt) 
; ABSTRACT:     Use the servo trajectory generator to start a move 
;	of the specified motor.  The motion will start and stop with 
;	the default acceleration time (in milliseconds) specified by 
;	servo opcode 1054.   
; 
; INPUT PARM:   mtr	  Motor number 
;               abs     Flag: 
;			    Zero: perform move relative to current position 
;			    Non-zero: perform move to specified absolute position 
;               pos     	Commanded displacement, counts (signed) 
;               speed   	Commanded speed, counts/millisecond (unsigned) 
;			    A value of 0 will use the default motor motion 
;			    as specified by servo opcode 1042. 
;		type	  Type of search: 
;			  -1: Start motion with no monitoring 
;			   0: Stop at home sensor transition 
;			   1: Stop at hard stop 
;		tol	  Meaning depends on "type" as follows: 
;			   TYPE  TOL 		 MEANING 
;			   ----  ---	----------- 
;			    -1	   0 	 Do not wait for motion to complete 
;			   	 other	 Wait for motion to complete 
;			     0   		 Unused 
;			     1		 Position error at which hard-stop 
;					  will be declared 
; 
; OUTPUT PARM:  stt      Standard V+ error code. Of special interest: 
;			   *Robot power off* if the POWER switch is off. 
; 
; SIDE EFFECTS:	Moves motor. 
; 
; Copyright (c) 1994, 1995 by Adept Technology, Inc..PROGRAM ca.move.safe(mtr, state, stt) 
; ABSTRACT:     Moves the motor to its safe position. 
; 
; INPUT PARM:   mtr     Motor number 
;               state   State entering this routine 
;                         Set to 0 to start state machine. 
; 
; OUTPUT PARM:  state   State exiting this routine 
;                         Value is 0 if state machine complete. 
; 		  stt     Standard V+ error code. Of special interest: 
;			   *Robot power off* if the POWER switch is off. 
; 
; SIDE EFFECTS:	 Moves motor to safe position. 
; 
; Copyright (c) 1994, 1995 by Adept Technology, Inc..PROGRAM ca.power(com_msk, pos_msk, mtr, stt) 
; ABSTRACT: Ensures that the power sequencing is performed on 
;	the specified motors by enabling the drives, releasing 
;	the brakes, twanging (if necessary), and putting the 
;	motor into position control mode. 
; 
;	It is assumed that the POWER system switch is already ON. 
; 
;	Examples: 
;	CALL ca.power(0, 0, , stt)		;Enable power and amps only 
;					; but do not release brakes 
;	CALL ca.power(, 0, , stt)		;Limp robot by starting 
;					; commutation, releasing 
;					; brakes, setting DAC to 0 
;	CALL ca.power(0, , , stt)		;Start servoing all motors 
;					; that are ready to commutate 
;					; and release brakes 
;	CALL ca.power(, , , stt)		;Starts commutating and 
;					; servoing all motors, 
;					; releasing brakes 
; 
; INPUT PARM:   com_msk Bit mask indicating motors to start 
;			   commutating: 
;			    Undefined: all motors 
;			    0: 		 no motors 
;			    BMASK(n):  motor n 
; 		pos_msk	  Bit mask indicating motors to put 
;			  into position control mode:   
;			    Undefined: 	all motors 
;			    0: 		no motors 
;			    BMASK(n):	motor n 
; 
; OUTPUT PARM:  mtr 	    If no error, unchanged 
;			   If error (stt < 0), motor number causing error 
; 		stt       Standard V+ error code. Of special interest: 
;			   *Motor startup failure* if motor commutation 
;			     was not successfully started. 
;			  *Robot power off* if the POWER switch is off. 
;			  *Timeout enabling power* if "power-on" not 
;			    indicated by servos in proper timeout interval 
;			  *Timeout enabling amplifier* if "amp-on" not 
;			    indicated by servos in proper timeout interval 
;			 
; SIDE EFFECTS: If necessary, this routine enables power, drives,  
;	commutation, and position control.  Motors of this robot 
;	will remain in V+ control if the robot is calibrated and 
;	power sequencing is already complete.  If not, the motors 
;	may be left in servo control mode. 
; 
; Copyright (c) 1994, 1995 by Adept Technology, Inc..PROGRAM ca.rd.cal.parm (mtr, param, value, stt) 
; ABSTRACT:  Reads value of calibration parameters entered through spec by user. 
; 
; INPUT PARM:   mtr     Motor number 
;               param   name of paramter value desired 
; 
; OUTPUT PARM:  value   value of desired parameter 
; 		  stt     Standard V+ error code. 
; 
; SIDE EFFECTS: None. 
; 
; Copyright (c) 1994, 1995 by Adept Technology, Inc..PROGRAM ca.rd.pos(mtr, pos, stt) 
; ABSTRACT: This routine reads the current motor position in encoder counts. 
; 
; INPUT PARM:	mtr	motor number to be read 
; 
; OUTPUT PARM:	pos	motor position in encoder counts 
; 
;		stt	Standard V+ error code. 
; 
; SIDE EFFECTS: NONE 
; 
; Copyright (c) 1994, 1995 by Adept Technology, Inc..PROGRAM ca.rd.cal.pos(mtr, cal.pos, stt) 
; ABSTRACT: This routine reads the position of the calibration feature that will  
;	be used to calibrate the motor. This value, in encoder counts, is  
;	defined in SPEC. It may be the actual position of a hard stop, home  
;	sensor, zero index, or zero position of an absolute encoder. The  
;	calibration feature actually used depends on the "homing configura-tion" 
;	defined in SPEC. 
; 
; INPUT PARM:	mtr	  motor number to be read 
; 
; OUTPUT PARM:	cal.pos  position of the calibration feature that will be used to  
;			  calibrate the motor in encoder counts 
; 
;		stt	  Standard V+ error code. 
; 
; SIDE EFFECTS: NONE 
; 
; Copyright (c) 1994, 1995 by Adept Technology, Inc..PROGRAM ca.set.pos(mtr, pos, stt) 
; ABSTRACT: This routine sets the motor position in encoder counts. This routine 
;	is used to set the calibrated position of the motor. It also sets  
;	the "calibrated" flag for the motor. 
; 
; INPUT PARM:	mtr	motor number to be read 
; 
; OUTPUT PARM:	pos	motor position that will be used to calibrate the motor  
;			in encoder counts 
; 
;		stt	Standard V+ error code. 
; 
; SIDE EFFECTS: NONE 
; 
; Copyright (c) 1994, 1995 by Adept Technology, Inc.

Error Codes

The V+ error codes below are returned by the standard calibration package. They can also be referenced and returned by a custom calibration program.

Variable name
Value
Standard V+ error message
ca.er_dry
50
*Executing in DRY.RUN mode*
ca.er_arg
-407
*Invalid argument*
ca.er_nry
-508
*Device not ready*
ca.er_cfg
-544
*Not configured as accessed*
ca.er_pow
-604
*Robot power off*
ca.er_tmo
-659
*Device time-out*
ca.er_pto
-675
*Time-out enabling power*
ca.er_rge
-1002
*Position out of range*
ca.er_nul
-1003
*Time-out nulling errors*
ca.er_idx
-1004
*No zero index*
ca.er_ato
-1009
*Timeout enabling amplifier*
ca.er_mot
-1105
*Motor startup failure* Mtr
ca.er_cal
-1106
*Calibration sensor failure* Mtr

Submit comments to: techpubs@adept.com
Last modified on: 9/29/2010
Copyright © 1994 - 2010. Adept Technology, Inc.