Guide Utilisation Robot M-6i PDF
Guide Utilisation Robot M-6i PDF
GPA-774
Robots Industriels II Hiver 2003
1 INTRODUCTION
Finalement, le dernier chapitre donne la description (en anglais) des principales commandes
du langage Karel. Ces descriptions proviennent directement du « System R-J3 Controller
Karel Reference Manual » de la compagnie FANUC Robotics.
Guide d’utilisation du robot M-6i : Description générale. 2-1
2 DESCRIPTION GÉNÉRALE
La Figure 2.1 illustre une vue d’ensemble du système : le panneau de l’opérateur, le boîtier
de commande, le robot M-6i et le contrôleur (le contrôleur peut être intégré à l’arrière du
robot ou déporté).
L'interaction entre le robot et l'opérateur se fait à l'aide du panneau de contrôle, d'un écran
et d'un boîtier de commande. Cette interaction est simplifiée par des menus ou en utilisant
directement le langage de commande. Dans notre laboratoire, le contrôleur est aussi relié à
un micro-ordinateur pour la programmation hors-ligne et la sauvegarde de programmes. Il
Guide d’utilisation du robot M-6i : Description générale. 2-2
Le robot M-6i a six (6) articulations en rotation telles qu’illustrées sur la Figure 2.1.
Chaque articulation est actionnée par des moteurs AC sans balais. Des encodeurs absolus
indiquent la position des articulations. Le Tableau 2.1 donne l'intervalle de déplacement et
la vitesse maximale de chaque articulation. Des freins mécaniques sont présents à chaque
articulation.
B. Spécifications techniques
2.2 Contrôleur
A. Éléments internes
C. Architecture de la mémoire
Le Tableau 2.3 explique les trois (3) type de mémoire utilisée par le contrôleur R-J3 :
CMOS RAM, FROM (Flash ROM) et DRAM. Les mémoires CMOS RAM (Battery-
Backed) et FROM sont permanentes tandis que la DRAM représente la mémoire vive
du système.
Le panneau de l’opérateur (Figure 2.3) est utilisé pour effectuer les tâches de base : mise
sous tension et hors-tension, lancement du programme en mode automatique (CYCLE
START), arrêt d’urgence, réarmement après une faute (FAULT RESET), pause du robot
(HOLD) et voyants d’état.
Items Descriptions
Bouton HOLD Effectue une pause sur l'exécution du programme. Le robot
décélère normalement et s'arrête. L'alimentation demeure sur
les moteurs.
Bouton CYCLE Permet de démarrer le programme courant en mode automatique
START et de redémarrer un programme interrompu par un HOLD.
Interrupteur Coupe l’alimentation au panneau de l’opérateur et au robot. La
d’alimentation Figure 2.3 montre l'emplacement de l'interrupteur principal
principale d'alimentation électrique (Power Disconnect Circuit Breaker).
Il est important de connaître son emplacement lors d'une
situation d'urgence.
Le boîtier de commande (Figure 2.4) est muni d’un bouton d’arrêt d’urgence
(EMERGENCY STOP BUTTON) en forme de champignon rouge. Il possède un
interrupteur ON/OFF (ON/OFF Switch) permettant de prendre le contrôle sur le
mouvement du robot lorsqu’il est à ON. Un interrupteur d’homme-mort (DEADMAN
Switch) de couleur jaune doit être pressé pour être capable d’initier un déplacement du
robot lorsque le boîtier a le contrôle sur ce dernier. Des voyants (Indicators) affichent
l’état du robot. L’écran LCD (Screen) permet d’afficher des menus et des messages
d’erreur. La Figure 2.5 donne une description détaillée des touches du boîtier de
commande.
DEADMAN
Switch
La touche FCTN (Function) permet d’avoir accès à des fonctions globales (Figure 2.6).
Plus particulièrement, elle permet de choisir le niveau de détail associé à la touche
MENUS (QUICK ou FULL).
Guide d’utilisation du robot M-6i : Description générale. 2-9
a) QUICK MENUS
NOTE : Les numéros et l’ordre des items dans les menus peuvent différer
dépendamment des options installées sur le contrôleur.
Guide d’utilisation du robot M-6i : Description générale. 2-11
b) FULL MENUS
La Figure 2.8 montre les FULL MENUS. Ces menus sont utilisés dans la majorité des
procédures décrites au chapitre 3.
Les touches SELECT, EDIT et DATA donnent accès à des menus reliés à
l’enseignement (Teach) de positions de travail et de parcours (trajectoires). Ces touches
permettent de choisir le programme actif (SELECT), d’enseigner les positions et les
parcours (DATA), et de sauvegarder vos données (DATA). La touche EDIT permet
l’édition de programmes en langage TPP.
2.5 Sécurité
La sécurité en robotique touchant les opérateurs consiste 1) à remplacer des travailleurs qui
oeuvrent dans un milieu nuisible et dangereux, et 2) à les protéger du danger potentiel du
robot en mouvement. Cette section s'intéresse à la sécurité de l’opérateur travaillant avec
un robot.
FANUC Robotics recommande que toute personne ayant à opérer, programmer, réparer
ou utiliser le système robotisé doit suivre une formation adéquate pour permettre une
opération appropriée du système.
ATTENTION
Ne jamais contourner, attacher ou désactiver d’une autre façon un dispositif de
sécurité, tel qu’un interrupteur de limite (limit switch), pour faciliter
l’opération du système. La désactivation d’un dispositif de sécurité est
reconnue pour avoir causé des blessures graves ou la mort.
− Connaître les trajets pouvant être utilisés pour éviter un robot en mouvement.
S’assurer que ces trajets ne sont jamais obstrués ;
− Isoler le robot de tous signaux externes pouvant produire un mouvement lorsque
des positions sont entrain d’être enseignées ;
Guide d’utilisation du robot M-6i : Description générale. 2-13
ATTENTION
Rester à l’extérieur de l’enveloppe de travail du robot lorsque le programme
est en exécution (mode automatique). Ne pas le faire peut conduire à des
blessures graves ou la mort.
Certaines mesures sont appropriées pour garder l’effecteur et les autres dispositifs
externes sécuritaires. Toute personne devant opérer le robot doit connaître les mesures
suivantes :
− Vérifier que les interrupteurs de limite (limit switches) dans la cellule sont
fonctionnels ;
− En programmation, implanter des « routines de défaillance » permettant une action
appropriée du robot si un dispositif externe ou un autre robot dans la cellule est
défaillant ;
− En programmation, utiliser un protocole de communication de type
« handshaking » pour synchroniser le robot avec l’opération de dispositifs
externes ;
− Programmer le robot pour vérifier l’état des dispositifs externes durant un cycle
d’opération ;
− Être certain que la cellule est propre et sans présence d’huile, d’eau ou de débris ;
− Utiliser des limites logicielles, des interrupteurs de limite (limit switches) et des
butées mécaniques sur les axes du robot pour prévenir un déplacement non-désiré
du robot dans la zone de travail de dispositifs externes.
Certaines mesures sont appropriées pour garder le robot en bon état et sécuritaire.
Toute personne devant opérer le robot doit connaître les mesures suivantes pour
prévenir des dégâts :
− Utiliser une vitesse réduite (override) pour augmenter votre contrôle sur le robot
lors du déplacement en mode manuel ;
− Anticiper le mouvement du robot avant de presser une touche de déplacement sur
le boîtier de commande ;
− Être certain que l’enveloppe de travail est propre et sans présence d’huile, d’eau ou
de débris ;
− En programmation, établir des zones d’interférence pour prévenir des collisions
lorsque des robots partagent le même espace de travail ;
− S’assurer que le robot retourne ou est proche de sa position de retrait (home)
lorsque le programme prend fin ;
− Être vigilant sur les signaux et les autres opérations qui peuvent engendrer des
actions de l’effecteur causant des blessures ou des dégâts sur les équipements.
Guide d’utilisation du robot M-6i : Description générale. 2-15
Dans son manuel de formation, la compagnie ADEPT énonce les trois (3) principes
généraux suivants sur la sécurité :
− Si un robot ne se déplace pas, n'assumez pas qu'il ne bougera pas ;
− Si un robot répète une séquence, n'assumez pas qu'il va continuer à le faire ;
− Maintenir du respect pour ce qu'est un robot et ce qu'il peut faire.
ATTENTION
Les règles suivantes doivent être suivies sous peine de sanction :
− Seulement les personnes formées peuvent utiliser les robots ;
− Obtenir l'approbation écrite du chargé de laboratoire ou du responsable avant
d'utiliser les robots (étudiants dans le premier cours de robotique) ;
− Enlever les objets inutiles du périmètre ;
− Aucune personne à l'intérieur du périmètre lorsque la porte est fermée ;
− Une seule personne dans le périmètre (à l'exception des instructeurs) ;
− Avoir le boîtier activé dans le périmètre ;
− Exécution à 50% de la vitesse maximale (étudiants dans le premier cours de
robotique) ;
− Être près d'un arrêt d'urgence lors de l'exécution du programme en mode
automatique ;
− Une personne opérant le robot en état d’ébriété est exclue du cours.
ATTENTION
Ne jamais contourner ces règles essentielles de sécurité. La violation de ces règles
est reconnue pour avoir causé des blessures graves et la mort.
Les règles suivantes n’entraînent pas de sanction académique, mais elles ont pour but de
réduire les risques d’accident et le dommage aux équipements :
− Afin d'éviter les bris du boîtier de commande, il doit être accroché à l'endroit prévu
ou dans vos mains. Même si le boîtier de commande de votre robot est
défectueux, il ne faut pas le changer avec celui d'un autre ;
− Inspecter le bon état des équipements avant des utiliser ;
− Vérifier le fonctionnement des boutons d'arrêt d'urgence et de l'interrupteur
d'homme-mort ;
Guide d’utilisation du robot M-6i : Description générale. 2-16
− Vérifier les limites physiques sur l'axe #1 en déplaçant le robot en mode manuel.
D'une session de travail à une autre, ces limites peuvent changer étant donné que
les robots sont utilisés par d'autres personnes ;
− Réduire la vitesse (override) à 30 % lors de la 1ère utilisation et entre 30 et 100 %
après ;
− Tester vos programmes en vitesse réduite.
Guide d’utilisation du robot M-6i : Principales procédures d’opération. 3-1
L’ordinateur relié au robot M-6i utilise le logiciel WinOLPC pour effectuer l’édition hors-
ligne de programme et transférer des fichiers entre le contrôleur et le PC.
Pour compiler votre programme Karel (en format ASCII avec une extension .KL), il
faut :
− Exécuter le logiciel WinOLPC sur le bureau ;
− Dans l’onglet Tools, il suffit de choisir Translate KAREL Program ;
− Sélectionner le programme désiré.
Pour rendre le PC comme une unité de disque (FLPY:) vue par le robot, il faut :
− Dans l’onglet Tools, choisir l’option Floppy Emulator ;
− Sous l’onglet File, choisir le répertoire par défaut en sélectionnant l’option
Change Directory ;
− Choisir Emulate sous l’onglet File.
Cette section explique comment démarrer une session de travail sur le robot. Puis, elle
décrit les étapes pour choisir un programme, enregistrer des positions de travail et exécuter
le robot en mode de vérification et en mode automatique.
La procédure de cette section utilise le QUICK MENUS sur le robot M-6i pour
démarrer une session de travail en suivant les étapes suivantes :
− Presser le bouton MENUS ;
− Choisir l’option NEXT ;
− Choisir l’option SETUP PASSWORDS ;
− Appuyer sur la touche F2 – (USERS) ;
Guide d’utilisation du robot M-6i : Principales procédures d’opération. 3-2
Note : Pour sélectionner les items dans les menus, il faut déplacer le curseur avec les
flèches verticales et appuyer la touche ENTER. Il est également possible d’appuyer
directement la touche correspondant au numéro de l’item.
Les autres procédures de la section 3.2 utilisent les FULL MENUS. Ainsi, il faut :
− Appuyer sur le bouton FCTN ;
− Choisir l’option NEXT ;
− Sélectionner l’option QUICK/FULL MENUS.
À noter qu’il faut choisir le bon référentiel associé à l’effecteur. Pour cela, il faut faire :
− Appuyer sur le bouton MENUS ;
− Choisir Setup ;
− Presser la touche F1 ([TYPE]) ;
− Sélectionner l’option Frames ;
− Presser la touche F3 ([OTHER]);
− Choisir l’option Tool Frame ;
− Choisir un des quatre (4) référentiels disponibles et presser ENTER.
Pour faciliter le changement d’outil, il existe également trois programmes, pince, cup1
et cup2, qui ont été développés pour faire le changement d’effecteur et s’assurer qu’il
correspond au $UTOOL du programme Karel. Pour exécuter ces programmes, il suffit
de :
− Appuyer sur le bouton SELECT ;
− Sélectionner pince, cup1 ou cup2 ;
Guide d’utilisation du robot M-6i : Principales procédures d’opération. 3-4
Les étapes suivantes permettent d’enregistrer une position dans le nœud d’une
trajectoire :
− Appuyer sur le bouton DATA ;
− Appuyer sur la touche F1 – ([TYPE]) ;
− Choisir l’option KAREL Posns ;
− Sélectionner le parcours désiré, puis appuyer la touche ENTER ;
− Presser la touche F2 (HEADER) pour éditer l’entête du parcours. Choisir le
champs désiré et presser ENTER. Entrer les données ;
− Appuyer la touche PREV pour retourner au menu précédent ;
− Sélectionner le nœud désiré ;
− Pour enregistrer, faire simultanément les touches SHIFT & F3 – (RECORD) ;
− Pour modifier les autres champs (données associées) d’un nœud, sélectionner le
nœud et presser la touche ENTER.
Note : Il n’est pas nécessaire de sauvegarder les positions ou les parcours enseignés
puisque ces données, en plus d’être présentes dans la mémoire vive (DRAM), sont
copiées et mises à jour sur la mémoire CMOS.
J. Vérification du programme
L’arrêt d’un programme en exécution (PAUSED ou RUNNING) est réalisé par les
étapes suivantes :
− Appuyer sur le bouton FCNT
− Sélectionner l’option ABORT (ALL).
À la fin de la session, pour sauvegarder les variables Karel sur le PC, il faut :
a) Faire correspondre les unites de disque (si ce n’est pas déjà fait)
Note : Le fichier « .VR » ne peut pas être effacé tant que le programme « .PC » n’a pas
été supprimé.
Guide d’utilisation du robot M-6i : Description et comparaison des commandes Karel. 4-1
PROGRAM nom
Directives au compilateur
CONST
TYPE
VAR
Déclaration des routines
BEGIN
Énoncés exécutables
END nom
TYPE
new_type_name = STRUCTURE
field_name_1 : type_name_1
field_name_2 : type_name_2
...
ENDSTRUCTURE
Tous les types de variables peuvent être utilisés comme champs à l’exception des suivants :
− PATH, FILE et déclaration de STRUCTURE ;
− Des éléments de cette structure.
Guide d’utilisation du robot M-6i : Description et comparaison des commandes Karel. 4-2
Exemple :
TYPE
job = STRUCTURE
job_name : STRING[20]
job_number : INTEGER
path_to_do : ARRAY[10] OF INTEGER
ENDSTRUCTURE
VAR
jobs : ARRAY[100] OF job
BEGIN
current_path = jobs[1].job_number
B. ARRAY<[size{,size}]> OF data_type
Dans la nouvelle version du langage Karel, il est possible de faire un tableau de une à
trois (3) dimensions d’un même type en excluant les types ARRAY et PATH.
Exemple :
C. Type CONFIG
CONFIG = STRUCTURE
CFG_TURN_NO1 : INTEGER
CFG_TURN_NO2 : INTEGER
CFG_TURN_NO3 : INTEGER
CFG_FLIP : BOOLEAN
CFG_LEFT : BOOLEAN
CFG_UP : BOOLEAN
CFG_FRONT : BOOLEAN
ENDSTRUCTURE
Exemple :
flip = pos_var.cfg_flip
Guide d’utilisation du robot M-6i : Description et comparaison des commandes Karel. 4-3
D. XYZWPR
XYZWPR = STRUCTURE
X : REAL -- read-write
Y : REAL -- read-write
Z : REAL -- read-write
W : REAL -- read-write
P : REAL -- read-write
R : REAL -- read-write
CONFIG_DATA : CONFIG -- read-write
ENDSTRUCTURE
Exemple :
x1 = p1.x
E. POSITION
Le type POSITION est maintenant une matrice formée de quatre (4) vecteurs : trois (3)
vecteurs directeurs pour l’orientation et un vecteur pour la translation. Sa structure est
la suivante :
POSITION = STRUCTURE
NORMAL : VECTOR -- read-only
ORIENT : VECTOR -- read-only
APPROACH : VECTOR -- read-only
LOCATION : VECTOR -- read-write
CONFIG_DATA : CONFIG -- read-write
ENDSTRUCTURE
Exemple :
Vz = pos_var.approach
F. JOINTPOS
VAR
var_joint6 : JOINTPOS<n>
Guide d’utilisation du robot M-6i : Description et comparaison des commandes Karel. 4-4
Le type PATH est une structure prédéfinie où chaque nœud est composé d’une position
et de paramètres associés :
TYPE
PATH = STRUCTURE
node_pos : POSITION in group<n>
group_data : GROUP_ASSOC in group<n>
common_data : COMMON_ASSOC
ENDSTUCTURE
GROUP_ASSOC = STUCTURE
SEGRELSPEED : INTEGER
SEGMOTYPE : INTEGER
SEGORIENTYPE: INTEGER
SEGBREAK : INTEGER
ENDSTRUCTURE
COMMON_ASSOC = STUCTURE
SEGTERMTYPE : INTERGER
SEGDECELTOL : INTEGER
ENDSTUCTURE
a) Entête
L’entête est applicable pour tout le parcours. Un exemple de structure d’entête est :
TYPE
hdr_struct = STRUCTURE
path_number : INTEGER
path_name : STRING[20]
frame : POSITION
ENDSTRUCTURE
b) Nœuds
TYPE
node_struct = STRUCTURE
node_posn : XYZWPR
numero_outil : INTEGER
vitesse : INTEGER
segmotype : INTEGER
gun : BOOLEAN
ENDSTRUCTURE
c) Déclaration
Avec les déclarations précédentes de l’entête et du format d’un nœud, il est maintenant
possible de créer un parcours avec la déclaration suivante :
TYPE
-- définition de l’entête hdr_struct
-- définition du nœud node_struct
usr_path = PATH PATHHEADER = hdr_struct,
NODEDATA = node_struct
VAR
path_1 : usr_path
BEGIN
…
WITH $SPEED = path_1[current_node].vitesse, $MOTYPE = LINEAR
MOVE TO path_1[current_node]
SELECT NodeUTOOL OF
CASE(1) : $UTOOL = UtoolPince
CASE(2) : $UTOOL = UtoolSuce1
CASE(3) : $UTOOL = UtoolSuce2
ENDSELECT
IF ActPince THEN
CLOSE HAND 1
ELSE
OPEN HAND 1
ENDIF
IF ActSuce1 THEN
OPEN HAND 2
ELSE
CLOSE HAND 2
ENDIF
Guide d’utilisation du robot M-6i : Description et comparaison des commandes Karel. 4-6
IF ActSuce2 THEN
OPEN HAND 3
ELSE
CLOSE HAND 3
ENDIF
ENDFOR
END DoParcours
L’utilisation des parcours sur le robot M-6i est différente de celle sur le robot S-10.
Étant donné l’apparition des structures dans la nouvelle version de Karel sur le robot M-
6i, il n’est plus nécessaire d’avoir des données associées comme sur le robot S-10.
PROGRAM test
TYPE
hdr_struct = STRUCTURE
path_number : INTEGER
path_name : STRING[20]
uframe : XYZWPR
ENDSTRUCTURE
node_struct = STRUCTURE
node_posn : XYZWPR
numero_outil : INTEGER
vitesse : INTEGER
segmotype : STRING[1]
deceleration : INTEGER
ENDSTRUCTURE
Pour le reste, il suffit de se référer à l’exemple pour le robot S-10. Cependant, il faut
prendre garde à certaines fonctions (index de celles-ci à la section 5) du robot M-6i
qui n’ont pas la même appellation que celles du robot S-10.
I. Variables de système
La gestion du changement d’effecteur (outil) sur le robot M-6i est différent de celui sur
le robot S-10. Sur le robot S-10, pour changer l’effecteur, il suffit de changer la
variable $UTOOL qui est utilisée dans le programme Karel et pour l’enseignement de
positions de travail avec le boîtier. Ce qui n’est pas le cas pour le robot M-6i qui
possède deux systèmes d’effecteur. Il y a celui se trouvant dans la variable $UTOOL
qui sert toujours pour les programmes Karel. Cependant, le système d’outils utilisé
pour enseigner des positions et servant pour les programmes TPP n’est pas le même que
celui dans la variable $UTOOL. Il se trouve dans la variable $MNUTOOLNUM[1].
Sur le robot M-6i, il est possible d’insérer les transformations d’une dizaine d’outils.
Donc, le programmeur n’a pas besoin de savoir ces transformations si elles sont définies
dans le contrôleur. Cependant, pour changer le référentiel associé à l’effecteur (outil)
des programmes Karel, il faut entrer une position de type XYZWPR. Pour la variable
$MNUTOOLNUM[1], il suffit d’entrer l’entier à laquelle l’outil appartient (déjà inscrit
dans le contrôleur) pour le rendre actif.
$MNUTOOLNUM[n] = tool_nb
$GROUP[n].$UTOOL = $MNUTOOL[n,tool_nb]
Afin de toujours faire correspondre ces deux variables vers le même effecteur, il suffit
de faire comme dans l’exemple suivant :
-----------------------------------------------------------------------------------------------------------------
-- File Name : pince.kl
-----------------------------------------------------------------------------------------------------------------
-- Ce programme fait correspondre l’effecteur (la pince) du contrôleur avec celui du
-- programme Karel
PROGRAM pince
%COMMENT = 'FORCE LE TOOL PINCE'
Guide d’utilisation du robot M-6i : Description et comparaison des commandes Karel. 4-8
-----------------------------------------------------------------------------------------------------------------
%INCLUDE klevccdf
CONST
-- constantes identifiant les numéros d'outils sur le robot M-6i
face_plate =1
active_cup1 = 2
active_cup2 = 3
pince_ferme = 4
-----------------------------------------------------------------------------------------------------------------
-- PROGRAMME PRINCIPAL
-----------------------------------------------------------------------------------------------------------------
BEGIN -- pince
$MNUTOOLNUM[1] = pince_ferme
$UTOOL = $MNUTOOL[1,$MNUTOOLNUM[1]]
WRITE TPERROR(CHR(cc_clear_win),'L”outil ',$MNUTOOLNUM[1],' est maintenant actif.’)
END pince
$GROUP[n].$UFRAME = $MNUFRAME[n,$MNUFRAMENUM[n]]
$UFRAME = $GROUP[1].$UFRAME
A. Affectation
L’affectation (=) permet de mettre une constante, une variable ou le résultat d’un calcul
dans une variable. Généralement, il faut éviter le mode mixte pour éviter des problèmes
d’arrondis ou des erreurs à la compilation. Donc, il est préférable, par exemple,
d’assigner un résultat entier à une variable entière. Le compilateur permet d’assigner
des entiers à une variable réelle, mais il n’est pas souhaitable de le faire à l’inverse.
B. Opérations
Il n’y a aucun changement dans la nouvelle version de Karel mis à part l’opérateur « : »
qui s’applique aux variables de type POSITION seulement.
Guide d’utilisation du robot M-6i : Description et comparaison des commandes Karel. 4-9
Les commandes MOVE ABOUT, MOVE AWAY, MOVE AXIS et MOVE RELATIVE
sont utilisées de la même façon. Toutefois, la commande MOVE ALONG s’applique
seulement sur des variables de type PATH. La commande MOVE NEAR utilise seulement
des variables de type POSITION. La commande MOVE TO s’applique à toutes les
variables de localisation : POSITION, XYZWPREXT, XYZWPR, JOINTPOS et
path1[node].
Aucun changement.
Aucun changement.
Aucun changement.
Les signaux d’E/S DIN, DOUT, GIN, GOUT, AIN et AOUT ont toujours la même
syntaxe. Toutefois, les signaux de l’effecteur (HAND) ne sont pas définis sur le robot.
B. E/S du système
Le système utilise des entrées/sorties déjà définies : RDI, RDO, OPIN, OPOUT, TPIN et
TPOUT.
Guide d’utilisation du robot M-6i : Description et comparaison des commandes Karel. 4-10
Le robot possède huit (8) entrées et huit (8) sorties dédiées à l’effecteur (RDI/RDO :
Robot Digital I/O). Sur le robot M-6i, la commande des effecteurs est définie comme-
suit :
− RDO[1] : pince (FALSE ouvre la pince) ;
− RDO[2] : coupe de succion #1 (FALSE désactive la succion) ;
− RDO[3] : coupe de succion #2 (FALSE désactive la succion).
Aussi, pour activer/désactiver l’outil désiré, avec le robot S-10, il suffisait d’utiliser les
commandes OPEN HAND # et CLOSE HAND #. Pour le robot M-6i, il serait encore
possible d’utiliser ces commandes, mais, elles n’ont pas été configurées. Il faut donc
utiliser les sorties RDO[#].
Les E/S OPIN/OPOUT sont dédiées au panneau de l’opérateur. Les entrées sont les
boutons : Fault Reset, Hold, User PB#1, Cycle Start, etc. Les sorties sont les signaux
ProgRun, Cycle Start, TpEnbl, etc.
Ce chapitre compare des fonctions et procédures du langage Karel des robot S-10 et M-6i.
Elle compare également des variables systèmes.
Commandes Karel
Description
M-6i S-10
Retourne un système de coordonnées de type
FRAME FRAME POSITION représentant la transformation de trois ou
quatre positions spécifiées en paramètre.
Va chercher les valeurs des données associées et les
----------- GET_ASSOC
distribue à des variables données en paramètre.
Retourne un Booléen dont la valeur indique si oui ou
IN_RANGE INRANGE non la position spécifiée en paramètre peut être
atteinte par le robot.
Insère un nœud non initialisé dans le PATH spécifié
INSERT_NODE INSPATHNODE
en paramètre avant le nœud spécifié.
Permet de faire la matrice inverse d’une variable de
INV INV
type POSITION passée en paramètre.
----------- LOC Retourne la composante (x, y, z) d’une position.
Permet de tourner le TCP en rotation autour d’un
MOVE ABOUT MOVE ABOUT vecteur spécifié en paramètre à partir de la position
courante du TCP.
Permet de déplacer le TCP le long d’un parcours de
MOVE ALONG MOVE ALONG
type PATH.
Permet de retirer le TCP selon l’axe Z négatif du
MOVE AWAY MOVE AWAY TCP de la position courante en utilisant une valeur
réelle en millimètre.
Permet de déplacer un seul axe (articulation) du
MOVE AXIS MOVE AXIS
robot selon une valeur en degré.
Permet de déplacer le TCP près de la position
MOVE NEAR MOVE NEAR spécifiée, c’est-à-dire à la position spécifiée décalée
selon l’axe Z négatif du TCP.
MOVE Permet de déplacer le TCP selon un vecteur défini
MOVE RELATIVE
RELATIVE dans le référentiel de la cellule (UFRAME).
MOVE TO MOVE TO Permet de déplacer le TCP à la position spécifiée.
Associe un fichier de données ou un port de
OPEN FILE OPEN FILE
communication à une variable.
Retourne un vecteur unitaire représentant l’axe Y de
ORIENT ORIENT
la position spécifiée en paramètre.
Permet de définir une variable selon le type de
PATH PATH
données PATH.
PATH_LEN PATHLEN Retourne le nombre de nœuds d’une variable PATH.
Retourne une variable POSITION équivalente à la
----------- PATHPOS
position du nœud d’un PATH spécifié en paramètre.
Retourne une variable XYZWPR (POSITION sur le
robot S-10) composé des arguments de localisation
POS POS
(x, y, z), des arguments d’orientation (w, p, r) et de
l’argument de configuration (c).
Guide d’utilisation du robot M-6i : Description et comparaison des commandes Karel. 5-3
Commandes Karel
Description
M-6i S-10
Défini une variable, une valeur de retour d’une
routine ou un paramètre d’une routine comme le type
de données POSITION :
POSITION = STRUCTURE
POSITION ----------- NORMAL : VECTOR -- read-only
ORIENT : VECTOR -- read-only
APPROACH : VECTOR -- read-only
LOCATION : VECTOR -- read-write
CONFIG_DATA : CONFIG -- read-write
ENDSTRUCTURE
PURGE PURGE Supprime la définition d’un signal d’interruption
CONDITION CONDITION (CONDITION HANDLER) global.
Permet de copier une variable de type POSITION
----------- POSPATH
dans un des nœuds d’une variable de type PATH.
Relâche tout contrôle du programme Karel sur le
mouvement du robot et des axes auxiliaires pour
RELEASE RELEASE qu’ils puissent être commandés par le boîtier de
commande au cours de l’exécution d’un programme
Karel.
Permet de fixer les différentes valeurs des données
----------- SET_ASSOC
associées d’un nœud à l’intérieur d’un PATH.
Permet de translater une variable POSITION (sur le
----------- SHIFT S-10) selon un vecteur exprimé par rapport au
référentiel de la cellule.
Signale qu’un événement défini par l’usager est
survenu (par exemple, un événement qui satisfaisant
SIGNAL EVENT SIGNAL EVENT
une condition dans un signal d’interruption
(CONDITION HANDLER)).
STRUCTURE ----------- Permet de définir une structure usager.
Permet d’avoir les différents arguments (x, y, z, w, p,
UNPOS UNPOS r, c) d’une variable de type XYZWPR (POSITION
sur le robot S-10).
Permet d’aller chercher les arguments (x, y, z) d’un
----------- UNVEC
vecteur passé en paramètre.
Retourne un vecteur selon les arguments (x, y, z)
----------- VEC
passés en paramètre.
VECTOR VECTOR Défini une variable selon le type VECTOR.
Attente du programme tant qu’une ou plusieurs
WAIT FOR WAIT FOR
conditions n’est ou ne sont pas satisfaites.
Utilisé pour spécifier une condition et une action
WHEN WHEN dans un signal d’interruption (CONDITION
HANDLER) (local ou global).
Utilisé avec l’instruction MOVE pour spécifier
WITH WITH localement des valeurs à certaines variables de
système.
Guide d’utilisation du robot M-6i : Description et comparaison des commandes Karel. 5-4
Commandes Karel
Description
M-6i S-10
Défini une variable de position de type XYZWPR.
XYZWPR = STRUCTURE
X : REAL
Y : REAL
XYZWPR POSITION Z : REAL
W : REAL
P : REAL
R : REAL
CONFIG_DATA : CONFIG
ENDSTRUCTURE
Le Tableau 5.2 compare et explique des variables de système utilisées par les robots M-6i
et S-10.
Tableau 5.2 - Comparaison de certaines variables de système entre les robots M-6i et le S-10.
Variables systèmes
Description
M-6i S-10
Paramètre de mouvement indiquant le
$MOTYPE
($GROUP[1].$MOTYPE)
$MOTYPE type de déplacement (LINEAR, JOINT,
CIRCULAR).
$NILP $NILP Position nulle : POS(0,0,0,0,0,0,c).
Pourcentage de réduction de la vitesse
$MCR_GRP[1].$prgoverride $PRGOVERRIDE
(1 à 100).
Paramètre de mouvement indiquant la
$SEGTERMTYPE terminaison (FINE, COARSE, etc.) par
$SEGTERMTYPE
($GROUP[1].$SEGTERMTYPE) défaut à un nœud d’un parcours de type
PATH.
Paramètre de mouvement spécifiant la
$SPEED ($GROUP[1].$SPEED) $SPEED
vitesse cartésienne (de 0 à 2000).
$TERMTYPE Paramètre de mouvement indiquant la
$TERMTYPE
($GROUP[1].$TERMTYPE) terminaison (FINE, COARSE, etc.).
Transformation du référentiel de la
$UFRAME
($GROUP[1].$UFRAME)
$UFRAME cellule (UFRAME) par rapport à celui
du robot.
Transformation du référentiel de
$UTOOL ($GROUP[1].$UTOOL) $UTOOL l’effecteur (TCP) par rapport à celui du
poignet du robot (Face Plate).
Guide d’utilisation du robot M-6i : Description détaillée des commandes Karel. 6-1
ABORT Action
ABORT Condition
Details:
− The ABORT condition is satisfied when the task is aborted. The actions specified
by the condition handler will be performed ;
− If PROGRAM [n] is not specified, the current task number is used ;
− Actions that are routine calls will not be executed if task execution is aborted ;
− The ABORT condition can be followed by the clause PROGRAM[n], where n is
the task number to be monitored. Use GET_TSK_INFO to get a task number.
See Also : CONDITION... ENDCONDITION Statement
GET_TSK_INFO Built-in
Chapter 6, "Condition Handlers"
Appendix E, “Syntax Diagrams” for additional syntax information
Example : Refer to the following sections for detailed program examples:
− Section B.6, "Path Variables and Condition Handlers Program"
(PTH_MOVE.KL).
− Section B.10, "Using Dynamic Display Built-ins" (DYN_DISP.KL).
ABORT Statement
Purpose : Terminates task execution and cancels any motion in progress (or pending)
Syntax : ABORT <PROGRAM[n]>
Guide d’utilisation du robot M-6i : Description détaillée des commandes Karel. 6-2
Details:
− After an ABORT, the program cannot be resumed. It must be restarted ;
− The statement can be followed by the clause PROGRAM[n], where n is the task
number to be aborted.
See Also : Appendix E, « Syntax Diagrams », for additional syntax information
Example : Refer to the following sections for detailed program examples:
− Section B.2, "Copying Path Variables" (CPY_PTH.KL) ;
− Section B.6, "Path Variables and Condition Handlers Program" (PTH_MOVE.KL)
;
− Section B.12, "Displaying a List From a Dictionary File" (DCLST_EX.KL) ;
− Section B.1, "Setting Up Digital Output Ports for Monitoring" (DOUT_EX.KL).
Purpose : Returns the absolute value of the argument x, which can be an INTEGER or
REAL expression
Syntax : ABS(x) Function Return Type:INTEGER or REAL
Input/Output Parameters:
[in] x:INTEGER or REAL expression %ENVIRONMENT Group:SYSTEM
Details:
− Returns the absolute value of x, with the same data type as x.
Example : Refer to Section B.7, "Listing Files and Programs and Manipulating Strings
(LIST_EX.KL)," for a detailed program example.
Purpose : Returns the arc cosine (cos-1) in degrees of the specified argument
Syntax : ACOS(x) Function Return Type:REAL
Input/Output Parameters:
[in] x:REAL %ENVIRONMENT Group:SYSTEM
Details:
− x must be between -1.0 and 1.0, otherwise the program will abort with an error.
− Returns the arccosine of x.
Example : The following example sets ans_r to the arccosine of -1 and writes this value
to the screen. The output for the following example is 180 degrees.
ROUTINE take_acos
VAR
ans_r : REAL
BEGIN
ans_r = ACOS(-1.)
WRITE ('acos -1 ', ans_r, CR)
END take_acos
The second example causes the program to abort since the input value is less
than -1 and not within the valid range :
Guide d’utilisation du robot M-6i : Description détaillée des commandes Karel. 6-3
ROUTINE take_acos
VAR
ans_r : REAL
BEGIN
ans_r = ACOS (-1.5) -- causes program to abort
WRITE ('acos -1.5 ', ans_r, CR)
END take_acos
NOTE: Approach has been left in for older versions of KAREL. You should now
directly access the vectors of a POSITION (i.e., posn. approach.)
Purpose : Returns the number of elements contained in the specified array argument
Syntax : ARRAY_LEN(ary_var) Function Return Type:INTEGER
Input/Output Parameters:
[in] ary_v ar:ARRAY %ENVIRONMENT Group:SYSTEM
− The returned value is the number of elements declared for ary_var, not the
number of elements that have been initialized in ary_var.
Example : Refer to Section B.7, "Listing Files and Programs and Manipulating Strings"
(LIST_EX.KL), for a detailed program example.
The second example causes the program to abort since the input value is less than -1
and not within the valid range.
ROUTINE take_asin
VAR
ans_r : REAL
BEGIN
ans_r = ASIN (-1.5) -- causes program to abort
WRITE ('asin -1.5 ', ans_r, CR)
END take_asin
AT NODE Condition
Purpose : Condition is satisfied when a specified PATH node or position has been
reached
Syntax : AT NODE[n]
Guide d’utilisation du robot M-6i : Description détaillée des commandes Karel. 6-6
where:
n : an INTEGER expression or * (asterisk)
Details:
− The AT NODE condition can be used only in local condition handlers.
− If the move is along a PATH or to a path node, n specifies the path node. If n is a
wildcard (*) or negative one (-1), any node will satisfy the AT NODE condition.
− If the move is to a position, n = 1 (node 1) can be used to indicate the destination.
− If n is greater than the length of the path (or greater than 1 if the move is to a
position), the condition is never satisfied.
− If n is less than zero or greater than 1000, the program is aborted with an error.
See Also : Chapter 6, “Condition Handlers,” for more information on synchronizing
local condition handlers with the motion environment. PATH_LEN Built-In
Function.
Example : Refer to Section B.1, "Setting Up Digital Output Ports for Monitoring"
(DOUT_EX.KL) for a detailed program example.
ATTACH Statement
Purpose : Gives the KAREL program control of motion for the robot arm and auxiliary
and extended axes
Syntax : ATTACH
Details:
− Used with the RELEASE statement. If motion control is not currently released
from program control, the ATTACH statement has no effect.
− If the teach pendant is still enabled, execution of the KAREL program is delayed
until the teach pendant is disabled. The task status will show a hold of "attach
done."
− Stopped motions can only be resumed following execution of the ATTACH
statement.
See Also : RELEASE Statement
Chapter 8, “Motion” for more information on motion control.
Appendix E, “Syntax Diagrams,” for additional syntax information
Example : Refer to Section B.1, "Setting Up Digital Output Ports for Monitoring"
(DOUT_EX.KL) for a detailed program example.
CANCEL Action
CANCEL Statement
Purpose : Breaks the association between a FILE variable and a data file or
communication port
Syntax : CLOSE FILE file_var
where:
file_var : a FILE variable
Guide d’utilisation du robot M-6i : Description détaillée des commandes Karel. 6-10
Details:
− file_var must be a static variable that was used in the OPEN FILE statement.
− Any buffered data associated with the file_var is written to the file or port.
− The built-in function IO_STATUS will always return zero.
See Also : IO_STATUS Built-In Function
Chapter 7, “File Input/Output Operations”
Appendix E, “Syntax Diagrams,” for additional syntax information
Example : Refer to Section B.12, "Displaying a List From a Dictionary File"
(DCLST_EX.KL), for a detailed program example.
CONDITION...ENDCONDITION Statement
Details:
− cond_hand_no specifies the number associated with the condition handler and
must be in the range of 1-1000. The program is aborted with an error if it is
outside this range.
− If a condition handler with the specified number already exists, the old one is
replaced with the new one.
− The optional [with_list] can be used to specify condition handler qualifiers. See
the WITH clause for more information.
− All of the conditions listed in a single WHEN clause must be satisfied
simultaneously for the condition handler to be triggered.
− Multiple conditions must all be separated by the AND operator or the OR operator.
Mixing of AND and OR is not allowed.
− The actions listed after DO are to be taken when the corresponding conditions of a
WHEN clause are satisfied simultaneously.
− Multiple actions are separated by a comma or on a new line.
− Calls to function routines are not allowed in a CONDITION statement.
− The condition handler is initially disabled and is disabled again whenever it is
triggered. Use the ENABLE statement or action, specifying the condition handler
number, to enable it.
− Use the DISABLE statement or action to deactivate a condition handler.
− The condition handler remains defined and can subsequently be reactivated by the
ENABLE statement or action.
− The PURGE statement can be used to delete the definition of a condition handler.
− Condition handlers are known only to the task which defines them. Two different
tasks can use the same cond_hand_no even though they specify different
conditions.
See Also : Chapter 6, “Condition Handlers”
Appendix E, “Syntax Diagrams,” for additional syntax information
Example : Refer to the following sections for detailed program examples:
Section B.6, "Path Variables and Condition Handlers Program"
(PTH_MOVE.KL)
Section B.1, "Setting Up Digital Output Ports for Monitoring"
(DOUT_EX.KL)
· CFG_FLIP : BOOLEAN
· CFG_LEFT : BOOLEAN
· CFG_UP : BOOLEAN
· CFG_FRONT : BOOLEAN
− Variables and fields of structures can be declared as CONFIG.
− Subfields of CONFIG data type can be accessed and set using the usual structure
field notation.
− Variables and fields declared as CONFIG can be
· Assigned to one another.
· Passed as parameters.
· Written to and read from unformatted files.
− Each subfield of a CONFIG variable or structure field can be passed as a
parameter to a routine, but is always passed by value.
− A CONFIG field is part of every POSITION and XYZWPR variable and field.
− An attempt to assign a value to a CONFIG subfield that is too large for the field
results in an abort error.
Example: The following example shows how subfields of the CONFIG structure can
be accessed and set using the usual structure.field notation.
VAR
config_var1 config_var2 : CONFIG
pos_var : POSITION
seam_path : PATH
I : INTEGER
BEGIN
config_var1 = pos_var.config_data
config_var2 = config_var1
config_var1.cfg_turn_no1 = 0
IF pos_var.pos_config_data.cfg_flip THEN...
FOR i = 1 TO PATH_LEN(seam_path) DO
seam_path[i].node_pos.pos_config = config_ar1
ENDFOR
− The program can reset the clock_var to any value while it is connected.
− A clock_var initialized at zero wraps around from approximately two billion to
approximately minus two billion after about 23 days.
− If clock_var is a system variable or a local variable in a routine, the program
cannot be translated.
NOTE : If two CONNECT TIMER statements using the same variable, are executed
in two different tasks, the timer will advance twice as fast. For example, the timer
will be incremented by 2 * $SCR.$COND_TIME every $SCR.$COND_TIME ms.
However, this does not occur if two or more CONNECT TIMER statements using
the same variable, are executed in the same task.
See Also : Appendix D, “Syntax Diagrams,” for additional syntax information
DISCONNECT TIMER Statement
Example : Refer to the following sections for detailed program examples:
Section B.8, "Generating and Moving Along a Hexagon Path"
(GEN_HEX.KL)
Section B.1, "Setting Up Digital Output Ports for Monitoring"
(DOUT_EX.KL)
CONTINUE Action
CONTINUE Condition
Purpose : Returns the REAL cosine of the REAL angle argument, specified in degrees
Syntax : COS(angle) Function Return Type:REAL
Input/Output Parameters:
[in] angle:REAL expression %ENVIRONMENT Group:SYSTEM
Details:
− angle is an angle specified in the range of ± 18000 degrees. Otherwise, the
program will be aborted with an error.
Example : Refer to Section B.8, "Generating and Moving Along a Hexagon Path"
(GEN_HEX.KL), for a detailed program example.
Purpose : Returns the current Cartesian position of the tool center point (TCP) for the
specified group of axes even if one of the axes is in an overtravel
Syntax : CURPOS(axis_limit_mask, ovr_trv_mask <,group_no>) Function Return
Type:XYZWPREXT
Input/Output Parameters:
[out] axis _limit_mask : INTEGER
[out] ovr_ trv_mask : INTEGER
[in] group _no : INTEGER %ENVIRONMENT Group:SYSTEM
Details:
− If group_no is omitted, the default group for the program is assumed.
− If group_no is specified, it must be in the range of 1 to the total number of groups
defined on the controller.
Guide d’utilisation du robot M-6i : Description détaillée des commandes Karel. 6-15
Purpose : Used within a condition handler to disable the specified condition handler
Syntax : DISABLE CONDITION [cond_hand_no]
where:
cond_hand_no:an INTEGER expression
Details:
− If the condition handler is not defined, DISABLE CONDITION has no effect.
− If the condition handler is defined but not currently enabled, DISABLE
CONDITION has no effect.
Guide d’utilisation du robot M-6i : Description détaillée des commandes Karel. 6-16
− When a condition handler is disabled, its conditions are not tested. Thus, if it is
activated again, the conditions must be satisfied after the activation.
− Use the ENABLE CONDITION statement or action to reactivate a condition
handler that has been disabled.
− cond_hand_no must be in the range of 1-1000. Otherwise, the program will be
aborted with an error.
See Also : Chapter 6, “Condition Handlers,” for more information on using DISABLE
CONDITION in condition handlers
Example : The following example disables condition handler number “stop” when
condition number “start” is triggered.
CONDITION[start]:
WHEN EVENT[go] DO
DISABLE CONDITION[stop]
ENDCONDITION
BEGIN
CONDITION[stop] :
WHEN EVENT[stop] DO -- Condition[stop] shows count
showcount
ENABLE CONDITION[stop]
ENDCONDITION
ENABLE CONDITION[stop]
count = 0
WRITE ('do you want to see count?')
READ (answer,CR)
IF answer = 'n' THEN
DISABLE CONDITION[stop] -- Disables condition[stop]
ENDIF -- Count will not be shown
FOR count = 1 TO 13 DO
SIGNAL EVENT[1]
ENDFOR
END p_disable
ERROR Condition
Syntax : ERROR[n]
where:
n : an INTEGER expression or asterisk (*)
Details:
− If n is an INTEGER, it represents an error code number. The condition is satisfied
when the specified error occurs.
− If n is an asterisk (*), it represents a wildcard. The condition is satisfied when any
error occurs.
− The condition is an event condition, meaning it is satisfied only for the scan
performed when the error was detected. The error is not remembered on
subsequent scans.
See Also : Chapter 6, “Condition Handlers,” for more information on using conditions.
The appropriate application-specific FANUC Robotics SYSTEM R-J3
Controller Setup and Operations Manual for a list of all error codes
Example : Refer to Section B.1, "Setting Up Digital Output Ports for Monitoring"
(DOUT_EX.KL) for a detailed program example.
EVAL Clause
EVENT Condition
Purpose : Specifies the number of an event that satisfies a condition when a SIGNAL
EVENT statement or action with that event number is executed
Syntax : EVENT[event_no]
Guide d’utilisation du robot M-6i : Description détaillée des commandes Karel. 6-20
where:
event_no : is an INTEGER expression
Details:
− Events can be used as user-defined event codes that become TRUE when signaled.
− The SIGNAL EVENT statement or action is used to signal that an event has
occurred.
− event_no must be in the range of -32768 to 32767.
See Also : SIGNAL EVENT Action, and CONDITION or SIGNAL EVENT Statement
Example : Refer to Section B.1, "Setting Up Digital Output Ports for Monitoring"
(DOUT_EX.KL) for a detailed program example.
Purpose : Returns a frame with a POSITION data type representing the transformation
to the coordinate frame specified by three (or four) POSITION arguments.
Syntax : FRAME(pos1, pos2, pos3 <,pos4>) Function Return Type:Position
Input/Output Parameters:
[in]pos1: POSITION
[in]pos2: POSITION
[in]pos3: POSITION
[in]pos4: POSITION %ENVIRONMENT Group:system
Details:
− The returned value is computed as follows:
· pos1 is assumed to be the origin unless a pos4 argument is supplied. See
Figure A-1.
· If pos4 is supplied, the origin is shifted to pos4, and the new coordinate frame
retains the same orientation in space as the first coordinate frame. See Figure
6.1.
· The x-axis is parallel to a line from pos1 to pos2.
Guide d’utilisation du robot M-6i : Description détaillée des commandes Karel. 6-21
· The xy-plane is defined to be that plane containing pos1, pos2, and pos3, with
pos3 in the positive half of the plane.
· The y-axis is perpendicular to the x-axis and in the xy-plane.
· The z-axis is through pos1 and perpendicular to the xy-plane. The positive
direction is determined by the right hand rule.
· The configuration of the result is set to that of pos1, or pos4 if it is supplied.
− pos1 and pos2 arguments must be at least 10 millimeters apart and pos3 must be at
least 10 millimeters away from the line connecting pos1 and pos2. If either
condition is not met, the program is paused with an error.
Example : The following example allows the operator to set a frame to a pallet so that a
palletizing routine will be able to move the TCP along the x, y, z direction in
the pallet's coordinate frame.
WRITE('Teach corner_1, corner_2, corner_3',CR)
RELEASE -- Allows operator to turn on teach pendant and teach positions
ATTACH -- Returns motion control to program
$UFRAME = FRAME (corner_1, corner_2, corner_3)
· Passed as parameters.
· Written to and read from unformatted files.
· Assigned to one another.
− Each subfield of a GROUP_ASSOC variable or structure field can be passed as a
parameter to a routine, but is always passed by value.
− The keyword GROUP_ASSOC can be followed by a clause IN GROUP[n] to
specify the group to which the data applies. If it is not present, it is assumed that
the data is to apply to the default group specified by the %DEFGROUP directive.
See Also : Section 8.4.7, "Path Motion," for default values
Example : Refer to Section B.2, "Copying Path Variables" (CPY_PTH.KL), for a
detailed program example.
HOLD Action
Purpose : Causes the current motion to be held and prevents subsequent motions from
starting
Syntax : HOLD <GROUP[n,{,n}]>
Details:
− Any motion in progress is held. Robot and auxiliary or extended axes decelerate to
a stop.
− An attempted motion after a HOLD is executed is also held. HOLD cannot be
overridden by a condition handler which issues a motion.
− HOLD is released using the UNHOLD statement or action.
− If the group clause is not present, all groups for which the task has control (when
the condition is defined) will be canceled.
− If a motion that is held is part of a SIMULTANEOUS or COORDINATED motion
with other groups, the motions for all groups are held.
− Motion cannot be held for a different task.
See Also : Chapter 8, “Motion,” for more information on starting and stopping motions.
Example : The following example uses a local condition handler to move along the path
pathvar but stops the motion before node 3 using the HOLD action.
MOVE ALONG pathvar,
WHEN TIME 200 BEFORE NODE[3] DO
HOLD
ENDMOVE
HOLD Statement
Purpose : Causes the current motion to be held and prevents subsequent motions from
starting
Syntax : HOLD <GROUP[n{,n}]>
Guide d’utilisation du robot M-6i : Description détaillée des commandes Karel. 6-23
Details:
− Any motion in progress is held. Robot and auxiliary or extended axes decelerate to
a stop.
− An attempted motion after a HOLD is executed is also held. HOLD cannot be
overridden by a condition handler which issues a motion.
− HOLD is released using the UNHOLD statement or action.
− All held motions are canceled if a RELEASE statement is executed while motion
is held.
− If the group clause is not present, all groups for which the task has control will be
canceled.
− If a motion that is stopped, resumed, canceled, or held is part of a
SIMULTANEOUS or COORDINATED motion with other groups, the motions
for all groups are stopped, resumed, canceled, or held.
− Motion cannot be held for a different task.
See Also : Chapter 8, “Motion,” for more information on starting and stopping motions.
Appendix E, “Syntax Diagrams,” for additional syntax information
Example : The following example initiates a move along the path pathvar but stops the
motion until the F1 key TPIN[1] on the teach pendant is pressed.
MOVE ALONG path_var NOWAIT
HOLD
WRITE ('Press F1 on teach pendant to resume motion')
WAIT FOR TPIN[129]+
UNHOLD
Purpose : Returns a BOOLEAN value indicating whether or not the specified position
argument can be reached by a group of axes
Syntax : IN_RANGE(posn) Function Return Type:BOOLEAN
Input/Output Parameters:
[in] posn : XYZWPREXT %ENVIRONMENT Group:SYSTEM
Details:
− The returned value is TRUE if posn is within the work envelope of the group of
axes; otherwise, FALSE is returned.
− The current $UFRAME and $UTOOL are applied to posn.
See Also : CHECK_EPROS Built-in procedure. Chapter 8, “Motion”
Section 4.1.2, "Group Motion"
Example : The following example checks to see if the new position is in the work
envelope before moving the TCP to it.
IF IN_RANGE(pallet: part_slot) THEN
WITH $UFRAME = pallet MOVE TO part_slot
ELSE
WRITE('I can't get there!',CR)
ENDIF
Guide d’utilisation du robot M-6i : Description détaillée des commandes Karel. 6-24
Purpose : Inserts an uninitialized node in the specified PATH argument preceding the
specified path node number
Syntax : INSERT_NODE(path_var, node_num, status)
Input/Output Parameters:
[in] path_ var : PATH
[in] node_ num : INTEGER
[out] stat us : INTEGER %ENVIRONMENT Group:PATHOP
Details:
− node_num specifies the index number of the path node before which the new
uninitialized node is to be inserted.
− The new node can be assigned values by directly referencing its NODEDATA
structure.
− All nodes following the inserted node are renumbered.
− Valid node_num values are in the range node_num => 1 and node_num <=
PATH_LEN(path_va r ).
− If node_num is not a valid node number, status is returned with an error.
− If the program does not have enough RAM for an INSERT_NODE request, an
error will occur.
− If the program is paused, the INSERT_NODE request is N OT retried.
See Also : DELETE_NODE, APPEND_NODE Built-in Procedures
Example : In the following example, the PATH_LEN built-in is used to set the variable
length equal to the number of nodes in path_var. INSERT_NODE inserts a
new path node after the last node in path_var.
length = PATH_LEN(path_var)
INSERT_NODE(path_var, length, status)
Purpose : Used in coordinate frame transformations with the relative position operator
(:) to determine the coordinate values of a POSITION in a frame that differs
from the frame in which that POSITION was recorded
Syntax : INV(pos) Function Return Type : POSITION
Input/Output Parameters:
[in] pos : POSITION %ENVIRONMENT Group:SYSTEM
Details:
− The returned value is the inverse of the pos argument.
− The configuration of the returned POSITION will be that of the pos argument.
Example : The following example uses the INV built-in to determine the POSITION of
part_pos with reference to the coordinate frame that has rack_pos as its
origin. Both part_pos and rack_pos were originally taught and recorded in
User Frame. The robot is then instructed to move to that position.
Guide d’utilisation du robot M-6i : Description détaillée des commandes Karel. 6-25
PROGRAM p_inv
VAR
rack_pos, part_pos, p1 : POSITION
BEGIN
p1 = INV(rack_pos):part_pos
MOVE TO p1
END p_inv
NOPAUSE Action
Purpose : Resumes program execution if the program was paused, or prevents program
execution from pausing
Syntax : NOPAUSE
Details:
− The NOPAUSE action usually corresponds to an ERROR[n] or PAUSE condition.
− The program will be resumed, even if it was paused before the error.
− If the program is paused by itself, the NOPAUSE action will be ignored and
program execution will be paused.
Example : The following example uses a global condition handler to test for error
number 12311. If this error occurs, the NOPAUSE action will prevent
program execution from being paused and the NOMESSAGE action will
suppress the error message normally displayed for error number 12311. This
will allow the routine uninit_error to be executed without interruption.
ROUTINE uninit_error
BEGIN
CONDITION[stop] :
WHEN ERROR[12311] DO
NOPAUSE, NOMESSAGE, uninit_error
ENDCONDITION
WRITE ('Uninitialized operand',CR)
WRITE ('Use KCL> SET VAR to initialize operand',CR)
WRITE ('Press Resume at Test/Run screen to ',cr)
WRITE ('continue program',cr)
PAUSE -- pauses program (undoes NOPAUSE action)
END uninit_error
NOWAIT Clause
Purpose : Returns a unit VECTOR representing the y-axis (orient vector) of the
specified POSITION argument
Syntax : ORIENT(posn) Function Return Type:VECTOR
Input/Output Parameters:
[in] posn : POSITION %ENVIRONMENT Group:VECTR
Details:
− Instead of using this built-in, you can directly access the Orient Vector of a
POSITION.
− The returned value is the orient vector of posn.
− The orient vector is the positive y-direction in the tool coordinate frame.
Example : The following example initially moves the TCP to the POSITION start_pos.
The VECTOR pos_vector is then set to the value of the orient vector for
start_pos. The MOVE ABOUT statement moves the TCP about pos_vector
by 45°.
MOVE TO start_pos
pos_vector = ORIENT (start_pos)
MOVE ABOUT pos_vector BY 45.
− A PATH variable can specify a data structure constituting the path header. This
can be used to specify the UFRAME and/or UTOOL to be used with recording or
moving along the path. It can also specify an axis group whose current position
defines a table-top coordinate frame with respect to which the robot data is
recorded and moved.
− A PATH can be declared with either, neither, or both of the following clauses
following the word PATH:
· NODEDATA = node_struct_name, specifying the data structure constituting a
path node.
· PATHHEADER = header_struct_name, specifying the structure constituting
the path header.
If both fields are present, they can appear in either order and are separated by a
comma and optionally a new line.
− If NODEDATA is not specified, it defaults to the STD_PTH_NODE structure
described in Appendix A.
− If PATHHEADER is not specified, there is no (user-accessible ) path header.
− An element of the PATHHEADER structure can be referenced with the syntax
path_var_name.header_field_name.
− An element of a NODEDATA structure can be referenced with the syntax
path_var_name[node_no].node_field_name.
− The path header structure can be copied from one path to another with the
path_var1 = path_var2 statement.
− The path node structure can be copied from one node to another with the
path_var[2] = path_var[1] statement.
− A path can be passed as an argument to a routine as long as the PATHHEADER
and NODEDATA types match. A path that is passed as an argument to a built-in
routine can be of any type.
− A path node can be passed as an argument to a routine as long as the routine
parameter is the same type as the NODEDATA structure.
− If the data structure specified for NODEDATA in a path includes more than one
position data type for the same group, only the first for that group will be used in
move statements specifying the path.
− PATHs provide the ability to specify motion groups to be used for local condition
handlers.
− A path can be declared with a NODEDATA structure having no position type
elements. This can be a useful way of maintaining a list structure. Such a path
cannot be used in a MOVE statement.
See Also : APPEND_NODE, DELETE_NODE, INSERT_NODE Built-In Procedures
PATH_LEN, NODE_SIZE Built-In Functions
Example : The following example shows different declarations of PATH variables.
TYPE
node_struct = STRUCTURE
node_posn : XYZWPR IN GROUP[1]
node_data : GROUP_ASSOC IN GROUP[1]
aux_posn : JOINTPOS IN GROUP[2]
common_data : COMMON_ASSOC
weld_time : INTEGER
weld_current : INTEGER
ENDSTRUCTURE
Guide d’utilisation du robot M-6i : Description détaillée des commandes Karel. 6-28
hdr_struct = STRUCTURE
uframe1 : POSITION
utool : POSITION
speed : REAL
ENDSTRUCTURE
VAR
path_1a : PATH PATHHEADER = hdr_struct, NODEDATA = node_struct
path_1b : PATH NODEDATA = node_struct, PATHHEADER = hdr_struct
path_2 : PATH NODEDATA = node_struct -- no header
path_3 : PATH -- equivalent to PATH NODEDATA = std_pth_node
path_4 : PATH PATHHEADER = hdr_struct -- std_pth_node
PAUSE Action
PAUSE Condition
PAUSE Statement
Example : The following example uses the POS Built-In to designate numerically the
POSITION next_pos and then moves the TCP to that position.
CNV_STR_CONF('n', config_var, status)
next_pos = POS(100.,-400.25,0.5,10.,-45.,30.,config_var)
MOVE TO next_pos
RELEASE Statement
Purpose : Releases all motion control of the robot arm and auxiliary or extended axes
from the KAREL program so that they can be controlled by the teach
pendant while a KAREL program is running
Syntax : RELEASE
Details:
− Motion stopped prior to execution of the RELEASE statement can only be
resumed after the execution of the next ATTACH statement.
− If motion is initiated from the program while in a released state, the program is
aborted with the following error, “MCTRL Denied because Released.”
− If RELEASE is executed while motion is in progress or in a HOLD condition, the
program is aborted with the following error, "Detach request failed."
− All motion control from all KAREL tasks will be released.
See Also : Appendix E, “Syntax Diagrams,” for more syntax information
Example : Refer to Section B.1, "Setting Up Digital Output Ports for Monitoring"
(DOUT_EX.KL) for a detailed program example.
Guide d’utilisation du robot M-6i : Description détaillée des commandes Karel. 6-33
RESUME Action
RESUME Statement
Purpose : Signals an event that might satisfy a condition handler or release a waiting
program
Syntax : SIGNAL EVENT[event_no]
where:
event_no : an INTEGER expression
Details:
− You can use the SIGNAL EVENT action to indicate a user-defi ned event has
occurred.
− event_no occurs when signaled and is not remembered. Thus, if a WHEN clause
has the event as its only condition, the associated actions will occur.
− If other conditions are specified that are not met at the time the event is signaled,
the actions are not taken, even if the other conditions are met at another time.
− event_no must be in the range of -32768 to 32767. Otherwise, the program is
aborted with an error.
See Also : EVENT Condition
Example : Refer to Section B.1, "Setting Up Digital Output Ports for Monitoring"
(DOUT_EX.KL) for a detailed program example.
Purpose : Signals an event that might satisfy a condition handler or release a waiting
program
Syntax : SIGNAL EVENT [event_no]
where:
event_no : an INTEGER
Details:
− You can use the SIGNAL EVENT statement to indicate a user-defined event has
occurred.
− event_no occurs when signaled and is not remembered. Thus, if a WHEN clause
has the event as its only condition, the associated actions will occur.
− If other conditions are specified that are not met at the time the event is signaled,
the actions are not taken, even if the other conditions are met at another time.
Guide d’utilisation du robot M-6i : Description détaillée des commandes Karel. 6-35
Purpose : Returns a REAL value that is the sine of the specified angle argument
Syntax : SIN(angle) Function Return Type : REAL
Input/Output Parameters :
[in] angle : REAL %ENVIRONMENT Group:SYSTEM
Details:
− angle specifies an angle in degrees.
− angle must be in the range of ± 18000 degrees. Otherwise, the program will be
aborted with an error.
Example : Refer to Section B.8, "Generating and Moving Along a Hexagon Path"
(GEN_HEX.KL), for a detailed program example.
Purpose : Returns a REAL value that is the positive square root of the specified REAL
argument
Syntax : SQRT(x) Function Return Type:REAL
Input/Output Parameters:
[in] x : REAL %ENVIRONMENT Group:SYSTEM
Details:
− x must not be negative. Otherwise, the program will be aborted with an error.
Example : The following example calculates the square root of the expression
(a*a+b*b) and indicates that this is the hypotenuse of a triangle.
c = SQRT(a*a+b*b)
WRITE ('The hypotenuse of the triangle is ',c::6::2)
STOP Action
− The stacked motion set can be removed from the stack and restarted with either a
RESUME statement or action or by issuing RESUME from the operator interface
(CRT/KB).
− If the group clause is not present, all groups for which the task has control (when
the condition is defined) will be stopped.
− If the motion that is stopped, resumed, canceled, or held is part of a
SIMULTANEOUS or COORDINATED motion with other groups, the motions
for all groups are stopped, resumed, canceled, or held.
− Motion cannot be stopped for a different task.
See Also : Chapter 8, “Motion”
RESUME Action
RESUME Statement
Example : Refer to Section B.1, "Setting Up Digital Output Ports for Monitoring"
(DOUT_EX.KL) for a detailed program example.
STOP Statement
Purpose : Returns a REAL value that is the tangent of the specified REAL argument
Syntax : TAN(angle) Function Return Type:REAL
Input/Output Parameters:
[in] angle : REAL %ENVIRONMENT Group:SYSTEM
Details:
− The value of angle must be in the range of ± 18000 degrees. Otherwise, the
program will be aborted with an error.
Example : The following example uses the TAN Built-In function to specify the tangent
of the variable angle. The tangent should be equal to the SIN(angle ) divided
by COS(angle ).
WRITE ('enter an angle:')
READ (angle,CR)
ratio = SIN(angle)/COS(angle)
IF ratio = TAN(angle) THEN
WRITE ('ratio is correct',CR)
ENDIF
Guide d’utilisation du robot M-6i : Description détaillée des commandes Karel. 6-38
TIME Condition
UNHOLD Action
UNHOLD Statement
UNPAUSE Action
Purpose : Resumes program execution long enough for a routine action to be executed
Syntax : UNPAUSE
Details:
− If a routine is called as an action, but program execution is paused, execution is
resumed only for the duration of the routine and then is paused again.
− If more than one routine is called, all of the routines will be executed before
execution is paused again.
− The resume and pause caused by UNPAUSE do not satisfy any RESUME and
PAUSE conditions.
See Also : RESUME, PAUSE Actions
Example : Refer to Section B.1, "Setting Up Digital Output Ports for Monitoring"
(DOUT_EX.KL) for a detailed program example.
Purpose : Sets the specified REAL variables to the location (x,y,z) and orientation
(w,p,r) components of the specified XYZWPR variable and sets the
specified CONFIG variable to the configuration component of the XYZWPR
Syntax : UNPOS(posn, x, y, z, w, p, r, c)
Input/Output Parameters:
[in] posn : XYZWPR
[out] x, y, z : REAL
[out] w, p, r : REAL
[out] c : CONFIG %ENVIRONMENT Group:SYSTEM
Guide d’utilisation du robot M-6i : Description détaillée des commandes Karel. 6-40
Details:
− x, y, z, w, p, and r arguments are set to the x, y, and z location coordinates and
yaw, pitch, and roll orientation angles of posn.
− c returns the configuration of posn.
See Also : Chapter 8, “Motion”
Example : The following example uses the UNPOS Built-In to add 100 to the x location
argument.
UNPOS (CURPOS, x, y, z, w, p, r, config)
next_pos = POS (x+100., y, z, w, p, r, config)
MOVE TO next_pos
Purpose : Delays continuation of program execution until some condition(s) are met
Syntax : WAIT FOR cond_list
where:
cond_list : one or more conditions
Guide d’utilisation du robot M-6i : Description détaillée des commandes Karel. 6-41
Details:
− All of the conditions in a single WAIT FOR statement must be satisfied
simultaneously for execution to continue.
See Also : Chapter 6, “Condition Handlers”
Appendix E, “Syntax Diagrams,” for more syntax information
Example : Refer to the following sections for detailed program examples:
Section B.6, "Path Variables and Condition Handlers Program"
(PTH_MOVE.KL).
Section B.1, "Setting Up Digital Output Ports for Monitoring"
(DOUT_EX.KL).
WHEN Clause
WITH Clause
move_sys_var : one of the system variables available for use in the WITH
clause
n : specifies the group number
value : an expression of the type corresponding to the type of the
system variable
Details:
− The actual system variables specified are not changed. The temporary value is
used only by the motion environment while executing the move in which the
WITH clause is used.
− The temporary value remains in effect until the next time the system variable is
used by the motion environment. At that time, the assigned system variable value
is used and the temporary value ceases to exist.
− INTEGER values can be used where REAL values are expected.
− Predefined constants are used to specify values for some system variables that can
be used in the WITH clause. For example, $MOTYPE is specified as LINEAR,
CIRCULAR, or JOINT.
− $PRIORITY and $SCAN_TIME are condition handler qualifiers that can be used
in a WITH clause only when the WITH clause is part of a condition handler
statement.
See Also : Chapter 6, “Condition Handlers”
Chapter 12, “System Variables,” for a list of the system variables that can be
used in the WITH clause
XYZWPR = STRUCTURE
X : REAL
Y : REAL
Z : REAL
W : REAL
P : REAL
R : REAL
CONFIG_DATA : CONFIG
ENDSTRUCTURE
Note: All fields are read-write access.
Example : Refer to the following sections for detailed program examples:
Section B.2, "Copying Path Variables" (CPY_PTH.KL).
Section B.5,"Using Register Built-ins" (REG_EX.KL).
Section B.6, "Path Variables and Condition Handlers Program"
(PTH_MOVE.KL).
Section B.8, "Generating and Moving Along a Hexagon Path"
(GEN_HEX.KL).
Section B.1, "Setting Up Digital Output Ports for Monitoring"
(DOUT_EX.KL).
7 RÉFÉRENCES
FANUC Robotics, SYSTEM R-J3 Controller HandlingTool Setup and Operations Manual
(Version 5.20), 1999.
Tétreault, M., Guide d’utilisation du robot S-10 (version 2.0c), Automne 2001.