VRML Preparation for Robot Simulation/it: Difference between revisions

From FreeCAD Documentation
(Created page with "In questa importazione, cambiare la modalità di visualizzazione, “Display Mode”, di ogni forma, ad eccezione di TX40_HB007, da "Flat Lines" a "Shaded" per dare un buon as...")
(Updating to match new version of source page)
 
(19 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages/>
<div class="mw-translate-fuzzy">
{{TutorialInfo/it
|Topic=Robot
|Level=Intermedio
|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">
Questo tutorial spiega come utilizzare FreeCAD e l'ambiente '''Simulazione Robot''' per simulare i movimenti dei robot a 6 assi.<br />Il tutorial si concentra sulla creazione del file '''VRML''' utilizzato per la visualizzazione.<br />La base del file VRML è un modello di FreeCAD.<br />La versione di FreeCAD utilizzata è la 0.11.4252ppa1 in Ubuntu 32 bit.
Questo tutorial spiega come utilizzare FreeCAD e l'ambiente '''Simulazione Robot''' per simulare i movimenti dei robot a 6 assi.<br />Il tutorial si concentra sulla creazione del file '''VRML''' utilizzato per la visualizzazione.<br />La base del file VRML è un modello di FreeCAD.<br />La versione di FreeCAD utilizzata è la 0.11.4252ppa1 in Ubuntu 32 bit.
</div>


== Aprire un file o crearne uno con FreeCAD ==
== Aprire un file o crearne uno con FreeCAD ==
Line 7: Line 26:
[[File:staeubli_step_import.png|1024px]]
[[File:staeubli_step_import.png|1024px]]


<div class="mw-translate-fuzzy">
Notare che, nell'importazione, il robot è composto di 8 forme, direttamente sulla radice dell'albero del documento.<br />La struttura del file VRML esportato può cambiare se sono utilizzati i gruppi. Le forme sono ordinate a partire dalla base allo strumento.<br />L'ultima forma contiene gli assi di rotazione di tutti gli assi del robot.<br />
Notare che, nell'importazione, il robot è composto di 8 forme, direttamente sulla radice dell'albero del documento.<br />La struttura del file VRML esportato può cambiare se sono utilizzati i gruppi. Le forme sono ordinate a partire dalla base allo strumento.<br />L'ultima forma contiene gli assi di rotazione di tutti gli assi del robot.<br />
I nomi delle forme sono attribuiti in modo correlativo da FreeCAD, (dato che per ora (marzo 2011) FreeCAD non importa i nomi inclusi nei file STEP):
I nomi delle forme sono attribuiti in modo correlativo da FreeCAD, (dato che per ora (marzo 2011) FreeCAD non importa i nomi inclusi nei file STEP):
</div>


{| class="wikitable"
{| class="wikitable"
Line 40: Line 61:
|}
|}


<div class="mw-translate-fuzzy">
In questa importazione, cambiare la modalità di visualizzazione, “Display Mode”, di ogni forma, ad eccezione di TX40_HB007, da "Flat Lines" a "Shaded" per dare un buon aspetto all'esportazione VRML. Ho anche cambiato i colori in [245, 196, 0] e [204, 204, 204] per farli corrispondere meglio al giallo di Stäubli.<br />Nascondere TX40_HB007 perché contiene gli assi di tutti i giunti e non può essere smontato.
In questa importazione, cambiare la modalità di visualizzazione, “Display Mode”, di ogni forma, ad eccezione di TX40_HB007, da "Flat Lines" a "Shaded" per dare un buon aspetto all'esportazione VRML. Ho anche cambiato i colori in [245, 196, 0] e [204, 204, 204] per farli corrispondere meglio al giallo di Stäubli.<br />Nascondere TX40_HB007 perché contiene gli assi di tutti i giunti e non può essere smontato.
</div>

== Misure delle caratteristiche geometriche ==


Per costruire la tabella di [http://it.wikipedia.org/wiki/Denavit-Hartenberg Denavit-Hartenberg] (vedere [[Robot_6-Axis/it|6-Axis_Robot]] ) e per preparare il file [http://it.wikipedia.org/wiki/VRML VRML], è necessario ottenere le caratteristiche del Robot.<br />Per ora, lo strumento di misurazione di FreeCAD non è ancora pronto, è possibile utilizzare gli assi inclusi in TX40_HB007 (le coordinate sono indicate in basso a sinistra quando si punta un oggetto con il mouse), oppure si deve utilizzare la console Python per ottenere delle informazioni sulla geometria.<br />Notare che la '''Tabella DH''' è necessaria solo quando si ha bisogno di usare la cinematica inversa, ad esempio, per ottenere le coordinate cartesiane o guidare il robot con coordinate cartesiane.<br /><br />
== Measure geometric characteristics ==
La '''Tabella DH''' per questo robot è la seguente '''(mm, gradi e gradi/s)''' :
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):


{| class="wikitable"
{| class="wikitable"
Line 112: Line 136:
|}
|}


The csv file is then:
Il file csv è quindi:


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 122: Line 146:
0 , 0, 65, 0, 1, 270, -270, 1575
0 , 0, 65, 0, 1, 270, -270, 1575


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

<syntaxhighlight>
Esportare il documento in un file VRML.
La struttura del file VRML è la seguente:
</div>
<code>


#VRML V2.0 utf8
#VRML V2.0 utf8
Line 176: Line 204:
}
}
</code>
</syntaxhighlight>


Si può notare che ci sono 8 gruppi indipendenti, corrispondenti alle 8 forme.
You can notice that we have 8 independent groups corresponding to the 8 shapes.


<div class="mw-translate-fuzzy">
== Preparation of the vrml file ==
== Preparazione del file 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:

Tutte le forme nel file VRML sono espresse nella struttura di base, indipendentemente le une dalle altre.<br />Per l'ambiente Simulazione Robot di FreeCAD, è necessario creare una struttura in cui un movimento di una forma induce un movimento di tutte le forme che sono situate successivamente nella struttura. Il posizionamento delle forme sarà relativo alla forma precedente, quindi è necessario includere alcune traduzioni dal sistema di riferimento assoluto a quello relativo.<br />Le traduzioni sono descritte nella figura seguente:
</div>


[[Image:staeubli_important_points.png]]
[[Image:staeubli_important_points.png]]


Con:
With
: A=(0, 0, 168)
: A=(0, 0, 168)
: B=(0, 107.8, 320)
: B=(0, 107.8, 320)
Line 191: Line 222:
: D=(0, 35, 601)
: D=(0, 35, 601)
: E=(0, 35, 770)
: E=(0, 35, 770)
: F=(0, 35, 835).
: F=(0, 35, 835)


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
Prendiamo come esempio l'asse 4 tra ELBOW e FOREARM, situato in D=(xd, yd, zd). Il punto di ancoraggio per l'asse di FreeCAD è:
<code>
<syntaxhighlight>
"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.
Questo corrisponde ad una rotazione intorno all'asse Y. Nel modello CAD, la rotazione è intorno all'asse Z.<br />Pertanto, è necessaria una rotazione intorno all'asse X di <math>\pi</math> prima della definizione dell'asse di FreeCAD e di -<math>\pi</math> dopo di essa.<br />Inoltre, è necessaria una translation di (-xd, yd-,-zd) immediatamente prima del gruppo corrispondente alla definizione di FOREARM e espressa nel frame di riferimento relativo centrato rispetto a D.<br />
At the end, the vrml-file from the definition of ELBOW to the definition of FOREARM looks like this:
Ciò significa che la translation di (xd, yd, zd) deve essere inserita prima della prima rotazione.<br />
<syntaxhighlight>
Alla fine, il file VRML compreso tra la definizione di ELBOW e la definizione di FOREARM è simile al seguente:
</div>
<code>
# ELBOW
# ELBOW
Group {
Group {
Line 222: Line 256:
},
},
</code>
</syntaxhighlight>
Alla fine del documento, si devono inserire le parentesi di chiusura appropriate: <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):
per ciascuno dei sei assi. Al termine, il documento si presenta così (non so se posso inserire un link al file a causa dei diritti d'autore):
<syntaxhighlight>
<code>
#VRML V2.0 utf8
#VRML V2.0 utf8
Line 354: Line 389:
}
}
}
}
</code>
</syntaxhighlight>
<div class="mw-translate-fuzzy">
Here is a patch to obtain the vrml file suitable for robot simulation:
Ecco un patch per ottenere il file VRML adatto per la simulazione del robot:
<syntaxhighlight>
</div>

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


</syntaxhighlight>
[[Category:Tutorials]]


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

Latest revision as of 12:52, 28 February 2020

Tutorial
Argomento
Robot
Livello di difficoltà
Intermedio
Tempo di esecuzione
Autori
Versione di FreeCAD
Files di esempio
Vedere anche
Nessuno

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

Overview

Questo tutorial spiega come utilizzare FreeCAD e l'ambiente Simulazione Robot per simulare i movimenti dei robot a 6 assi.
Il tutorial si concentra sulla creazione del file VRML utilizzato per la visualizzazione.
La base del file VRML è un modello di FreeCAD.
La versione di FreeCAD utilizzata è la 0.11.4252ppa1 in Ubuntu 32 bit.

Aprire un file o crearne uno con FreeCAD

Il tutorial si basa su un file STEP di un robot Stäubli TX40 (TX40-HB.stp).
È possibile scaricare il file file TX40-HB.stp da Stäubli.
Anche se non ho ancora avuto tempo di controllare, il metodo dovrebbe valere anche per un modello realizzato completamente in FreeCAD.
Dopo aver aperto il file, si dovrebbe ottenere questo:

Notare che, nell'importazione, il robot è composto di 8 forme, direttamente sulla radice dell'albero del documento.
La struttura del file VRML esportato può cambiare se sono utilizzati i gruppi. Le forme sono ordinate a partire dalla base allo strumento.
L'ultima forma contiene gli assi di rotazione di tutti gli assi del robot.
I nomi delle forme sono attribuiti in modo correlativo da FreeCAD, (dato che per ora (marzo 2011) FreeCAD non importa i nomi inclusi nei file STEP):

nome FreeCAD nome STEP
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 ?

In questa importazione, cambiare la modalità di visualizzazione, “Display Mode”, di ogni forma, ad eccezione di TX40_HB007, da "Flat Lines" a "Shaded" per dare un buon aspetto all'esportazione VRML. Ho anche cambiato i colori in [245, 196, 0] e [204, 204, 204] per farli corrispondere meglio al giallo di Stäubli.
Nascondere TX40_HB007 perché contiene gli assi di tutti i giunti e non può essere smontato.

Misure delle caratteristiche geometriche

Per costruire la tabella di Denavit-Hartenberg (vedere 6-Axis_Robot ) e per preparare il file VRML, è necessario ottenere le caratteristiche del Robot.
Per ora, lo strumento di misurazione di FreeCAD non è ancora pronto, è possibile utilizzare gli assi inclusi in TX40_HB007 (le coordinate sono indicate in basso a sinistra quando si punta un oggetto con il mouse), oppure si deve utilizzare la console Python per ottenere delle informazioni sulla geometria.
Notare che la Tabella DH è necessaria solo quando si ha bisogno di usare la cinematica inversa, ad esempio, per ottenere le coordinate cartesiane o guidare il robot con coordinate cartesiane.

La Tabella DH per questo robot è la seguente (mm, gradi e gradi/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

Il file csv è quindi:

 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

Esportare in VRML

Esportare il documento in un file VRML. La struttura del file VRML è la seguente:

#VRML V2.0 utf8


Group {
  children 
    Group {
      children [ 
        Group {
        …

        },
          
        Group {
        …

        },
          
        Group {
        …

        },
          
        Group {
        …

        },
          
        Group {
        …

        },
          
        Group {
        …

        },
          
        Group {
        …

        },
          
        Group {
        …

        } ]

    }

}

Si può notare che ci sono 8 gruppi indipendenti, corrispondenti alle 8 forme.

Preparazione del file VRML

Tutte le forme nel file VRML sono espresse nella struttura di base, indipendentemente le une dalle altre.
Per l'ambiente Simulazione Robot di FreeCAD, è necessario creare una struttura in cui un movimento di una forma induce un movimento di tutte le forme che sono situate successivamente nella struttura. Il posizionamento delle forme sarà relativo alla forma precedente, quindi è necessario includere alcune traduzioni dal sistema di riferimento assoluto a quello relativo.
Le traduzioni sono descritte nella figura seguente:

Con:

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)

Prendiamo come esempio l'asse 4 tra ELBOW e FOREARM, situato in D=(xd, yd, zd). Il punto di ancoraggio per l'asse di FreeCAD è:

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

Questo corrisponde ad una rotazione intorno all'asse Y. Nel modello CAD, la rotazione è intorno all'asse Z.
Pertanto, è necessaria una rotazione intorno all'asse X di prima della definizione dell'asse di FreeCAD e di - dopo di essa.
Inoltre, è necessaria una translation di (-xd, yd-,-zd) immediatamente prima del gruppo corrispondente alla definizione di FOREARM e espressa nel frame di riferimento relativo centrato rispetto a D.
Ciò significa che la translation di (xd, yd, zd) deve essere inserita prima della prima rotazione.
Alla fine, il file VRML compreso tra la definizione di ELBOW e la definizione di FOREARM è simile al seguente:

      # 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
  
      },

Alla fine del documento, si devono inserire le parentesi di chiusura appropriate: ]}}}}, per ciascuno dei sei assi. Al termine, il documento si presenta così (non so se posso inserire un link al file a causa dei diritti d'autore):

#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
  }
}

Ecco un patch per ottenere il file VRML adatto per la simulazione del 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
<         } ]
---
>         } 
>       ]}}}},
>       ]}}}},
>       ]}}}},
>       ]}}}},
>       ]}}}},
>       ]}}}},
>       ]