#+title: ДИПЛОМНАЯ РАБОТА #+subtitle: «АЛГОРИТМ УТОЧНЕНИЯ ТРАЕКТОРИИ ДВИЖЕНИЯ ИСПОЛНИТЕЛЬНОГО ОРГАНА СТАНКА С ЧПУ КОМПЕНСАЦИОННЫМИ ДВИЖЕНИЯМИ» #+author: Студент:\\ #+author: М. Михалец, гр. 5130201/20101@@latex:\\[2mm]@@ #+author: Научный руководитель:\\ #+author: к.т.н., доцент ВШТИИ С. Г. Попов@@latex:\\[2mm]@@ #+author: Научный консультант:\\ #+author: П. А. Нестеренко\vspace*{-8mm} #+date: 2026-06-25 #+creator: Emacs 30.2 (Org mode 9.8-pre) #+language: ru #+setupfile: setup.org #+startup: beamer #+latex: \setbeamertemplate{footline}[frame number] #+latex: \sloppy #+latex: \frame[plain]{\titlepage} #+latex_header_extra: \makeatletter #+latex_header_extra: \renewcommand{\insertframenumber}{\two@digits{\value{framenumber}}} #+latex_header_extra: \makeatother #+latex: \setbeamertemplate{footline}{ #+latex: \includesvg[height=.5cm]{polytech-short} #+latex: \hfill #+latex: \usebeamercolor[fg]{page number in head/foot} #+latex: \usebeamerfont{page number in head/foot} #+latex: \raisebox{.45ex}{Мартин Михалец}\kern.5ex #+latex: \hfill #+latex: \raisebox{.45ex}{\insertdate}\kern.5ex #+latex: \hfill #+latex: \raisebox{.45ex}{\insertframenumber\,/\,15}\kern.5ex #+latex: } * Введение ** Проблема прохождения изломов пути :B_block: :PROPERTIES: :BEAMER_env: block :END: - Сглаживание углов -- неточное следование - Снижение скорости -- пережёг/вибрации #+attr_latex: :options [H] :width \textwidth #+begin_figure \centering #+attr_latex: :options {.46\textwidth} #+begin_subfigure \centering #+attr_latex: :center nil :width \textwidth [[./res/cnc-gcode.jpg]] #+end_subfigure #+attr_latex: :options {.26\textwidth} #+begin_subfigure \centering #+attr_latex: :center nil :width \textwidth [[./res/corner-burn.jpg]] #+end_subfigure #+attr_latex: :options {.26\textwidth} #+begin_subfigure \centering #+attr_latex: :center nil :width \textwidth [[./res/corner-wobble.jpg]] #+end_subfigure #+end_figure #+latex: \vspace*{-5mm} ** Предложенное решение :B_block: :PROPERTIES: :BEAMER_env: block :END: Локально добавить компенсационные движения для изменения скорости и направления с выключенным инструментом * Цель и задачи ** Цель :B_block: :PROPERTIES: :BEAMER_env: block :END: Алгоритм уточнения траектории движения исполнительного органа станка с ЧПУ, сохраняющий геометрию и режимы движения на рабочих участках ** Задачи :B_block: :PROPERTIES: :BEAMER_env: block :END: 1. Исследовать метрики и способы обеспечения плавности движения исполнительных органов 2. Формализовать метод компенсационных движений 3. Разработать алгоритм построения компенсационных движений 4. Реализовать программный прототип данного алгоритма 5. Исследовать характеристики предложенного алгоритма в симуляторе * Постановка задачи ** Дано: :B_block: :PROPERTIES: :BEAMER_env: block :END: 1. Исходный путь \(\mathcal P = \{p_i\}_{i=\text{1}}^\text{N}\), \(p_i=(\gamma_i, v_i, u_i)\) 2. Кинематические ограничения: \(v_{max}\), \(a_{max}\), \(j_{max}\) 3. Рабочая зона станка \(\Omega \subset \mathbb R^\text{2}\) ** Требуется: :B_block: :PROPERTIES: :BEAMER_env: block :END: #+latex: \vspace*{-7mm} \[ \text{Найти}\quad \mathcal C: \mathcal P \rightarrow \widetilde{\mathcal P}\quad \text{минимизирующее}\quad \overline j(\widetilde{\mathcal P}_{work}),\ \overline e_{v}(\widetilde{\mathcal P}_{work}) \] \[ \text{где}\quad \widetilde{\mathcal P}_{work} = \left\{\widetilde{p}_{i} \in \widetilde{\mathcal P} \mid \widetilde{u}_{i} = \text{«вкл»}\right\} \] #+latex: \vspace*{-7mm} ** Ограничения: :B_block: :PROPERTIES: :BEAMER_env: block :END: 1. Сохранение рабочего контура: \(\widetilde{\mathcal P}_{work} = \mathcal P_{work}\) 2. Внутри рабочей зоны станка: \(\forall \xi: \widetilde\gamma_{i}(\xi) \in \Omega\quad i = \text{1}, \ldots, \widetilde N\) * Определение критических точек ** Классификация :B_block: :PROPERTIES: :BEAMER_env: block :END: - Подход: \(X_{i}^{\text{in}} = \left(P_{i},\nu_{i}^{+}\right)\), если @@latex:$\left\{\begin{smallmatrix*}[l] u_{i}\ \ \; =\ \text{0} \\ u_{i+\text{1}} =\ \text{1}\end{smallmatrix*} \right.$@@ - Излом: \(X_{i}^{\text{kink}} = \left(P_{i},\nu_{i}^{-}, \nu_{i}^{+}\right)\), если @@latex:$\left\{\begin{smallmatrix*}[l] u_{i}\ \ \; =\ \text{1} \\ u_{i+\text{1}} =\ \text{1}\\ \theta_{i}\ >\ \theta_{\max}\end{smallmatrix*} \right.$@@ - Отход: \(X_{i}^{\text{out}} = \left(P_{i},\nu_{i}^{-}\right)\), если @@latex:$\left\{\begin{smallmatrix*}[l] u_{i}\ \ \; =\ \text{1} \\ u_{i+\text{1}} =\ \text{0}\end{smallmatrix*} \right.$@@ #+begin_figure \centering \begin{tikzpicture}[ line cap=round, line join=round, >=stealth, on/.style={blue, thick}, off/.style={orange, thick}, vec/.style={very thick, ->}, state/.style={black, midway, sloped, above,align=center}, cont/.style={thick, decorate, decoration={snake, amplitude=1.5pt, segment length=10pt}} ] \coordinate (legend) at (7.7,1.2); \coordinate (ps) at ( 0,0); \coordinate (p0) at ( 2,0); \coordinate (p1) at ( 4,1); \coordinate (p2) at ( 8,0); \coordinate (pe) at (10,0); \draw[off] (ps) -- (p0) node[state] {$u_{i}=\text{0}$}; \draw[on] (p0) -- (p1) node[state] {$u_{i+\text{1}}=\text{1}$}; \draw[on] (p1) -- (p2) node[state, pos=.66] {$u_{i+\text{2}}=\text{1}$}; \draw[off] (p2) -- (pe) node[state] {$u_{i+\text{3}}=\text{0}$}; \draw[cont] ($(ps)+(0,-.4)$) -- ($(ps)+(0,.4)$); \draw[cont] ($(pe)+(.05,-.4)$) -- ($(pe)+(.05,.4)$); \fill (p0) circle (2pt) node[align=center,below] {$P_{i}$\\«подход»}; \fill (p1) circle (2pt) node[align=center,above] {«излом»\\$P_{i+\text{1}}$}; \fill (p2) circle (2pt) node[align=center,below] {$P_{i+\text{2}}$\\«отход»}; \draw[vec, red] (p0) -- ($(p0)!1cm!(p1)$) node[black,below] {$\nu_{i}^{+}$}; \coordinate (v1m) at ($(p1)!-1.5cm!(p0)$); \coordinate (v1p) at ($(p1)!+1.5cm!(p2)$); \draw pic [draw,thick,angle radius=1.25cm] {angle = v1p--p1--v1m}; \draw node[anchor=west] at ($(p1)+(.35,+.05)$) {$\theta_{i+\text{1}}$}; \draw[vec, green] (p1) -- (v1m) node[black,right] {$\nu_{i+\text{1}}^{-}$}; \draw[vec, red] (p1) -- (v1p) node[black,below] {$\nu_{i+\text{1}}^{+}$}; \draw[vec, green] (p2) -- ($(p2)!-1cm!(p1)$) node[black,right] {$\nu_{i+\text{2}}^{-}$}; \draw[thick, orange] ($(legend)+(0,0.0)$) -- ++(.5,0) node[black,right] {холостое}; \draw[thick, blue ] ($(legend)+(0,0.5)$) -- ++(.5,0) node[black,right] {рабочее}; \end{tikzpicture} #+end_figure * Алгоритм построения компенсационных движений #+begin_export latex \begin{enumerate} \item \small Вычисление времени разгона/торможения \footnotesize\[ T(\Delta v)= \begin{cases} \text{2}\sqrt{\dfrac{|\Delta v|}{j_{\max}}}, & |\Delta v|\le \dfrac{a_{\max}^\text{2}}{j_{\max}} \quad(\text{не достигается}\ a_{max})\\[1.2em] \dfrac{|\Delta v|}{a_{\max}}+\dfrac{a_{\max}}{j_{\max}}, & |\Delta v|> \dfrac{a_{\max}^\text{2}}{j_{\max}} \quad(\text{достигается}\ a_{max}) \end{cases} \]\small \item Вычисление расстояния для разгона/торможения \footnotesize\[ L(v_\text{0},v_\text{1})=\frac{v_\text{0}+v_\text{1}}{\text{2}}\,T(v_\text{1} - v_\text{0}) \quad\Rightarrow\quad d_i^{in} = L(\text{0}, \|\nu_i^{+}\|),\ d_i^{out} = L(\|\nu_i^{-}\|, \text{0}) \]\small \item Вычисление положения опорной точки \item Отсечение опорной точки по окну рабочей зоны \end{enumerate} \vspace*{-2mm} #+end_export #+begin_figure \centering \begin{tikzpicture}[ line cap=round, line join=round, >=stealth, on/.style={blue, thick}, off/.style={orange, thick}, cont/.style={thick, decorate, decoration={snake, amplitude=1.5pt, segment length=10pt}}, dist/.style={midway,sloped,above,black} ] \coordinate (legend) at (7.7,1.2); \coordinate (ps) at ( 0,0); \coordinate (p0) at ( 2,0); \coordinate (p1) at ( 4,1); \coordinate (p2) at ( 8,0); \coordinate (pe) at (10,0); \coordinate (p0i) at ($(p0)!-1.5cm!(p1)$); \coordinate (p1o) at ($(p1)!-1.5cm!(p0)$); \coordinate (p1i) at ($(p1)!-1.5cm!(p2)$); \coordinate (p2o) at ($(p2)!-1.5cm!(p1)$); \draw[off] (ps) -- (p0i); \draw[off] (p0i) -- (p0) node[dist] {$d_{i}^{in}$}; \draw[on ] (p0) -- (p1); \draw[off] (p1) -- (p1o) node[dist,below right] {$d_{i+\text{1}}^{out}$}; \draw[off] (p1o) -- (p1i); \draw[off] (p1i) -- (p1) node[dist,below left] {$d_{i+\text{1}}^{in}$}; \draw[on ] (p1) -- (p2); \draw[off] (p2) -- (p2o) node[dist] {$d_{i+\text{2}}^{out}$}; \draw[off] (p2o) -- (pe); \fill (p0) circle (2pt) node[below] {$P_{i}$}; \fill (p1) circle (2pt) node[below] {$P_{i+\text{1}}$}; \fill (p2) circle (2pt) node[below] {$P_{i+\text{2}}$}; \fill[polytech] (p0i) circle (2pt) node[black, below] {$P_{i}^{in}$}; \fill[polytech] (p1o) circle (2pt) node[black, right] {$P_{i+\text{1}}^{out}$}; \fill[polytech] (p1i) circle (2pt) node[black, left] {$P_{i+\text{1}}^{in}$}; \fill[polytech] (p2o) circle (2pt) node[black, below] {$P_{i+\text{2}}^{out}$}; \draw[cont] ($(ps)+(-.05,-.3)$) -- ($(ps)+(-.05,.5)$); \draw[cont] ($(pe)+(.05,-.4)$) -- ($(pe)+(.05,.4)$); \draw[thick, orange] ($(legend)+(0,0.0)$) -- ++(.5,0) node[black,right] {холостое}; \draw[thick, blue ] ($(legend)+(0,0.5)$) -- ++(.5,0) node[black,right] {рабочее}; \end{tikzpicture} #+end_figure * Структурно-функциональная схема #+begin_export latex \begin{adjustwidth}{-1cm}{-1cm} \makebox[\paperwidth][c]{\centering\resizebox{.9\paperwidth}{!}{ \begin{tikzpicture}[ >=Stealth, font=\small, block/.style={ draw, thick, align=center, minimum height=1.25cm, text width=3.2cm, inner sep=6pt }, area/.style={ draw, dashed, thick, inner sep=0.75cm }, arrow/.style={->, thick}, label/.style={align=center} ] \node[block] (det) at (0, 0) {Детектор\\критических\\точек}; \coordinate (det-path-in) at ($(det.west)!0.5!(det.north west)$); \coordinate (det-para-in) at ($(det.west)!0.5!(det.south west)$); \coordinate (det-pnts-out) at (det.south); \node[block] (gen) at ($(det-pnts-out)-(0,3)$) {Генератор\\компенсационных\\движений}; \coordinate (gen-pnts-in) at (gen.north); \coordinate (gen-path-in) at ($(gen.west)!0.5!(gen.north west)$); \coordinate (gen-para-in) at ($(gen.west)!0.5!(gen.south west)$); \coordinate (gen-traj-out) at (gen.east); \node[block,anchor=east, text width=2.5cm] (cam) at ($(det-path-in)-(2.9,0)$) {Система\\CAM\footnotemark}; \coordinate (cam-path-out) at (cam.east); \pic (op) at ($(gen-para-in)-(0.3,0.5)-(4,0)$) {stickman}; \coordinate (op-para-out) at (op-rightarm); \node[below=0.1cm of op-ground] {Оператор}; \node[block, anchor=west, text width=2.5cm] (cnc) at ($(gen-traj-out)+(3.3,0)$) {Станок\\с ЧПУ}; \coordinate (cnc-traj-in) at (cnc.west); \begin{scope}[on background layer] \node[area, fit=(det)(gen)] (method) {}; \end{scope} \draw[arrow] (cam-path-out) -- (det-path-in) node[at start, above right, align=center] {Исходный\\путь}; \draw[arrow] ($(cam-path-out)!0.47!(det-path-in)$) |- (gen-path-in); \draw[arrow] (op-para-out) -- (gen-para-in) node[at start, above right, align=center] {Параметры\\модели}; \draw[arrow] ($(op-para-out)!0.71!(gen-para-in)$) |- (det-para-in); \draw[arrow] (det-pnts-out) -- (gen-pnts-in) node[midway, right, align=left] {Критические\\точки}; \draw[arrow] (gen-traj-out) -- (cnc-traj-in) node[at end, above left, align=center] {Реализуемая\\траектория}; \end{tikzpicture} } } \end{adjustwidth} \footnotetext{Computer Aided Manufacturing} #+end_export * Схема эксперимента #+latex: \footnotesize \textcolor{polytech}{skywrite:} Исходный G-код \(\,\to\,\) интерпретация \(\,\to\,\) поиск критических точек \(\,\to\,\) компенсации \(\,\to\,\) уточнённый G-код \textcolor{polytech}{simulate:} G-код \(\,\to\,\) интерпретация \(\,\to\,\) планирование движения \(\,\to\,\) визуализация и расчёт метрик #+begin_export latex \begin{adjustwidth}{-1cm}{-1cm} \makebox[\paperwidth][c]{\centering\includesvg[inkscapelatex=false,width=.7\paperwidth]{./res/experiment}} \end{adjustwidth} #+end_export \textcolor{polytech}{Главные метрики:} - Средний абсолютный рывок на рабочих участках \(\overline j\) - Средняя абсолютная ошибка скорости на рабочих участках \(\overline e_{v}\) #+latex: \normalsize * Исходные данные Исходный G-код содержит: - 10 холостых линейных интерполяции - 95 рабочих линейных интерполяции - 50 рабочих дуговых интерполяции \vspace*{-2mm} #+begin_export latex \begin{gather*} v_{work} = \text{50 мм/с},\quad \Omega = \text{1000} \times \text{700 мм},\quad \theta_{\max} = \pi/\text{16},\quad dt = \text{1 мс}\\ v_{\max} = \text{100 мм/с},\quad a_{\max} = \text{800 мм/с$^\text{2}$},\quad j_{\max} = \text{16000 мм/с$^\text{3}$} \end{gather*} #+end_export \vspace*{-6mm} #+begin_export latex \begin{figure}[H] \centering \begin{subfigure}{.43\textwidth} \centering \includesvg[inkscapelatex=false,width=\textwidth]{./res/logo_03} \vspace*{2mm} \end{subfigure} \begin{subfigure}{.56\textwidth} \centering \includegraphics[width=\textwidth]{./res/original-path-overview.png} \end{subfigure} \end{figure} #+end_export * Рывок \(j\) на части траектории #+begin_export latex \begin{tikzpicture}[ node distance=0 and 0, img/.style={inner sep=0pt, outer sep=0pt}, label/.style={inner sep=0pt, outer sep=0pt, anchor=south, font=\small} ] \node[img] (os) {\includegraphics[width=4.4cm]{./res/jerk-orig.png}}; \node[img,right=-1pt of os] (cs) {\includegraphics[width=4.4cm]{./res/jerk-comp.png}}; \node[img,below=-1pt of os] (oa) {\includegraphics[width=4.4cm]{./res/jerk-orig-alpha.png}}; \node[img,below=-1pt of cs] (ca) {\includegraphics[width=4.4cm]{./res/jerk-comp-alpha.png}}; \node[label] at ($(os.north)+(0,.05)$) {Исходный}; \node[label] at ($(cs.north)+(0,.05)$) {Уточнённый}; \node[label, rotate=90] at ($(os.west)-(.05,0)$) {Полный}; \node[label, rotate=90] at ($(oa.west)-(.05,0)$) {Неблагоприятный}; \draw[line width=0.5pt, bottom color=red, top color=blue] ($(cs.north east)+(.1,0)$) rectangle ($(ca.south east)+(.5,0)$) node[anchor=north west] at ($(cs.north east)+(.5,0)$) {16} node[anchor=west] at ($(cs.south east)+(.5,0)$) {0} node[anchor=south west] at ($(ca.south east)+(.5,0)$) {-16} node[anchor=north,rotate=90] at ($(cs.south east)+(1,0)$) {Рывок, $j$ (м/с$^\text{3}$)}; \end{tikzpicture} #+end_export * Рывок \(j\) за первых 8 секунд #+begin_export latex \begin{adjustwidth}{-1cm}{-1cm} \makebox[\paperwidth][c]{\centering\resizebox{\paperwidth}{!}{\input{res/jerk}}} \end{adjustwidth} #+end_export * Ошибка скорости \(|e_{v}|\) на части траектории #+begin_export latex \begin{tikzpicture}[ node distance=0 and 0, img/.style={inner sep=0pt, outer sep=0pt}, label/.style={inner sep=0pt, outer sep=0pt, anchor=south, font=\small} ] \node[img] (os) {\includegraphics[width=4.4cm]{./res/error-orig.png}}; \node[img,right=-1pt of os] (cs) {\includegraphics[width=4.4cm]{./res/error-comp.png}}; \node[img,below=-1pt of os] (oa) {\includegraphics[width=4.4cm]{./res/error-orig-alpha.png}}; \node[img,below=-1pt of cs] (ca) {\includegraphics[width=4.4cm]{./res/error-comp-alpha.png}}; \node[label] at ($(os.north)+(0,.05)$) {Исходный}; \node[label] at ($(cs.north)+(0,.05)$) {Уточнённый}; \node[label, rotate=90] at ($(os.west)-(.05,0)$) {Общий вид}; \node[label, rotate=90] at ($(oa.west)-(.05,0)$) {Только отклонения}; \draw[line width=0.5pt, bottom color=green, top color=red] ($(cs.north east)+(.1,0)$) rectangle ($(ca.south east)+(.5,0)$) node[anchor=north west] at ($(cs.north east)+(.5,0)$) {50} node[anchor=south west] at ($(ca.south east)+(.5,0)$) {0} node[anchor=north,rotate=90] at ($(cs.south east)+(1,0)$) {Ошибка скорости, $|e_{v}|$ (мм/с)}; \end{tikzpicture} #+end_export * Ошибка скорости \(|e_{v}|\) за первых 8 секунд #+begin_export latex \begin{adjustwidth}{-1cm}{-1cm} \makebox[\paperwidth][c]{\centering\resizebox{\paperwidth}{!}{\input{res/speed_error}}} \end{adjustwidth} #+end_export * Результаты исследования #+latex: \begin{adjustwidth}{-1cm}{-1cm} #+latex: \renewcommand{\arraystretch}{1.25} | Метрика | Исходный | Уточнённый | \(\Delta\) | % | |---------------------------------+----------+------------+------------+--------| | \(S\) (мм) | 979.518 | 1861.97 | +882.452 | +90.09 | | \(T\) (с) | 28.574 | 54.0372 | +25.463 | +89.11 | | \(\overline j\) (мм/с^{3}) | 10070.9 | 690.738 | -9380.162 | *-93.14* | | \(\max\vert j\vert\) (мм/с^{3}) | 36328.1 | 19402.9 | -16925.200 | -46.59 | | \(\overline e_{v}\) (мм/с) | 18.1938 | 0.34182 | -17.852 | *-98.12* | | \(\max\vert e_{v}\vert\) (мм/с) | 50 | 17.0152 | -32.985 | -65.97 | #+tblfm: $4=$3-$2;%+.3f #+tblfm: $5=($4/$2)*100;%+.2f #+latex: \end{adjustwidth} * Заключение 1. Выявлена проблема снижения качества обработки при торможении и разгоне инструмента 2. Предложен метод уточнения траектории локальной вставкой компенсационный движений в окрестностях критических точек: подхода, излома, отхода 3. Разработан алгоритм построения компенсационных движений на основе опорных точек 4. Реализован программный прототип, выполняющий постпроцессорную обработку G-кода для вставки компенсационных движений 5. Продемонстрировано улучшение точности следования на рабочем контуре, снизив рывок на ~93%, а ошибку скорости на ~98% * Спасибо за внимание! :B_fullframe: :PROPERTIES: :BEAMER_ENV: fullframe :BEAMER_OPT: noframenumbering, plain :END: \centering\Huge Спасибо за внимание!\vfill #+attr_latex: :width .65\textwidth :center nil [[./res/end.png]] \small Продолжение следует... * Схемы программного обеспечения #+begin_export latex \begin{adjustwidth}{-1cm}{-1cm} \makebox[\paperwidth][c]{\centering\includesvg[inkscapelatex=false,width=.99\paperwidth]{./res/scheme-skywrite}} \makebox[\paperwidth][c]{\centering\includesvg[inkscapelatex=false,width=.99\paperwidth]{./res/scheme-simulate}} \end{adjustwidth} #+end_export * Планирование движения с ограниченным рывком #+begin_figure \centering \begin{tikzpicture}[ x=1.15cm,y=1cm, >={Latex[length=2mm]}, axis/.style={black!55, line width=0.6pt}, sep/.style={black!35, dashed, line width=0.5pt}, poscurve/.style={blue, line width=1.1pt}, velcurve/.style={purple!50!black, line width=1.1pt}, acccurve/.style={green!50!black, line width=1.0pt}, jerkcurve/.style={red, line width=0.9pt}, lab/.style={font=\small}, samples=80 ] % ========================================================= % Phase durations % ========================================================= \pgfmathsetmacro{\TOne}{1} \pgfmathsetmacro{\TTwo}{1} \pgfmathsetmacro{\TThree}{1} \pgfmathsetmacro{\TFour}{2} \pgfmathsetmacro{\TFive}{1} \pgfmathsetmacro{\TSix}{1} \pgfmathsetmacro{\TSeven}{1} % Time marks \pgfmathsetmacro{\tZero}{0} \pgfmathsetmacro{\tOne}{\TOne} \pgfmathsetmacro{\tTwo}{\TOne+\TTwo} \pgfmathsetmacro{\tThree}{\TOne+\TTwo+\TThree} \pgfmathsetmacro{\tFour}{\TOne+\TTwo+\TThree+\TFour} \pgfmathsetmacro{\tFive}{\TOne+\TTwo+\TThree+\TFour+\TFive} \pgfmathsetmacro{\tSix}{\TOne+\TTwo+\TThree+\TFour+\TFive+\TSix} \pgfmathsetmacro{\tSeven}{\TOne+\TTwo+\TThree+\TFour+\TFive+\TSix+\TSeven} % ========================================================= % Kinematic parameters (normalized) % ========================================================= \pgfmathsetmacro{\Jmax}{1} \pgfmathsetmacro{\Amax}{\Jmax*\TOne} \pgfmathsetmacro{\Dmax}{\Jmax*\TFive} % Initial velocity and position \pgfmathsetmacro{\Vstart}{0} \pgfmathsetmacro{\Pstart}{0} % Velocity at phase boundaries \pgfmathsetmacro{\Vone}{\Vstart + 0.5*\Jmax*\TOne*\TOne} \pgfmathsetmacro{\Vtwo}{\Vone + \Amax*\TTwo} \pgfmathsetmacro{\Vthree}{\Vtwo + \Amax*\TThree - 0.5*\Jmax*\TThree*\TThree} \pgfmathsetmacro{\Vfour}{\Vthree} \pgfmathsetmacro{\Vfive}{\Vfour - 0.5*\Jmax*\TFive*\TFive} \pgfmathsetmacro{\Vsix}{\Vfive - \Dmax*\TSix} \pgfmathsetmacro{\Vseven}{\Vsix - \Dmax*\TSeven + 0.5*\Jmax*\TSeven*\TSeven} % Position at phase boundaries \pgfmathsetmacro{\POne}{\Pstart + \Vstart*\TOne + \Jmax*pow(\TOne,3)/6} \pgfmathsetmacro{\PTwo}{\POne + \Vone*\TTwo + 0.5*\Amax*pow(\TTwo,2)} \pgfmathsetmacro{\PThree}{\PTwo + \Vtwo*\TThree + 0.5*\Amax*pow(\TThree,2) - \Jmax*pow(\TThree,3)/6} \pgfmathsetmacro{\PFour}{\PThree + \Vfour*\TFour} \pgfmathsetmacro{\PFive}{\PFour + \Vfour*\TFive - \Jmax*pow(\TFive,3)/6} \pgfmathsetmacro{\PSix}{\PFive + \Vfive*\TSix - 0.5*\Dmax*pow(\TSix,2)} \pgfmathsetmacro{\PSeven}{\PSix + \Vsix*\TSeven - 0.5*\Dmax*pow(\TSeven,2) + \Jmax*pow(\TSeven,3)/6} % ========================================================= % Vertical scales and offset for compact overlaid picture % ========================================================= \pgfmathsetmacro{\yAxis}{0} \pgfmathsetmacro{\kPos}{0.45} \pgfmathsetmacro{\kVel}{1.20} \pgfmathsetmacro{\kAcc}{1.25} \pgfmathsetmacro{\kJerk}{1.55} \pgfmathsetmacro{\yPosOffset}{-2.25} % bounds \pgfmathsetmacro{\xMin}{-0.45} \pgfmathsetmacro{\xMax}{8.45} \pgfmathsetmacro{\yMin}{-3.15} \pgfmathsetmacro{\yMax}{2.75} % ========================================================= % Axis and separators % ========================================================= \draw[axis,->] (\xMin,0) -- (\xMax,0); \foreach \tt in {\tZero,\tOne,\tTwo,\tThree,\tFour,\tFive,\tSix,\tSeven}{ \draw[sep] (\tt,\yMin+0.35) -- (\tt,\yMax); } % ========================================================= % JERK (piecewise constant) % ========================================================= \draw[jerkcurve] (\tZero,0) -- (\tZero,\kJerk*\Jmax) -- (\tOne,\kJerk*\Jmax) -- (\tOne,0) (\tTwo,0) -- (\tTwo,-\kJerk*\Jmax) -- (\tThree,-\kJerk*\Jmax) -- (\tThree,0) (\tFour,0) -- (\tFour,-\kJerk*\Jmax) -- (\tFive,-\kJerk*\Jmax) -- (\tFive,0) (\tSix,0) -- (\tSix,\kJerk*\Jmax) -- (\tSeven,\kJerk*\Jmax) -- (\tSeven,0); % ========================================================= % ACCELERATION (exact integral of jerk) % ========================================================= % 0..t1 \draw[acccurve,domain=0:\TOne,variable=\t] plot ({\t},{\kAcc*(\Jmax*\t)}); % t1..t2 \draw[acccurve] (\tOne,\kAcc*\Amax) -- (\tTwo,\kAcc*\Amax); % t2..t3 \draw[acccurve,domain=\tTwo:\tThree,variable=\t] plot ({\t},{\kAcc*(\Amax - \Jmax*(\t-\tTwo))}); % t3..t4 \draw[acccurve] (\tThree,0) -- (\tFour,0); % t4..t5 \draw[acccurve,domain=\tFour:\tFive,variable=\t] plot ({\t},{\kAcc*(-\Jmax*(\t-\tFour))}); % t5..t6 \draw[acccurve] (\tFive,-\kAcc*\Dmax) -- (\tSix,-\kAcc*\Dmax); % t6..t7 \draw[acccurve,domain=\tSix:\tSeven,variable=\t] plot ({\t},{\kAcc*(-\Dmax + \Jmax*(\t-\tSix))}); % ========================================================= % VELOCITY (exact integral of acceleration) % ========================================================= % 0..t1 \draw[velcurve,domain=0:\TOne,variable=\t] plot ({\t},{\kVel*(\Vstart + 0.5*\Jmax*pow(\t,2))}); % t1..t2 \draw[velcurve,domain=\tOne:\tTwo,variable=\t] plot ({\t},{\kVel*(\Vone + \Amax*(\t-\tOne))}); % t2..t3 \draw[velcurve,domain=\tTwo:\tThree,variable=\t] plot ({\t},{\kVel*(\Vtwo + \Amax*(\t-\tTwo) - 0.5*\Jmax*pow(\t-\tTwo,2))}); % t3..t4 \draw[velcurve,domain=\tThree:\tFour,variable=\t] plot ({\t},{\kVel*(\Vthree)}); % t4..t5 \draw[velcurve,domain=\tFour:\tFive,variable=\t] plot ({\t},{\kVel*(\Vfour - 0.5*\Jmax*pow(\t-\tFour,2))}); % t5..t6 \draw[velcurve,domain=\tFive:\tSix,variable=\t] plot ({\t},{\kVel*(\Vfive - \Dmax*(\t-\tFive))}); % t6..t7 \draw[velcurve,domain=\tSix:\tSeven,variable=\t] plot ({\t},{\kVel*(\Vsix - \Dmax*(\t-\tSix) + 0.5*\Jmax*pow(\t-\tSix,2))}); % ========================================================= % POSITION (exact integral of velocity) % ========================================================= % 0..t1 \draw[poscurve,domain=0:\TOne,variable=\t] plot ({\t},{\yPosOffset + \kPos*(\Pstart + \Vstart*\t + \Jmax*pow(\t,3)/6)}); % t1..t2 \draw[poscurve,domain=\tOne:\tTwo,variable=\t] plot ({\t},{\yPosOffset + \kPos*(\POne + \Vone*(\t-\tOne) + 0.5*\Amax*pow(\t-\tOne,2))}); % t2..t3 \draw[poscurve,domain=\tTwo:\tThree,variable=\t] plot ({\t},{\yPosOffset + \kPos*(\PTwo + \Vtwo*(\t-\tTwo) + 0.5*\Amax*pow(\t-\tTwo,2) - \Jmax*pow(\t-\tTwo,3)/6)}); % t3..t4 \draw[poscurve,domain=\tThree:\tFour,variable=\t] plot ({\t},{\yPosOffset + \kPos*(\PThree + \Vthree*(\t-\tThree))}); % t4..t5 \draw[poscurve,domain=\tFour:\tFive,variable=\t] plot ({\t},{\yPosOffset + \kPos*(\PFour + \Vfour*(\t-\tFour) - \Jmax*pow(\t-\tFour,3)/6)}); % t5..t6 \draw[poscurve,domain=\tFive:\tSix,variable=\t] plot ({\t},{\yPosOffset + \kPos*(\PFive + \Vfive*(\t-\tFive) - 0.5*\Dmax*pow(\t-\tFive,2))}); % t6..t7 \draw[poscurve,domain=\tSix:\tSeven,variable=\t] plot ({\t},{\yPosOffset + \kPos*(\PSix + \Vsix*(\t-\tSix) - 0.5*\Dmax*pow(\t-\tSix,2) + \Jmax*pow(\t-\tSix,3)/6)}); % ========================================================= % Labels on curves % ========================================================= \node[red,lab] at (0.55,1.30) {$j_{\max}$}; \node[red,lab] at (2.55,-1.85) {$j_{\min}$}; \node[green!50!black,lab] at (1.55,1.05) {$a_{\max}$}; \node[green!50!black,lab] at (6.50,-1.55) {$a_{\min}$}; \node[purple!85!black,lab] at (3.85,2.15) {$v_{\max}$}; \node[blue,lab,anchor=west] at (0.05,-2.55) {$p_{0}$}; \node[blue,lab,anchor=west] at (7.45,2.00) {$p_{1}$}; % ========================================================= % Bottom intervals T1...T7 % ========================================================= \foreach \L/\R/\Name in { \tZero/\tOne/$T_1$, \tOne/\tTwo/$T_2$, \tTwo/\tThree/$T_3$, \tThree/\tFour/$T_4$, \tFour/\tFive/$T_5$, \tFive/\tSix/$T_6$, \tSix/\tSeven/$T_7$ }{ \draw[black,<->] (\L,\yMin+0.10) -- (\R,\yMin+0.10); \node[below,lab] at ({0.5*(\L+\R)},\yMin+0.10) {\Name}; } % ========================================================= % Small legend box % ========================================================= \draw[poscurve] (4,-2.28) -- (4.35,-2.28); \node[lab,anchor=west] at (4.43,-2.28) {Положение}; \draw[velcurve] (6.35,-2.28) -- (6.70,-2.28); \node[lab,anchor=west] at (6.78,-2.28) {Скорость}; \draw[acccurve] (4,-2.62) -- (4.35,-2.62); \node[lab,anchor=west] at (4.43,-2.62) {Ускорение}; \draw[jerkcurve] (6.35,-2.62) -- (6.70,-2.62); \node[lab,anchor=west] at (6.78,-2.62) {Рывок}; \end{tikzpicture} #+end_figure * Квинтическая кривая Безье между двумя смежными линейными сегментами #+begin_figure \centering \begin{tikzpicture}[ scale=1.15, >={Stealth[length=2.2mm]}, seg/.style={blue!85!black, line width=0.9pt}, bez/.style={green!60!black, line width=1.1pt}, guide/.style={gray!55, line width=0.5pt}, dim/.style={black, line width=0.6pt, <->}, aux/.style={gray!55, line width=0.5pt}, lab/.style={font=\small}, ctlmark/.style={red!75!black, line width=0.7pt}, endpt/.style={circle, draw=blue!70!black, fill=white, inner sep=1.1pt}, vtx/.style={circle, draw=blue!70!black, fill=white, inner sep=1.0pt} ] % ========================================================= % Parameters % ========================================================= \pgfmathsetmacro{\Theta}{80} % interior angle \pgfmathsetmacro{\HalfTheta}{\Theta/2} \pgfmathsetmacro{\cstep}{0.72} % c \pgfmathsetmacro{\dstep}{0.92} % d, larger than c \pgfmathsetmacro{\LT}{\dstep + 2*\cstep} % L_T = d + 2c \pgfmathsetmacro{\Lseg}{3.9} % visible length of original segments % Unit directions of left/right branches \pgfmathsetmacro{\uxL}{-sin(\HalfTheta)} \pgfmathsetmacro{\uyL}{-cos(\HalfTheta)} \pgfmathsetmacro{\uxR}{ sin(\HalfTheta)} \pgfmathsetmacro{\uyR}{-cos(\HalfTheta)} % Outward normal to the left branch \pgfmathsetmacro{\nxL}{-cos(\HalfTheta)} \pgfmathsetmacro{\nyL}{ sin(\HalfTheta)} % Offsets for dimension lines \pgfmathsetmacro{\rhoDim}{0.24} % same offset for d,c,c \pgfmathsetmacro{\rhoLT}{0.82} % farther offset for L_T \pgfmathsetmacro{\tick}{0.10} % half-length of tick marks % ========================================================= % Vertex % ========================================================= \coordinate (V) at (0,0); % ========================================================= % Endpoints of original adjacent line segments % ========================================================= \pgfmathsetmacro{\xStart}{\Lseg*\uxL} \pgfmathsetmacro{\yStart}{\Lseg*\uyL} \pgfmathsetmacro{\xEnd}{\Lseg*\uxR} \pgfmathsetmacro{\yEnd}{\Lseg*\uyR} \coordinate (Pstart) at (\xStart,\yStart); \coordinate (Pend) at (\xEnd,\yEnd); % ========================================================= % Control points: % |VP2| = d, |P2P1| = c, |P1P0| = c % symmetric on the right side % ========================================================= \pgfmathsetmacro{\sTwo}{\dstep} \pgfmathsetmacro{\sOne}{\dstep + \cstep} \pgfmathsetmacro{\sZero}{\dstep + 2*\cstep} \pgfmathsetmacro{\xPtwo}{\sTwo*\uxL} \pgfmathsetmacro{\yPtwo}{\sTwo*\uyL} \pgfmathsetmacro{\xPone}{\sOne*\uxL} \pgfmathsetmacro{\yPone}{\sOne*\uyL} \pgfmathsetmacro{\xPzero}{\sZero*\uxL} \pgfmathsetmacro{\yPzero}{\sZero*\uyL} \pgfmathsetmacro{\xPthree}{\sTwo*\uxR} \pgfmathsetmacro{\yPthree}{\sTwo*\uyR} \pgfmathsetmacro{\xPfour}{\sOne*\uxR} \pgfmathsetmacro{\yPfour}{\sOne*\uyR} \pgfmathsetmacro{\xPfive}{\sZero*\uxR} \pgfmathsetmacro{\yPfive}{\sZero*\uyR} \coordinate (P0) at (\xPzero,\yPzero); \coordinate (P1) at (\xPone,\yPone); \coordinate (P2) at (\xPtwo,\yPtwo); \coordinate (P3) at (\xPthree,\yPthree); \coordinate (P4) at (\xPfour,\yPfour); \coordinate (P5) at (\xPfive,\yPfive); % ========================================================= % Original adjacent line segments % ========================================================= \draw[seg] (Pstart) -- (V) -- (Pend); \node[endpt] at (Pstart) {}; \node[endpt] at (Pend) {}; \node[vtx] at (V) {}; \node[lab,below=2pt] at (Pstart) {$P_{\mathrm{start}}$}; \node[lab,below=2pt] at (Pend) {$P_{\mathrm{end}}$}; \node[lab,above right=2pt] at (V) {$P_{\mathrm{trans}}$}; % ========================================================= % Quintic Bézier curve (exact Bernstein polynomial) % ========================================================= \draw[bez,domain=0:1,samples=160,variable=\t] plot ( { pow(1-\t,5)*\xPzero +5*pow(1-\t,4)*\t*\xPone +10*pow(1-\t,3)*pow(\t,2)*\xPtwo +10*pow(1-\t,2)*pow(\t,3)*\xPthree +5*(1-\t)*pow(\t,4)*\xPfour +pow(\t,5)*\xPfive }, { pow(1-\t,5)*\yPzero +5*pow(1-\t,4)*\t*\yPone +10*pow(1-\t,3)*pow(\t,2)*\yPtwo +10*pow(1-\t,2)*pow(\t,3)*\yPthree +5*(1-\t)*pow(\t,4)*\yPfour +pow(\t,5)*\yPfive } ); % ========================================================= % Labels of control points % ========================================================= \node[lab,right] at (P0) {$P_0$}; \node[lab,right] at (P1) {$P_1$}; \node[lab,right] at (P2) {$P_2$}; \node[lab,right] at (P3) {$P_3$}; \node[lab,right] at (P4) {$P_4$}; \node[lab,right] at (P5) {$P_5$}; % ========================================================= % Angle theta % ========================================================= \pgfmathsetmacro{\rTheta}{0.38} \draw (V) ++({270-\HalfTheta}:\rTheta) arc[start angle={270-\HalfTheta}, end angle={270+\HalfTheta}, radius=\rTheta]; \node at ($(V)+(280:0.62)$) {$\theta$}; % ========================================================= % Dimension L_T on the left branch (farther away) % with extension lines reaching the original line % ========================================================= \coordinate (LTa) at ({\xPzero + \rhoLT*\nxL},{\yPzero + \rhoLT*\nyL}); \coordinate (LTb) at ({0 + \rhoLT*\nxL},{0 + \rhoLT*\nyL}); \draw[guide] (P0) -- (LTa); \draw[guide] (V) -- (LTb); \draw[dim] (LTa) -- node[midway,sloped,above] {$L_T$} (LTb); % small ticks on L_T dimension line \draw[guide] ($(LTa)+(-\tick*\nxL,-\tick*\nyL)$) -- ($(LTa)+(\tick*\nxL,\tick*\nyL)$); \draw[guide] ($(LTb)+(-\tick*\nxL,-\tick*\nyL)$) -- ($(LTb)+(\tick*\nxL,\tick*\nyL)$); % ========================================================= % Three distances d, c, c at the same offset from the line % with extension lines reaching the original line % ========================================================= \coordinate (dA1) at ({0 + \rhoDim*\nxL},{0 + \rhoDim*\nyL}); \coordinate (dA2) at ({\xPtwo + \rhoDim*\nxL},{\yPtwo + \rhoDim*\nyL}); \coordinate (dB1) at ({\xPtwo + \rhoDim*\nxL},{\yPtwo + \rhoDim*\nyL}); \coordinate (dB2) at ({\xPone + \rhoDim*\nxL},{\yPone + \rhoDim*\nyL}); \coordinate (dC1) at ({\xPone + \rhoDim*\nxL},{\yPone + \rhoDim*\nyL}); \coordinate (dC2) at ({\xPzero + \rhoDim*\nxL},{\yPzero + \rhoDim*\nyL}); % extension lines \draw[guide] (V) -- (dA1); \draw[guide] (P2) -- (dA2); \draw[guide] (P2) -- (dB1); \draw[guide] (P1) -- (dB2); \draw[guide] (P1) -- (dC1); \draw[guide] (P0) -- (dC2); % dimension lines \draw[dim] (dA1) -- node[midway,sloped,above] {$d$} (dA2); \draw[dim] (dB1) -- node[midway,sloped,above] {$c$} (dB2); \draw[dim] (dC1) -- node[midway,sloped,above] {$c$} (dC2); % small ticks on dimension-line endpoints \coordinate (Tick0) at (dA1); \coordinate (Tick2a) at (dA2); \coordinate (Tick2b) at (dB1); \coordinate (Tick1a) at (dB2); \coordinate (Tick1b) at (dC1); \coordinate (Tick0b) at (dC2); \draw[guide] ($(Tick0)+(-\tick*\nxL,-\tick*\nyL)$) -- ($(Tick0)+(\tick*\nxL,\tick*\nyL)$); \draw[guide] ($(Tick2a)+(-\tick*\nxL,-\tick*\nyL)$) -- ($(Tick2a)+(\tick*\nxL,\tick*\nyL)$); \draw[guide] ($(Tick2b)+(-\tick*\nxL,-\tick*\nyL)$) -- ($(Tick2b)+(\tick*\nxL,\tick*\nyL)$); \draw[guide] ($(Tick1a)+(-\tick*\nxL,-\tick*\nyL)$) -- ($(Tick1a)+(\tick*\nxL,\tick*\nyL)$); \draw[guide] ($(Tick1b)+(-\tick*\nxL,-\tick*\nyL)$) -- ($(Tick1b)+(\tick*\nxL,\tick*\nyL)$); \draw[guide] ($(Tick0b)+(-\tick*\nxL,-\tick*\nyL)$) -- ($(Tick0b)+(\tick*\nxL,\tick*\nyL)$); % ========================================================= % Control-point markers % ========================================================= \foreach \P in {P0,P1,P2,P3,P4,P5}{ \draw[ctlmark] ($(\P)+(-0.05,-0.05)$) -- ($(\P)+(0.05,0.05)$); \draw[ctlmark] ($(\P)+(-0.05,0.05)$) -- ($(\P)+(0.05,-0.05)$); } % ========================================================= % delta = vertical distance from P_trans to the apex of the rounded curve % for the symmetric quintic Bézier, apex is at t = 0.5 % ========================================================= \pgfmathsetmacro{\tApex}{0.5} \pgfmathsetmacro{\xApex}{ pow(1-\tApex,5)*\xPzero +5*pow(1-\tApex,4)*\tApex*\xPone +10*pow(1-\tApex,3)*pow(\tApex,2)*\xPtwo +10*pow(1-\tApex,2)*pow(\tApex,3)*\xPthree +5*(1-\tApex)*pow(\tApex,4)*\xPfour +pow(\tApex,5)*\xPfive } \pgfmathsetmacro{\yApex}{ pow(1-\tApex,5)*\yPzero +5*pow(1-\tApex,4)*\tApex*\yPone +10*pow(1-\tApex,3)*pow(\tApex,2)*\yPtwo +10*pow(1-\tApex,2)*pow(\tApex,3)*\yPthree +5*(1-\tApex)*pow(\tApex,4)*\yPfour +pow(\tApex,5)*\yPfive } \coordinate (Apex) at (\xApex,\yApex); \pgfmathsetmacro{\xDelta}{1.55} \draw[guide] (V) -- (\xDelta,0); \draw[guide] (Apex) -- (\xDelta,\yApex); \draw[dim] (\xDelta,0) -- node[right=2pt] {$\delta$} (\xDelta,\yApex); \end{tikzpicture} #+end_figure # Local Variables: # org-export-async-init-file: "ox-init.el" # org-export-in-background: t # End: