2025-01-14 11:46:23 +01:00
% Preamble
\documentclass { beamer}
\usepackage { cmap}
\usepackage [french] { babel}
\usepackage { amsmath, amssymb}
2025-01-14 22:16:41 +01:00
\usepackage { tikz}
\usepackage { multicol}
\usetikzlibrary { arrows.meta, backgrounds, calc, fit, positioning, scopes, shadows}
2025-01-14 11:46:23 +01:00
\mode <presentation>
\usetheme { Dresden}
\definecolor { vulm} { HTML} { 7d1dd3}
\definecolor { yulm} { HTML} { ffe500}
2025-01-14 22:16:41 +01:00
\AtBeginSection [] { \begin { frame} { Plan} \tableofcontents [sectionstyle=show/shaded] \end { frame} }
2025-01-14 11:46:23 +01:00
\setbeamercolor { structure} { fg = vulm}
\setbeamercolor { section in head/foot} { fg = yulm}
\setbeamercolor { subsection in head/foot} { fg = yulm}
\setbeamercolor { background canvas} { bg = yulm!10}
\setbeamertemplate { navigation symbols} { }
\author { Matthieu \textsc { Boyer} \& Sélène \textsc { Corbineau} }
\title { Simulation d'un Contrôleur de Petite Machine à Bois}
% Document
\begin { document}
\maketitle
\section { Positionnement du Problème} \label { sec:le-probleme}
\begin { frame}
\frametitle { Petite Machine à Bois}
2025-01-14 22:16:41 +01:00
\begin { figure}
\centering
\includegraphics [width=.9\textwidth] { images/cnc}
\caption { Une Petite Machine à Bois}
\label { fig:cnc}
\end { figure}
2025-01-14 11:46:23 +01:00
\end { frame}
\begin { frame}
\frametitle { Format d'Entrée}
2025-01-14 22:16:41 +01:00
On convertit un fichier \texttt { .svg} en fichier \texttt { .gc} qui est une abstraction des commandes à exécuter.
\begin { figure}
\centering
\begin { tikzpicture}
\draw [vulm, fill=yulm!30] (0, 0) rectangle +(2, 2) node[pos=.5] { \texttt { .svg} } ;
\draw [vulm, ->] (2, 1) -- (3, 1);
\draw [vulm, fill=yulm!30] (3, 0) rectangle +(2, 2) node[pos=.5] { \texttt { .gc} } ;
\draw [vulm, ->] (5, 1) -- (6, 1);
\draw [vulm, fill=yulm!30, double] (6, 0) rectangle +(2, 2) node[pos=.5] { \texttt { CNC} } ;
\end { tikzpicture}
\end { figure}
\visible <2->{ Le format GCode est standardisé, et indépendant des capacités de la machine.}
2025-01-14 11:46:23 +01:00
\end { frame}
2025-01-14 22:16:41 +01:00
\tikzset {
comp/.style = {
minimum width = 8cm,
minimum height = 4.5cm,
text width = 8cm,
inner sep = 0pt,
text = green,
align = center,
font = \Huge ,
transform shape,
thick
} ,
monitor/.style = { draw = none, xscale = 18/16, yscale = 11/9} ,
display/.style = { shading = axis, left color = black!60, right color = black} ,
ut/.style = { fill = gray}
}
\tikzset {
computer/.pic = {
% screen (with border)
\node (-m) [comp, pic actions, monitor]
{ \phantom { \parbox { \linewidth } { \tikzpictext } } } ;
% display (without border)
\node [comp, pic actions, display] { \tikzpictext } ;
\begin { scope} [x = (-m.east), y = (-m.north)]
% filling the lower part
\path [pic actions, draw = none]
([yshift=2\pgflinewidth ]-0.1,-1) -- (-0.1,-1.3) -- (-1,-1.3) --
(-1,-2.4) -- (1,-2.4) -- (1,-1.3) -- (0.1,-1.3) --
([yshift=2\pgflinewidth ]0.1,-1);
% filling the border of the lower part
\path [ut]
(-1,-2.4) rectangle (1,-1.3)
(-0.9,-1.4) -- (-0.7,-2.3) -- (0.7,-2.3) -- (0.9,-1.4) -- cycle;
% drawing the frame of the whole computer
\path [pic actions, fill = none]
(-1,1) -- (-1,-1) -- (-0.1,-1) -- (-0.1,-1.3) -- (-1,-1.3) --
(-1,-2.4) coordinate(sw)coordinate[pos=0.5] (-b west) --
(1,-2.4) -- (1,-1.3) coordinate[pos=0.5] (-b east) --
(0.1,-1.3) -- (0.1,-1) -- (1,-1) -- (1,1) -- cycle;
% node around the whole computer
\node (-c) [fit = (sw)(-m.north east), inner sep = 0pt] { } ;
\end { scope}
}
}
2025-01-14 11:46:23 +01:00
\begin { frame}
\frametitle { Communication}
2025-01-14 22:16:41 +01:00
\begin { figure}
\centering
\hfill
\begin { minipage} { .5\textwidth }
\begin { tikzpicture}
\pic (comp0) [
draw, fill = gray!30, pic text = { Contrôleur de Petite Machine à Bois} , scale=.3
] { computer} ;
\coordinate (cnc) at ($ ( comp 0 - c.south ) + ( 0 , - 1 ) $ );
\path (comp0-c.east) edge [loop right, min distance=.7cm, in=330, out=30, looseness=8, -{ Latex[width=3mm]} , vulm] node[right, vulm, rectangle, fill=yulm!30, draw=vulm] { GCode} (comp0-c.east);
\draw [vulm, fill=yulm!30] ($ ( cnc ) + ( - 1 , 0 ) $ ) rectangle +(2, -1) node[pos=0.5] { Socket} ;
\draw [vulm, ->, double] ($ ( comp 0 - c.south ) + ( 0 . 2 , 0 ) $ ) --node[anchor=west, vulm]{ $ \omega _ { c } $ } ($ ( cnc.north ) + ( 0 . 2 , 0 ) $ );
\draw [vulm, <-, double] ($ ( comp 0 - c.south ) + ( - 0 . 2 , 0 ) $ ) --node[anchor=east, vulm]{ $ \theta $ } ($ ( cnc.north ) + ( - 0 . 2 , 0 ) $ );
\draw [vulm, ->, double] ($ ( cnc ) + ( 0 . 2 , - 1 ) $ ) -- node[anchor=west, vulm]{ $ \omega _ { c } $ } ($ ( cnc ) + ( 0 . 2 , - 2 ) $ );;
\draw [vulm, <-, double] ($ ( cnc ) + ( - 0 . 2 , - 1 ) $ ) -- node[anchor=east, vulm]{ $ \theta $ } ($ ( cnc ) + ( - 0 . 2 , - 2 ) $ );;
\draw [vulm, fill=yulm!30] ($ ( cnc ) + ( - 2 , - 2 ) $ ) rectangle +(4, -1) node[pos=0.5] { Petite Machine à Bois} ;
\end { tikzpicture}
\end { minipage}
\hfill
\begin { minipage} { .4\textwidth }
\begin { tikzpicture} [scale=.5]
\node [vulm, font=\small] (top) at (0, 0) { \parbox { .9\linewidth } { \textbf { Contrôleur:} traduit le GCode et envoie les vitesses de commande $ \omega _ { c } $ pour les moteurs.} } ;
\node [vulm, font=\small] (mid) at ($ ( top.south ) + ( 0 , - 2 ) $ ) { \parbox { .9\linewidth } { \textbf { Socket:} sert d'intermédiaire pour la connexion (CNC).} } ;
\node [vulm, font=\small] (bot) at ($ ( mid.south ) + ( 0 , - 2 ) $ ) { \parbox { .9\linewidth } { \textbf { Petite Machine à Bois:} envoie les positions $ \theta $ de ses moteurs pas-à-pas.} } ;
\node [draw=vulm, thick, fit={(top) (mid) (bot)}, inner sep=3pt] (box) { } ;
\end { tikzpicture}
\end { minipage}
\hfill
\end { figure}
2025-01-14 11:46:23 +01:00
\end { frame}
\section { Implémentation} \label { sec:l'implementation}
\begin { frame}
2025-01-14 22:16:41 +01:00
\frametitle { Traducteur}
On agit simplement ligne par ligne, voici quelques commandes:
\begin { center}
\begin { minipage} { .95\textwidth }
\begin { multicols} { 2}
\begin { itemize}
\item [G0:] Aller au point donné;
\item [G1:] Aller au point donné, en coupant au passage;
\item [G2,G3:] Faire un arc de cercle, en sens trigonométrique ou non;
\item [G4:] Dormir;
\item [G5:] Suivre une courbe de Bézier cubique. Permet d'en suivre plusieurs d'affilée de manière dérivable;
\item [G20:] WTF IS A KILOMETER;
\item [G21:] Changer d'unité en mm;
\item [G28:] Retourner à la maison;
\item [G30:] Retourner à la maison, en passant par un point donné.
\end { itemize}
\end { multicols}
\end { minipage}
\end { center}
\end { frame}
2025-01-14 11:46:23 +01:00
2025-01-14 22:16:41 +01:00
\begin { frame}
2025-01-14 23:23:21 +01:00
\frametitle { Module de Contrôle Matériel}
Le module Matériel du contrôleur maintient une représentation mémoire de la position \emph { théorique} de la tête, transmise au contrôleur.
Il demande à la socket (et donc au \emph { vrai} matériel) les positions mesurées des moteurs pas-à-pas.
2025-01-14 22:16:41 +01:00
\begin { figure}
\centering
\begin { tikzpicture}
2025-01-14 23:23:21 +01:00
\draw [vulm, fill=yulm!30] (0, 0) rectangle +(2, 1) node[pos=0.5] (h) { Matériel} ;
2025-01-14 22:16:41 +01:00
\draw [vulm, fill=yulm!30] (6, 0) rectangle +(2, 1) node[pos=0.5] (c) { Contrôleur} ;
\draw [vulm, fill=yulm!30] (0, -2) rectangle +(2, 1) node[pos=0.5] (s) { Socket} ;
\draw [vulm, ->] ($ ( h.east ) + ( . 2 , 0 . 1 ) $ ) -- node[above, vulm] { Position $ \rho $ \& Cible $ \tau $ } ($ ( c.west ) + ( - 0 . 1 , 0 . 1 ) $ );
\draw [vulm, <-] ($ ( h.east ) + ( . 2 , - 0 . 1 ) $ ) -- node[below, vulm] { Déplacement $ \Gamma _ { c } $ } ($ ( c.west ) + ( - 0 . 1 , - 0 . 1 ) $ );
\draw [vulm, ->] ($ ( h.south ) + ( . 1 , - . 3 ) $ ) -- node[right, vulm] { $ \omega _ { c } $ } ($ ( s.north ) + ( . 1 , 0 . 3 ) $ );
\draw [vulm, <-] ($ ( h.south ) + ( - . 1 , - . 3 ) $ ) -- node[left, vulm] { $ \theta $ } ($ ( s.north ) + ( - . 1 , 0 . 3 ) $ );
\end { tikzpicture}
\end { figure}
Il envoie ensuite à la socket pour envoyer les vitesses de commandes traduites dans la spécification des moteurs.
2025-01-14 11:46:23 +01:00
\end { frame}
\begin { frame}
2025-01-14 22:16:41 +01:00
\frametitle { Contrôleur en Vitesse}
Dans une première approximation, on poursuit le point de contrôle à vitesse constante.
On calcule $ \delta = \rho - \tau $ .
Selon le signe de $ \delta _ { x } $ (resp. $ y, z $ ) on définit $ \omega _ { c } $ la vitesse de commande de sorte que:
\begin { equation*}
2025-01-14 23:23:21 +01:00
\nu { \omega _ { c} } = 1 \text { et } \left (\omega _ { c} \right )_ { x} \leq \texttt { FAST\_ XY\_ FEEDRATE} \text { (resp. $ y, z $ )}
2025-01-14 22:16:41 +01:00
\end { equation*}
Un contrôleur plus poussé est obtenu en ajoutant une proportionnalité par rapport à l'écart \emph { théorie - mesure} .
\end { frame}
2025-01-14 11:46:23 +01:00
2025-01-14 22:16:41 +01:00
\begin { frame}
\frametitle { Simulateur}
Pour modéliser la Petite Machine à Bois, on construit un simulateur physique simple.
On discrétise le temps par:
\begin { equation*}
\Delta t = t\left ( \text { dernière requête reçue} \right ) - t\left ( \text { dernière requête traitée} \right )
\end { equation*}
On a ensuite par le PFD:
\begin { equation*}
\dot { J_ { \omega } } = \underset { \text { Inertie} } { -f\omega } + \underset { \text { Couple Commande} } { \left ( \omega _ { c} - \omega _ { t} \right )} , \text { d'où } \omega _ { t + 1} = \omega _ { t} + \Delta t \left ( -f\omega + \left ( \omega _ { c} - \omega _ { t} \right ) \right )
\end { equation*}
On introduit par ailleurs un terme d'erreur lié aux frottements, et on peut encore raffiner le modèle.
2025-01-14 11:46:23 +01:00
\end { frame}
\section { Réalisme}
\begin { frame}
2025-01-14 22:16:41 +01:00
\frametitle { Connexion et Précision}
L'utilisation d'une socket et d'un modèle théorique restreint comme intermédiaire permet de prendre en compte, durant les phases de test, les différents facteurs d'erreurs pouvant intervenir durant l'exécution:
\begin { itemize}
\item Une connexion trop volatile;
\item Des erreurs liées au glissement des moteurs pas-à-pas;
\item Des erreurs liées à la dureté du matériau à couper, et à son anisotropie.
\end { itemize}
2025-01-14 11:46:23 +01:00
\end { frame}
\end { document}