Aller au contenu principal

Initiation à la robotique

Ces notes établissent les modèles géométriques direct et inverse d'une patte de robot à trois articulations, à partir de matrices de rotation et de la loi des cosinus. Le projet, mené à cinq, applique ces modèles au contrôle d'un robot quadrupède puis d'un hexapode, en simulation avec PyBullet.

Définition du problème​

Patte de robot à trois articulations

On cherche à trouver le modèle direct, i.e. l'expression de (x,y,z)(x,y,z) en fonction de (θ0,θ1,θ2)(\theta_0, \theta_1, \theta_2), puis l'expression de (θ0,θ1,θ2)(\theta_0, \theta_1, \theta_2) en fonction de (x,y,z)(x,y,z) (modèle inverse). Nous définissons le repère R\mathcal{R} centré sur la première articulation de la patte (repère 0).

Rappel sur les matrices de rotation​

En 2D, rotation d'angle θ\theta autour de l'origine : rot(O,θ)=(cos⁡θ−sin⁡θsin⁡θcos⁡θ)rot_{(O,\theta)} = \begin{pmatrix} \cos{\theta} & - \sin{\theta} \\ \sin{\theta} & \cos{\theta} \end{pmatrix}

En 3D, rotation d'angle θ\theta autour de l'axe (O,z)(O,z) : rot((O,z),θ)=(cos⁡(θ)−sin⁡(θ)0sin⁡(θ)cos⁡(θ)0001)rot_{((O,z), \theta)} = \begin{pmatrix} \cos(\theta) & -\sin(\theta) & 0 \\ \sin(\theta) & \cos(\theta) & 0 \\ 0 & 0 & 1 \end{pmatrix}

Modèle direct​

Soit AA l'origine du repère 1 : A=(l0cos⁡θ0l0sin⁡θ00)RA = \begin{pmatrix} l_0 \cos{\theta_0} \\ l_0 \sin{\theta_0} \\ 0 \end{pmatrix}_\mathcal{R}.

Soit BB l'origine du repère 2 : B=(l1cos⁡(π−θ1)0l1sin⁡(π−θ1))R1B = \begin{pmatrix} l_1 \cos{(\pi - \theta_1 )} \\ 0 \\ l_1 \sin{(\pi - \theta_1)}\end{pmatrix}_{\mathcal{R}_1}. On a donc, dans le repère 0 :

BR=rot((O,z),θ0)⋅BR1+A=(cos⁡θ0−sin⁡θ00sin⁡θ0cos⁡θ00001)⋅(l1cos⁡(π−θ1)0l1sin⁡(π−θ1))+(l0cos⁡θ0l0sin⁡θ00)\begin{aligned} B_{\mathcal{R}} &= rot_{((O,z),\theta_0)} \cdot B_{\mathcal{R}_1} + A \\ &= \begin{pmatrix} \cos{\theta_0} & -\sin{\theta_0} & 0 \\ \sin{\theta_0} & \cos{\theta_0} & 0 \\ 0 & 0 & 1 \end{pmatrix} \cdot \begin{pmatrix} l_1 \cos{(\pi - \theta_1)} \\ 0 \\ l_1 \sin{(\pi - \theta_1)} \end{pmatrix} + \begin{pmatrix} l_0 \cos{\theta_0} \\ l_0 \sin{\theta_0} \\ 0 \end{pmatrix} \end{aligned}

Soit MM le point au bout de la patte. Nous pouvons caractériser BM⃗=(l2cos⁡(π−θ2)0l2sin⁡(π−θ2))R2\vec{BM} = \begin{pmatrix} l_2 \cos{(\pi - \theta_2)} \\ 0 \\ l_2 \sin{(\pi - \theta_2)} \end{pmatrix}_{\mathcal{R}_2}.

Au final, on a (x,y,z)=rot((O,z),θ0)⋅rot((O,y),π−θ1)⋅BM⃗R2+BR(x,y,z) = rot_{((O,z), \theta_0)} \cdot rot_{((O,y), \pi-\theta_1)} \cdot \vec{BM}_{\mathcal{R}_2} + B_{\mathcal{R}}.

Modèle inverse​

θ0=arctan⁡(yx)\theta_0 = \arctan{\left(\dfrac{y}{x}\right)}

(en pratique, on utilise atan2⁡(y,x)\operatorname{atan2}(y, x) pour obtenir le bon quadrant).

On note d=AM=z2+(x2+y2−l0)2d = AM = \sqrt{z^2 + (\sqrt{x^2+y^2} - l_0)^2} la distance entre la deuxième articulation AA et l'extrémité MM. La loi des cosinus dans le triangle ABMABM (côtés AB=l1AB = l_1, BM=l2BM = l_2, AM=dAM = d) donne :

θ1=arctan⁡(−zx2+y2−l0)−arccos⁡(l12−l22+d22l1d)+π\theta_1 = \arctan\left(\dfrac{-z}{\sqrt{x^2+y^2}-l_0}\right) - \arccos\left(\dfrac{l_1^2 - l_2^2 + d^2}{2 l_1 d}\right) + \pi
θ2=2π−arccos⁡(−AM2+BM2+AB22×BM×AB)θ2=2π−arccos⁡(−z2−(x2+y2−l0)2+l22+l122l1l2)\begin{aligned} \theta_2 &= 2 \pi - \arccos{\left(\dfrac{-AM^2+BM^2+AB^2}{2 \times BM \times AB}\right)} \\ \theta_2 &= 2 \pi - \arccos{\left(\dfrac{-z^2-(\sqrt{x^2+y^2} -l_0)^2+l_2^2+l_1^2}{2 l_1 l_2}\right)} \end{aligned}

Quelques exemples​

Exemples de positions de la patte

Ressources​

Projet1 document