mirror of
https://github.com/vofy/fekt-scara.git
synced 2025-05-17 22:42:45 +02:00
Přidán text + organizace souborů + skript na generování tiskových souborů
This commit is contained in:
parent
9ddebfde03
commit
8acad6c9ad
33 changed files with 147 additions and 8 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -9,4 +9,6 @@ Private
|
|||
.DS_Store
|
||||
|
||||
tex/out/*
|
||||
!tex/out/*.pdf
|
||||
!tex/out/*.pdf
|
||||
|
||||
__pycache__/
|
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
|
@ -2,5 +2,8 @@
|
|||
"latex-workshop.formatting.latex": "latexindent",
|
||||
"latex-workshop.latex.outDir": "%DIR%/out",
|
||||
"files.autoSave": "afterDelay",
|
||||
"latex-workshop.synctex.afterBuild.enabled": true
|
||||
"latex-workshop.synctex.afterBuild.enabled": true,
|
||||
"latex-workshop.view.outline.sync.viewer": true,
|
||||
"editor.scrollbar.scrollByPage": true,
|
||||
"editor.find.cursorMoveOnType": true
|
||||
}
|
BIN
3mf/base/Electronics_Cover_Short.3mf
Normal file
BIN
3mf/base/Electronics_Cover_Short.3mf
Normal file
Binary file not shown.
BIN
3mf/base/Electronics_Cover_Top.3mf
Normal file
BIN
3mf/base/Electronics_Cover_Top.3mf
Normal file
Binary file not shown.
BIN
3mf/base/Frame_Plate_Side_Left.3mf
Normal file
BIN
3mf/base/Frame_Plate_Side_Left.3mf
Normal file
Binary file not shown.
BIN
3mf/base/Frame_Plate_Side_Right.3mf
Normal file
BIN
3mf/base/Frame_Plate_Side_Right.3mf
Normal file
Binary file not shown.
BIN
3mf/base/Frame_Tip.3mf
Normal file
BIN
3mf/base/Frame_Tip.3mf
Normal file
Binary file not shown.
BIN
3mf/base/Frame_Tip_Bottom.3mf
Normal file
BIN
3mf/base/Frame_Tip_Bottom.3mf
Normal file
Binary file not shown.
14
README.md
14
README.md
|
@ -4,9 +4,10 @@
|
|||
|
||||
```bash
|
||||
├── .vscode # Konfigurace prostředí pro sazbu
|
||||
├── 3mf # 3mf soubory vhodné ke slicování
|
||||
├── cad # Zdrojové soubory CAD
|
||||
├── step # STEP soubory vhodné ke slicování
|
||||
├── README.md # Informace k projektu (tento soubor)
|
||||
├── scripts # Skripty
|
||||
└── tex # Text práce
|
||||
├── generated # Generované stránky BP
|
||||
├── images # Obrázky použité v BP
|
||||
|
@ -28,5 +29,16 @@ Práce je kompilovaná sázecím systémem Latex a modifikovaným balíčkem the
|
|||
|
||||
##### Závislosti
|
||||
|
||||
- texlive
|
||||
- texlive-langczechslovak
|
||||
- texlive-langgreek
|
||||
|
||||
### Skripty
|
||||
|
||||
#### Generování tiskových souborů
|
||||
|
||||
Pro generování tiskových souborů slouží skript `generate_3mf_files.py` spouštěný následujícím příkazem:
|
||||
|
||||
```sh
|
||||
./generate_3mf_files.py
|
||||
```
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
cad/printed/base/Electronics_Cover_Short.FCStd
Normal file
BIN
cad/printed/base/Electronics_Cover_Short.FCStd
Normal file
Binary file not shown.
BIN
cad/printed/base/Frame_Plate_Side_Left.FCStd
Normal file
BIN
cad/printed/base/Frame_Plate_Side_Left.FCStd
Normal file
Binary file not shown.
BIN
cad/printed/base/Frame_Plate_Side_Right.FCStd
Normal file
BIN
cad/printed/base/Frame_Plate_Side_Right.FCStd
Normal file
Binary file not shown.
BIN
cad/printed/base/Frame_Tip.FCStd
Normal file
BIN
cad/printed/base/Frame_Tip.FCStd
Normal file
Binary file not shown.
BIN
cad/printed/base/Frame_Tip_Bottom.FCStd
Normal file
BIN
cad/printed/base/Frame_Tip_Bottom.FCStd
Normal file
Binary file not shown.
BIN
cad/sourced/Profile-20x40-300.FCStd
Normal file
BIN
cad/sourced/Profile-20x40-300.FCStd
Normal file
Binary file not shown.
65
scripts/generate_3mf_files.py
Executable file
65
scripts/generate_3mf_files.py
Executable file
|
@ -0,0 +1,65 @@
|
|||
#!/usr/bin/freecadcmd
|
||||
|
||||
import os
|
||||
import FreeCAD
|
||||
import Mesh
|
||||
|
||||
# Define the project root directory
|
||||
project_root = os.path.abspath(
|
||||
os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)
|
||||
)
|
||||
|
||||
# Define the directories for CAD files and 3MF export files
|
||||
printed_cad_dir = os.path.join(project_root, "cad", "printed")
|
||||
printed_3mf_dir = os.path.join(project_root, "3mf")
|
||||
|
||||
# List to keep track of files that failed to export
|
||||
failed_files = []
|
||||
|
||||
# Traverse the printed CAD directory and its subdirectories
|
||||
for root, dirs, files in os.walk(printed_cad_dir):
|
||||
for file in files:
|
||||
if file.endswith(".FCStd"):
|
||||
# Absolute path of the CAD file
|
||||
file_path = os.path.join(root, file)
|
||||
|
||||
# Abslute path for the exported 3MF file
|
||||
output_path = os.path.join(
|
||||
printed_3mf_dir, os.path.relpath(file_path, printed_cad_dir)
|
||||
).replace(".FCStd", ".3mf")
|
||||
|
||||
# Create the output directory if it doesn't already exist
|
||||
os.makedirs(os.path.dirname(output_path), exist_ok=True)
|
||||
|
||||
FreeCAD.Console.PrintMessage(f"\nExporting {file_path}\n")
|
||||
|
||||
# Open the FreeCAD document and recompute it
|
||||
doc = FreeCAD.openDocument(file_path)
|
||||
FreeCAD.setActiveDocument(doc.Name)
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
# Get the body object from the document
|
||||
body = doc.getObject("Body")
|
||||
if body is None:
|
||||
FreeCAD.Console.PrintError(f"No 'Body' found in {file}\n")
|
||||
FreeCAD.closeDocument(doc.Name)
|
||||
failed_files.append(file_path)
|
||||
continue
|
||||
|
||||
# Try to export the body to a 3MF file
|
||||
try:
|
||||
Mesh.export([body], output_path)
|
||||
except Exception as e:
|
||||
FreeCAD.Console.PrintError(f"Error exporting {file}: {e}\n")
|
||||
failed_files.append(file_path)
|
||||
|
||||
# Close the FreeCAD document
|
||||
FreeCAD.closeDocument(doc.Name)
|
||||
|
||||
# Print the result of the export and the files that failed
|
||||
if failed_files:
|
||||
FreeCAD.Console.PrintError("\nThe following files failed to export:\n")
|
||||
for file in failed_files:
|
||||
FreeCAD.Console.PrintError(f" - {file}\n")
|
||||
else:
|
||||
FreeCAD.Console.PrintMessage("\nAll files have been exported successfully.\n")
|
|
@ -37,4 +37,12 @@
|
|||
title = {x-scara},
|
||||
year = {2023},
|
||||
note = {GitHub repository}
|
||||
}
|
||||
|
||||
@misc{klipper_code_overview,
|
||||
title = {Klipper Code Overview},
|
||||
author = {{Klipper 3D}},
|
||||
year = {2023},
|
||||
url = {https://www.klipper3d.org/Code_Overview.html},
|
||||
note = {Accessed: 2023-10-10}
|
||||
}
|
Binary file not shown.
|
@ -10,25 +10,74 @@ Mnou vytvářené modely vychází z projektu x-scara. \cite{x-scara} Model je r
|
|||
\subsection{Základna}
|
||||
Základna je složena ze hliníkových profilů 20x20mm a 20x40mm. Na základnu je upevněno rameno, které se díky lineárně valivým ložiskům pohybuje po vodící tyči o průměru 8mm. Základna je složena ze hliníkových profilů 20x20mm a 20x40mm. Na základnu je upevněno rameno, které se díky lineárně valivým ložiskům pohybuje po třech vodících tyčích o průměru 8mm. V horní části základny je upevněn krokový motor, který pomocí trapézové tyče o průměru 8mm pohybuje ramenem v ose Z.
|
||||
|
||||
V zadní části zakladny je též prostor pro upevnění elektroniky. Za PMMA panelem jsou přimontovány dvě DIN lišty, na které jsou pomocí adaptérů upevněny jednotlivé elektronické prvky.
|
||||
Pro spojení hliníkových profilů jsem zvolil techniku "Blind Joint", která umožňuje pevné a levné spojení dvou hliníkových profilů. Tuto techniku jsem zvolil i z důvodů snadnější montáže akrylové desky a možnosti zapuštění elektroniky do rámu tiskárny.
|
||||
|
||||
V zadní části zakladny je též prostor pro upevnění elektroniky. Za akrylovým panelem jsou přimontovány dvě DIN lišty, na které jsou pomocí adaptérů upevněny jednotlivé elektronické prvky.
|
||||
|
||||
\section{Implementace kinematiky scara do Klippy}
|
||||
Pro další výpočty je potřebné znát Elbow Crosstalk Ratio (převodový poměr ozubených řemenic v ose ramene vůči řemenici v ose kloubu).
|
||||
Klippy je část firmwaru Klipper, která běží na počítači uvnitř 3D tiskárny, ke kterému je připojena řídící deska. Kód je napsán převážne v jazyce Python, přičemž některé funkce jsou implementovány v jazyce C. Volání těchto funkcí je realizováno použitím rozraní CFFI (C Foreign Function Interface). \cite{klipper_code_overview}
|
||||
|
||||
\subsection{Přímá a inverzní kinematika}
|
||||
Kinematické transformace se používají k převodu natočení kloubů na souřadnice koncového bodu (přímá transformace) a naopak (inverzní transformace). Pro výpočet transformace je třeba znát délky ramen \(L_1\) a \(L_2\), offsety ramen \(x_{offset}\) a \(y_{offset}\) a Elbow Crosstalk Ratio (ECR).
|
||||
|
||||
Pro další výpočty je potřebné znát Elbow Crosstalk Ratio (převodový poměr řemenice v ose ramene vůči řemenici v ose kloubu).
|
||||
|
||||
\begin{equation}
|
||||
ECR = \frac { n_S } { n_E }
|
||||
\end{equation}
|
||||
|
||||
\section{Přímá kinematika}
|
||||
\subsubsection{Přímá kinematika}
|
||||
|
||||
\begin{equation}
|
||||
\phi_S = a
|
||||
\end{equation}
|
||||
|
||||
\begin{equation}
|
||||
\phi_E = b - \frac{a}{ECR}
|
||||
\end{equation}
|
||||
|
||||
\begin{equation}
|
||||
a\_sin = - \sin(\phi_S) \cdot L_1
|
||||
\end{equation}
|
||||
|
||||
\begin{equation}
|
||||
a\_cos = \cos(\phi_S) \cdot L_1
|
||||
\end{equation}
|
||||
|
||||
\begin{equation}
|
||||
b\_sin = - \sin(\phi_S + \phi_E) \cdot L_2
|
||||
\end{equation}
|
||||
|
||||
\begin{equation}
|
||||
b\_cos = \cos(\phi_S + \phi_E) \cdot L_2
|
||||
\end{equation}
|
||||
|
||||
Nakonec je potřeba přičíst odsazení souřadného systému nástroje vůči souřadnému systému báze (konkrétně odsazení kloubu ramene vůči počátku tiskové podložky).
|
||||
|
||||
\begin{equation}
|
||||
x = a\_sin + b\_sin + x_{offset}
|
||||
\end{equation}
|
||||
|
||||
\begin{equation}
|
||||
y = a\_cos + b\_cos + y_{offset}
|
||||
\end{equation}
|
||||
|
||||
|
||||
\subsection{Inverzní kinematika}
|
||||
\subsubsection{Inverzní kinematika}
|
||||
Nejprve je třeba kompenzovat offset polohy TCP v osách x a y.
|
||||
|
||||
\begin{equation}
|
||||
x = - (raw_x - x_{offset})
|
||||
\end{equation}
|
||||
|
||||
\begin{equation}
|
||||
y = (raw_y - y_{offset})
|
||||
\end{equation}
|
||||
|
||||
Dalším krokem je výpočet vzdálenosti od počátku.
|
||||
|
||||
\begin{equation}
|
||||
hypot = \sqrt{x^2 y^2}
|
||||
hypot = \sqrt{x^2 + y^2}
|
||||
\end{equation}
|
||||
|
||||
Dále se vypočítají úhly ramen \(\phi_S\) (shoulder) a \(\phi_E\) (elbow).
|
||||
|
|
Loading…
Reference in a new issue