VRML Preparation for Robot Simulation/fr: Difference between revisions

From FreeCAD Documentation
(Created page with "== Ouvrir un fichier, ou en créer un avec FreeCAD == Le tutoriel est basé sur un '''fichier-STEP''' d'un '''[http://www.staubli.com/fr/robotique/robots-4-et-6-axes/robots-p...")
(Updating to match new version of source page)
(23 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<languages/>
Ce tutoriel explique comment utiliser FreeCAD et le '''Workbench Simulation Robot''' pour simuler les mouvements de robots sur '''6 axes'''.<br />
<div class="mw-translate-fuzzy">
{{TutorialInfo/fr
|Topic=Robot Workbench
|Level=Intermediate
|Time=
|Author=
|FCVersion=
|Files=
}}
</div>

{{VeryImportantMessage|The FreeCAD Robot Workbench is unmaintained. Please mention on the FreeCAD forum if you have an interest in maintaining this
workbench.}}

==Overview==

<div class="mw-translate-fuzzy">
Ce tutoriel explique comment utiliser FreeCAD et le '''Workbench Simulation Robot''' pour simuler les mouvements du robot sur '''6 axes'''.<br />
Le tutoriel se concentre sur la création du fichier '''VRML''' utilisé pour la visualisation. La base du fichier '''VRML''' est un modèle FreeCAD. La version de FreeCAD utilisée est '''0.11.4252ppa1''' sur Ubuntu 32 bits.
Le tutoriel se concentre sur la création du fichier '''VRML''' utilisé pour la visualisation. La base du fichier '''VRML''' est un modèle FreeCAD. La version de FreeCAD utilisée est '''0.11.4252ppa1''' sur Ubuntu 32 bits.
</div>


== Ouvrir un fichier, ou en créer un avec FreeCAD ==
== Ouvrir un fichier, ou en créer un avec FreeCAD ==
Line 9: Line 28:
[[File:staeubli_step_import.png|1024px]]
[[File:staeubli_step_import.png|1024px]]


<div class="mw-translate-fuzzy">
Notice, that on import, the robot is made of 8 shapes, directly on the root of the document tree. The structure of the exported vrml file may change if groups are used. The shapes are ordered from the base to the tool. The last shape contains the axes of rotations of all robot axes. The correlation shape name – part name is given by (as for now (March 2011) FreeCAD doesn't import the names included in STEP files):
On notera que pour l'importation, le robot est composé de 8 formes, directement sur la racine de l'arbre du document.<br />
La structure du fichier '''VRML''' exporté peut changer si des groupes sont utilisés. Les formes sont commandées à partir de la base de l'outil.<br />
La dernière forme contient les axes de rotation de tous les axes du robot.<br />
Le nom de forme de corrélation, le nom de la pièce est donné (pour l'instant (Mars 2011) par FreeCAD, FreeCAD n'importe pas encore les noms inclus dans les fichiers STEP) :
</div>


{| class="wikitable"
{| class="wikitable"
Line 41: Line 65:
|}
|}


<div class="mw-translate-fuzzy">
For this import, change the “Display Mode” of each shape, TX40_HB007 excepted, from “Flat Lines” to “Shaded” for the vrml export to look good. I also changed the colors to [245, 196, 0] and [204, 204, 204] to better correspond to Stäubli's yellow. Hide TX40_HB007 because it contains the axes of all joints and cannot be taken apart.
Pour cette importation, changez le "Mode d'affichage" de chaque forme, à l'exception '''TX40_HB007''', de "'''lisser'''" les lignes en "'''Ombrage'''" pour l'exportation '''VRML''' pour faire bonne figure. J'ai aussi changé les couleurs de '''[245, 196, 0]''' et '''[204, 204, 204]''' afin de mieux correspondre au jaune Stäubli.<br />
Masquer '''TX40_HB007''' car il contient les axes de tous les joints et ne peut pas être démonté.
</div>

== Mesure des caractéristiques géométriques ==


Afin de construire la table [http://fr.wikipedia.org/wiki/Denavit-Hartenberg Denavit-Hartenberg] (voir [[Robot_6-Axis/fr|6-Axis_Robot]] ) et de préparer le fichier [http://fr.wikipedia.org/wiki/Virtual_Reality_Markup_Language VRML], que vous avez besoin pour obtenir des caractéristiques du Robot. Pour l'instant, l'outil de mesure de FreeCAD n'est pas prêt, vous pouvez utiliser les axes inclus dans '''TX40_HB007''' (les coordonnées sont indiquées en bas à gauche lorsque vous pointez un objet avec la souris) ou vous devez utiliser la [[Introduction to Python/fr|console Python]] pour obtenir des informations sur la forme géométrique.<br />
== Measure geometric characteristics ==
Notez que, le '''DH-tableau''' n'est nécessaire que si vous avez besoin d'utiliser la cinématique inverse, c'est à dire obtenir les coordonnées cartésiennes ou de commander le robot en coordonnées cartésiennes.<br />
In order to build the Denavit-Hartenberg table (see [http://www.freecadweb.org/wiki/index.php?title=6-Axis_Robot 6-Axis Robot]) and prepare the vrml file, you need to get characteristics of the robot. For now, the measurement tool of FreeCAD is not ready, you can use the axes included in TX40_HB007 (the co-ordinates are indicated on the bottom left when you point an object with the mouse) or you have to use the Python console to get some information about the geometry. Note that the DH-table is only required if you need to use the inverse kinematics, i.e. get the Cartesian coordinates or drive the robot with Cartesian coordinates.
The DH-table for this robot is the following (mm, deg and deg/s):
La '''DH-table''' pour ce robot est le suivant '''(mm, degrés et deg/s)''' :


{| class="wikitable"
{| class="wikitable"
Line 113: Line 142:
|}
|}


Le fichier '''csv''' est :
The csv file is then:


a , alpha, d , theta, rotDir, maxAngle, minAngle, AxisVelocity
a , alpha, d , theta, rotDir, maxAngle, minAngle, AxisVelocity
0 , -90, 320, 0, 1, 180, -180, 555
0 , -90, 320, 0, 1, 180, -180, 555
225, 0, 35, -90, 1, 125, -125, 475
225, 0, 35, -90, 1, 125, -125, 475
Line 123: Line 152:
0 , 0, 65, 0, 1, 270, -270, 1575
0 , 0, 65, 0, 1, 270, -270, 1575


<div class="mw-translate-fuzzy">
== Export to vrml ==
== Exporter en VRML ==
Export the document to a vrml file. The structure of the vrml file is the following:

<syntaxhighlight>
Exporter le document dans un fichier VRML.<br />
La structure du fichier VRML est la suivante :
</div>
<code>


#VRML V2.0 utf8
#VRML V2.0 utf8
Line 177: Line 210:
}
}
</code>
</syntaxhighlight>


Vous pouvez remarquer que nous avons 8 groupes indépendants, correspondants aux 8 formes.
You can notice that we have 8 independent groups corresponding to the 8 shapes.


<div class="mw-translate-fuzzy">
== Preparation of the vrml file ==
== Préparation du dossier de vrml ==
All shapes in the vrml file are expressed in the base frame, independently from each other. For the Robot Simulation Workbench, we need to create a structure where a movement of a shape induces a movement of all shapes situated afterwards in the structure. The placement of the shapes will be relative to the preceding shape, so we need to include some translations from the absolute reference system to the relative one. The translations are described in the following picture:

Toutes les formes dans le fichier '''vrml''' sont exprimées dans le cadre de base, indépendamment les uns des autres. Pour le '''Workbench Simulation Robot''', nous avons besoin de créer une structure où, un mouvement de formes induit un mouvement de toutes les formes qui se trouveront ensuite dans la structure. Le placement des formes sera relatif à la forme précédente, nous avons donc besoin d'inclure quelques modifications à partir du système de référence absolu vers le système relatif.<br />
Les traductions sont décrites dans le tableau suivant :
</div>


[[Image:staeubli_important_points.png]]
[[Image:staeubli_important_points.png]]
Line 194: Line 231:
: F=(0, 35, 835).
: F=(0, 35, 835).


Prenons l'exemple de l'axe '''4''' entre le coude et avant-bras, située à '''D = (xd, yd, zd)'''.<br />
Let's take the example of axis 4 between ELBOW and FOREARM, situated at D=(xd, yd, zd). The anchor for the FreeCAD axis is
Le point d'ancrage pour l'axe de FreeCAD est :
<syntaxhighlight>
<code>
"DEF FREECAD_AXIS4 Transform { rotation 0 1 0 0 children ["
"DEF FREECAD_AXIS4 Transform { rotation 0 1 0 0 children ["
</code>
</syntaxhighlight>
<div class="mw-translate-fuzzy">
This corresponds to a rotation about the y-axis. In the CAD model, the rotation is about the z-axis. Thus, we need to a rotation about the x-axis of <math>\pi</math> before the FreeCAD axis definition and of <math>-\pi</math> after it. Also, a translation of (-xd, -yd, -zd) is needed just before the Group corresponding to the definition of FOREARM to express it in the relative reference frame centered at D. This means that a translation of (xd, yd, zd) must be inserted before the first rotation.
Cela correspond à une rotation autour de l'axe '''y'''. Dans le modèle CAO, la rotation se fait sur l'axe '''z'''. Ainsi, nous avons besoin d'une rotation autour de l'axe '''x''' de '''<math>\pi</math>''' avant la définition des axes de FreeCAD et de '''-<math>\pi</math>''' après. En outre, une traduction de '''(-xd, yd-,-zd)''' est nécessaire juste avant le groupe correspondant à la définition de l'avant bras, et de l'exprimer dans le cadre de référence centré par rapport à '''D'''.<br />
At the end, the vrml-file from the definition of ELBOW to the definition of FOREARM looks like this:
Cela signifie que la traduction de '''(xd, yd, zd)''' doit être insérée avant la première rotation.<br />
<syntaxhighlight>
A la fin, le '''fichier vrml''' à partir de la définition du '''COUDE''' (ELBOW) vers la définition de l''''avant bras''' (FOREARM) ressemble à ceci :
</div>
<code>
# ELBOW
# ELBOW
Group {
Group {
Line 223: Line 264:
},
},
</code>
</syntaxhighlight>
En fin de document, les crochets de fermeture appropriés doivent être insérés: <code> ]}}}},</code>
At the end of the document, the appropriate closing brackets must be inserted: “ ]}}}},” for each of the 6 axes. Eventually, the document looks like this (I don't know if I can link the file here because of copyrights):
pour chacun des 6 axes. Finalement, le document ressemble à ceci (je ne sais pas si je peux lier le fichier ici à cause des droits d'auteur):
<syntaxhighlight>
<code>
#VRML V2.0 utf8
#VRML V2.0 utf8
Line 355: Line 397:
}
}
}
}
</code>
</syntaxhighlight>
<div class="mw-translate-fuzzy">
Here is a patch to obtain the vrml file suitable for robot simulation:
Voici un '''patch''' pour obtenir un fichier '''vrml''' convenant à la simulation du robot :
<syntaxhighlight>
</div>

<code>
7a8
7a8
> # HORIZONTAL BASE CABLE OUTLET
> # HORIZONTAL BASE CABLE OUTLET
Line 450: Line 493:
> ]}}}},
> ]}}}},
> ]
> ]
</code>


</syntaxhighlight>
[[Category:Tutorials]]


[[Category:Robot{{#translation:}}]]
{{clear}}
{{clear}}
<languages/>

Revision as of 12:52, 28 February 2020

Tutoriel
Thème
Robot Workbench
Niveau
Intermediate
Temps d'exécution estimé
Auteurs
Version de FreeCAD
Fichiers exemples
Voir aussi
None

The FreeCAD Robot Workbench is unmaintained. Please mention on the FreeCAD forum if you have an interest in maintaining this workbench.

Overview

Ce tutoriel explique comment utiliser FreeCAD et le Workbench Simulation Robot pour simuler les mouvements du robot sur 6 axes.
Le tutoriel se concentre sur la création du fichier VRML utilisé pour la visualisation. La base du fichier VRML est un modèle FreeCAD. La version de FreeCAD utilisée est 0.11.4252ppa1 sur Ubuntu 32 bits.

Ouvrir un fichier, ou en créer un avec FreeCAD

Le tutoriel est basé sur un fichier-STEP d'un Stäubli TX40, vous pouvez télécharger le fichier fichier TX40-HB.stp, la méthode, devrait également s'appliquer à un modèle entièrement réalisé dans FreeCAD, cependant, je n'ai pas encore eu le temps de vérifier ce point.
Après l'ouverture du fichier, vous devriez obtenir ceci :

On notera que pour l'importation, le robot est composé de 8 formes, directement sur la racine de l'arbre du document.
La structure du fichier VRML exporté peut changer si des groupes sont utilisés. Les formes sont commandées à partir de la base de l'outil.
La dernière forme contient les axes de rotation de tous les axes du robot.
Le nom de forme de corrélation, le nom de la pièce est donné (pour l'instant (Mars 2011) par FreeCAD, FreeCAD n'importe pas encore les noms inclus dans les fichiers STEP) :

FreeCAD name STEP name
TX40_HB HORIZONTAL BASE CABLE OUTLET
TX40_HB001 SHOULDER
TX40_HB002 ARM
TX40_HB003 ELBOW
TX40_HB004 FOREARM
TX40_HB005 WRIST
TX40_HB006 TOOL FLANGE
TX40_HB007 ?

Pour cette importation, changez le "Mode d'affichage" de chaque forme, à l'exception TX40_HB007, de "lisser" les lignes en "Ombrage" pour l'exportation VRML pour faire bonne figure. J'ai aussi changé les couleurs de [245, 196, 0] et [204, 204, 204] afin de mieux correspondre au jaune Stäubli.
Masquer TX40_HB007 car il contient les axes de tous les joints et ne peut pas être démonté.

Mesure des caractéristiques géométriques

Afin de construire la table Denavit-Hartenberg (voir 6-Axis_Robot ) et de préparer le fichier VRML, que vous avez besoin pour obtenir des caractéristiques du Robot. Pour l'instant, l'outil de mesure de FreeCAD n'est pas prêt, vous pouvez utiliser les axes inclus dans TX40_HB007 (les coordonnées sont indiquées en bas à gauche lorsque vous pointez un objet avec la souris) ou vous devez utiliser la console Python pour obtenir des informations sur la forme géométrique.
Notez que, le DH-tableau n'est nécessaire que si vous avez besoin d'utiliser la cinématique inverse, c'est à dire obtenir les coordonnées cartésiennes ou de commander le robot en coordonnées cartésiennes.
La DH-table pour ce robot est le suivant (mm, degrés et deg/s) :

i d θ r α θmin θmax Axis velocity
1 320 q1 0 -90 -180 180 555
2 35 q2 - 90 225 0 -125 125 475
3 0 q3 + 90 0 90 -138 138 585
4 225 q4 0 -90 -270 270 1035
5 0 q5 0 90 -120 133.5 1135
6 65 q6 0 0 -270 270 1575

Le fichier csv est :

 a  , alpha, d  , theta, rotDir, maxAngle, minAngle, AxisVelocity
0  ,   -90, 320,     0,      1,      180,     -180, 555
225,     0,  35,   -90,      1,      125,     -125, 475
0  ,    90,   0,    90,      1,      138,     -138, 585
0  ,   -90, 225,     0,      1,      270,     -270, 1035
0  ,    90,   0,     0,      1,    133.5,     -120, 1135
0  ,     0,  65,     0,      1,      270,     -270, 1575

Exporter en VRML

Exporter le document dans un fichier VRML.
La structure du fichier VRML est la suivante :

#VRML V2.0 utf8


Group {
  children 
    Group {
      children [ 
        Group {
        …

        },
          
        Group {
        …

        },
          
        Group {
        …

        },
          
        Group {
        …

        },
          
        Group {
        …

        },
          
        Group {
        …

        },
          
        Group {
        …

        },
          
        Group {
        …

        } ]

    }

}

Vous pouvez remarquer que nous avons 8 groupes indépendants, correspondants aux 8 formes.

Préparation du dossier de vrml

Toutes les formes dans le fichier vrml sont exprimées dans le cadre de base, indépendamment les uns des autres. Pour le Workbench Simulation Robot, nous avons besoin de créer une structure où, un mouvement de formes induit un mouvement de toutes les formes qui se trouveront ensuite dans la structure. Le placement des formes sera relatif à la forme précédente, nous avons donc besoin d'inclure quelques modifications à partir du système de référence absolu vers le système relatif.
Les traductions sont décrites dans le tableau suivant :

With

A=(0, 0, 168)
B=(0, 107.8, 320)
C=(0, 104.15, 545)
D=(0, 35, 601)
E=(0, 35, 770)
F=(0, 35, 835).

Prenons l'exemple de l'axe 4 entre le coude et avant-bras, située à D = (xd, yd, zd).
Le point d'ancrage pour l'axe de FreeCAD est :

"DEF FREECAD_AXIS4 Transform { rotation 0 1 0 0 children ["

Cela correspond à une rotation autour de l'axe y. Dans le modèle CAO, la rotation se fait sur l'axe z. Ainsi, nous avons besoin d'une rotation autour de l'axe x de avant la définition des axes de FreeCAD et de - après. En outre, une traduction de (-xd, yd-,-zd) est nécessaire juste avant le groupe correspondant à la définition de l'avant bras, et de l'exprimer dans le cadre de référence centré par rapport à D.
Cela signifie que la traduction de (xd, yd, zd) doit être insérée avant la première rotation.
A la fin, le fichier vrml à partir de la définition du COUDE (ELBOW) vers la définition de l'avant bras (FOREARM) ressemble à ceci :

      # ELBOW
      Group {
        … here comes the unmodified definition of ELBOW
  
      },
        
      Transform {
        translation 0 35 601
        rotation 1 0 0 1.5707963
        children
          DEF FREECAD_AXIS4 Transform { rotation 0 1 0 0 children
            Transform {
              rotation 1 0 0 -1.5707963
              children
                Transform {
                  translation 0 -35 -601
                  children [
      # FOREARM  
      Group {
        ... here comes the unmodified definition of FOREARM
  
      },

En fin de document, les crochets de fermeture appropriés doivent être insérés: ]}}}}, pour chacun des 6 axes. Finalement, le document ressemble à ceci (je ne sais pas si je peux lier le fichier ici à cause des droits d'auteur):

#VRML V2.0 utf8
  
  
Group {
  children
  Group {
    children [ 
      # HORIZONTAL BASE CABLE OUTLET 
      Group {
          ... here comes the unmodified definition of HORIZONTAL BASE CABLE OUTLET
   
      },
        
      Transform {
        translation 0 0 168
        rotation 1 0 0 1.5707963
        children
          DEF FREECAD_AXIS1 Transform { rotation 0 1 0 0 children
            Transform {
              rotation 1 0 0 -1.5707963
              children
                Transform {
                  translation 0 0 -168
                  children [
      # SHOULDER
      Group {
          ... here comes the unmodified definition of SHOULDER 
  
      },
        
      Transform {
        translation 0 107.8 320
        #rotation 0 0 1 0
        children
          DEF FREECAD_AXIS2 Transform { rotation 0 1 0 0 children
            Transform {
              #rotation 0 0 1 0
              children
                Transform {
                  translation 0 -107.8 -320
                  children [
      # ARM  
      Group {
          ... here comes the unmodified definition of ARM 
  
      },
        
      Transform {
        translation 0 104.15 545
        #rotation 0 0 1 0
        children
          DEF FREECAD_AXIS3 Transform { rotation 0 1 0 0 children
            Transform {
              #rotation 0 0 1 0
              children
                Transform {
                  translation 0 -104.15 -545
                  children [
      # ELBOW
      Group {
          ... here comes the unmodified definition of ELBOW
  
      },
        
      Transform {
        translation 0 35 601
        rotation 1 0 0 1.5707963
        children
          DEF FREECAD_AXIS4 Transform { rotation 0 1 0 0 children
            Transform {
              rotation 1 0 0 -1.5707963
              children
                Transform {
                  translation 0 -35 -601
                  children [
      # FOREARM  
      Group {
          ... here comes the unmodified definition of FOREARM
  
      },
        
      Transform {
        translation 0 35 770
        #rotation 0 0 1 0
        children
          DEF FREECAD_AXIS5 Transform { rotation 0 1 0 0 children
            Transform {
              #rotation 0 0 1 0
              children
                Transform {
                  translation 0 -35 -770
                  children [
      # WRIST
      Group {
          ... here comes the unmodified definition of WRIST
  
      },
        
      Transform {
        translation 0 35 835
        rotation 1 0 0 1.5707963
        children
          DEF FREECAD_AXIS6 Transform { rotation 0 1 0 0 children
            Transform {
              rotation 1 0 0 -1.5707963
              children
                Transform {
                  translation 0 -35 -835
                  children [
      # TOOL FLANGE
      Group {
          ... here comes the unmodified definition of TOOL FRAME
  
      },
        
      Group {
          ... here comes the unmodified definition of TX40_HB007
  
      } # "]" was deleted from this line
    ]}}}},
    ]}}}},
    ]}}}},
    ]}}}},
    ]}}}},
    ]}}}},
    ] # this is the "]" deleted from the line above
  }
}

Voici un patch pour obtenir un fichier vrml convenant à la simulation du robot :

7a8
>         # HORIZONTAL BASE CABLE OUTLET 
95968a95970,95981
>         Transform {
>           translation 0 0 168
>           rotation 1 0 0 1.5707963
>           children
>             DEF FREECAD_AXIS1 Transform { rotation 0 1 0 0 children
>               Transform {
>                 rotation 1 0 0 -1.5707963
>                 children
>                   Transform {
>                     translation 0 0 -168
>                     children [
>         # SHOULDER
128428a128442,128453
>         Transform {
>           translation 0 107.8 320
>           #rotation 0 0 1 0
>           children
>             DEF FREECAD_AXIS2 Transform { rotation 0 1 0 0 children
>               Transform {
>                 #rotation 0 0 1 0
>                 children
>                   Transform {
>                     translation 0 -107.8 -320
>                     children [
>         # ARM  
206503a206529,206540
>         Transform {
>           translation 0 104.15 545
>           #rotation 0 0 1 0
>           children
>             DEF FREECAD_AXIS3 Transform { rotation 0 1 0 0 children
>               Transform {
>                 #rotation 0 0 1 0
>                 children
>                   Transform {
>                     translation 0 -104.15 -545
>                     children [
>         # ELBOW
267111a267149,267160
>         Transform {
>           translation 0 35 601
>           rotation 1 0 0 1.5707963
>           children
>             DEF FREECAD_AXIS4 Transform { rotation 0 1 0 0 children
>               Transform {
>                 rotation 1 0 0 -1.5707963
>                 children
>                   Transform {
>                     translation 0 -35 -601
>                     children [
>         # FOREARM  
417854a417904,417915
>         Transform {
>           translation 0 35 770
>           #rotation 0 0 1 0
>           children
>             DEF FREECAD_AXIS5 Transform { rotation 0 1 0 0 children
>               Transform {
>                 #rotation 0 0 1 0
>                 children
>                   Transform {
>                     translation 0 -35 -770
>                     children [
>         # WRIST
422053a422115,422126
>         Transform {
>           translation 0 35 835
>           rotation 1 0 0 1.5707963
>           children
>             DEF FREECAD_AXIS6 Transform { rotation 0 1 0 0 children
>               Transform {
>                 rotation 1 0 0 -1.5707963
>                 children
>                   Transform {
>                     translation 0 -35 -835
>                     children [
>         # TOOL FLANGE
435627c435700,435707
<         } ]
---
>         } 
>       ]}}}},
>       ]}}}},
>       ]}}}},
>       ]}}}},
>       ]}}}},
>       ]}}}},
>       ]