Projeto: tutorial 3D de montagem e teste do kit CNC
- tutorial_teste_kit_cnc.html: tutorial autocontido (three.js e modelos embutidos), funciona por file:// sem servidor e sem internet - src/ e build.mjs: fontes da cena e empacotamento com esbuild - verify.mjs e capturas/: verificacao no Chromium headless e capturas dos 12 capitulos - frames.mjs e _frames/: quadros e folhas de contato da revisao quadro a quadro - teste_kit_cnc/: sketch Arduino de teste do kit - referencias_tecnicas/ e fotos_referencia/: datasheets, esquematicos e fotos
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
node_modules/
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
# Tutorial de montagem e teste do kit CNC
|
||||||
|
|
||||||
|
Arquivo único e autocontido: **`tutorial_teste_kit_cnc.html`**.
|
||||||
|
|
||||||
|
## Como abrir
|
||||||
|
Dê dois cliques em `tutorial_teste_kit_cnc.html` (ou arraste para o navegador).
|
||||||
|
Funciona por `file://`, **sem servidor e sem internet** — o three.js e o modelo das
|
||||||
|
mãos vão embutidos no próprio HTML.
|
||||||
|
|
||||||
|
## Como usar
|
||||||
|
- **▶ / ⏸** ou **espaço**: reproduzir / pausar.
|
||||||
|
- **← / →**: voltar / avançar 2 s.
|
||||||
|
- **1x / 0,5x / 2x**: velocidade.
|
||||||
|
- **tela cheia**: modo cinema.
|
||||||
|
- Com o vídeo **pausado**, arraste o mouse para orbitar a câmera; a roda dá zoom.
|
||||||
|
- A barra inferior tem marcas dos 12 capítulos e pode ser arrastada (scrub).
|
||||||
|
|
||||||
|
## Como regenerar
|
||||||
|
```bash
|
||||||
|
cd tutorial_de_montagem_de_teste
|
||||||
|
npm install # esbuild, playwright, three
|
||||||
|
npm run build # gera tutorial_teste_kit_cnc.html
|
||||||
|
node verify.mjs # roda no Chromium headless e salva capturas/ + checa erros
|
||||||
|
```
|
||||||
|
Fontes em `src/`; o sketch embutido está em `teste_kit_cnc/teste_kit_cnc.ino`.
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
# Relatório — tutorial 3D de montagem e teste do kit CNC
|
||||||
|
|
||||||
|
## Objetivo
|
||||||
|
Produzir um **único arquivo HTML autocontido** (`tutorial_teste_kit_cnc.html`) que, com
|
||||||
|
dois cliques via `file://` e sem internet, apresente um vídeo interativo em três.js
|
||||||
|
mostrando passo a passo (com mãos 3D) a montagem e o teste do kit CNC do RoboMovel:
|
||||||
|
Arduino UNO R3 + CNC Shield V3 + 4× A4988 + 4× NEMA17 (17HS4401S). Toda a interface em
|
||||||
|
português do Brasil.
|
||||||
|
|
||||||
|
## Como foi construído
|
||||||
|
- **Bundler**: `esbuild` empacota `src/main.js` (IIFE, minificado) e injeta o resultado
|
||||||
|
no template `src/index.html`. O sketch `.ino` entra pelo loader `text` e o modelo das
|
||||||
|
mãos pelo loader `dataurl`. Resultado: um só HTML (~1,3 MB) com three.js r180, o
|
||||||
|
modelo riggado e o sketch embutidos.
|
||||||
|
- **Escala e eixos**: 1 unidade = 1 mm, **Z para cima**. Todos os modelos são
|
||||||
|
procedurais (sem arquivos externos), exceto as mãos.
|
||||||
|
- **Estado puro**: toda a animação é função pura de `t`. Nenhum objeto guarda estado
|
||||||
|
incremental — por isso o *scrub* funciona para trás sem divergência.
|
||||||
|
- **Player**: `window.__tutorial = { seek(t), play(), pause(), duration, chapters, time }`
|
||||||
|
e `window.__three = { scene, camera, renderer, THREE }` para testes.
|
||||||
|
|
||||||
|
## Conteúdo (12 capítulos, 212 s ≈ 3:32)
|
||||||
|
1. Aviso: tudo desligado durante a montagem
|
||||||
|
2. Encaixar o shield no UNO
|
||||||
|
3. Micropasso (1/16) — 3 jumpers por eixo
|
||||||
|
4. Colar os dissipadores
|
||||||
|
5. Encaixar os A4988
|
||||||
|
6. Clonagem do eixo A (A.STEP→D12, A.DIR→D13)
|
||||||
|
7. Ligar os motores
|
||||||
|
8. Ajuste do Vref (0,80 V no multímetro)
|
||||||
|
9. Ligar os motores (cabos)
|
||||||
|
10. Alimentação (fusível 5 A no positivo)
|
||||||
|
11. Teste dos motores (X→Y→Z→A, ida e volta)
|
||||||
|
12. Erros comuns
|
||||||
|
|
||||||
|
O painel de código mostra `teste_kit_cnc.ino` no capítulo 8; o painel final lista os
|
||||||
|
erros comuns e o que conferir.
|
||||||
|
|
||||||
|
## Peças modeladas (procedurais)
|
||||||
|
UNO R3 (USB, jack DC, eletrolíticos, LED de power que acende no cap. 8 e no 11),
|
||||||
|
CNC Shield V3 (soquetes dos drivers, bornes, capacitores deitados, jumpers de
|
||||||
|
micropasso e de clonagem, barra de fim de curso, USB), A4988, dissipadores + fita
|
||||||
|
térmica, NEMA17 17HS4401S (corpo laminado, face escovada, furos M3 a 31 mm, eixo Ø5
|
||||||
|
com face D e fita de giro), cabos 4P, bancada, espumas, bateria, fusível, multímetro
|
||||||
|
(LCD dinâmico com Vref), pontas de prova, chave de ferramenta (isolada), fios de
|
||||||
|
alimentação e USB. As PCBs usam textura UV própria (máscara, plano de terra, trilhas
|
||||||
|
ortogonais, pads dourados e serigrafia).
|
||||||
|
|
||||||
|
## Mãos
|
||||||
|
Substituídas pela mão procedural por **`first_person_hands_rigged.glb`** (modelo
|
||||||
|
riggado, 63 ossos, CC-BY-4.0 de DavidFischer/Sketchfab), embutido como data URL.
|
||||||
|
- O rig tem dois braços num único *skinned mesh*; cada mão recebe um clone
|
||||||
|
(`SkeletonUtils.clone`) e o braço oposto é recolhido, ficando independentes.
|
||||||
|
- A colocação mantém o contrato antigo: `placePinch(alvo, quat)` aplica uma
|
||||||
|
transformação rígida no espaço do mundo aos ossos-raiz do antebraço/mão de modo que
|
||||||
|
o ponto de pinça (média entre ponta do indicador e do polegar) caia no alvo com a
|
||||||
|
orientação pedida. `setPose('open'|'relaxed'|'pinch'|'grip'|'plate'|'point'|'tool')`
|
||||||
|
flexiona os dedos (eixo X local dos ossos, positivo = flexão).
|
||||||
|
- Um pequeno punho/manga cobre a extremidade aberta do braço (o rig de FPS vai até o
|
||||||
|
ombro).
|
||||||
|
|
||||||
|
## Verificação
|
||||||
|
`verify.mjs` abre o HTML final no **Chromium headless (Playwright + SwiftShader)** e:
|
||||||
|
- confere `duration`/`chapters`/contexto WebGL;
|
||||||
|
- salva uma captura no meio de **cada um dos 12 capítulos** em `capturas/`;
|
||||||
|
- faz *scrub* para frente e para trás em 7 instantes e compara o estado de **6.643
|
||||||
|
objetos** (posição, rotação, escala, visibilidade, tipo e nome): **0 divergências**;
|
||||||
|
- testa `play()`/`pause()`.
|
||||||
|
|
||||||
|
Resultado na última execução: `0 erros no console`.
|
||||||
|
|
||||||
|
## O que ficou imperfeito
|
||||||
|
- As mãos/braços são de um rig de FPS; o antebraço é mais espesso que a mão
|
||||||
|
procedural anterior e, em certos enquadramentos muito de cima, o braço pode cobrir
|
||||||
|
parte da cena. O punho ajuda a disfarçar a ponta aberta, mas não é perfeito.
|
||||||
|
- As poses de dedos foram calibradas no olho; alguns pinçamentos podem encostar um
|
||||||
|
pouco no componente.
|
||||||
|
- As referências técnicas de algumas peças (datasheet do 17HS4401S, desenho mecânico
|
||||||
|
do UNO) só puderam ser obtidas como imagem/HTML em fontes de terceiros, porque os
|
||||||
|
PDFs oficiais bloqueiam download direto; estão em `referencias_tecnicas/`.
|
||||||
|
- `compact_multimeter_lowpoly.glb` não foi usado (o multímetro continua procedural).
|
||||||
|
|
||||||
|
## Como reproduzir
|
||||||
|
```bash
|
||||||
|
cd tutorial_de_montagem_de_teste
|
||||||
|
npm install
|
||||||
|
npm run build # gera tutorial_teste_kit_cnc.html
|
||||||
|
node verify.mjs # capturas + checagem de erros e de scrub
|
||||||
|
```
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { chromium } from 'playwright';
|
||||||
|
import path from 'node:path';
|
||||||
|
const root=process.cwd();const html='file://'+path.join(root,'tutorial_teste_kit_cnc.html');
|
||||||
|
const exe=process.env.HOME+'/.cache/ms-playwright/chromium_headless_shell-1243/chrome-headless-shell-linux64/chrome-headless-shell';
|
||||||
|
const b=await chromium.launch({executablePath:exe,args:['--use-angle=swiftshader','--enable-unsafe-swiftshader','--ignore-gpu-blocklist','--no-sandbox']});
|
||||||
|
const p=await b.newPage({viewport:{width:400,height:300}});
|
||||||
|
await p.goto(html,{waitUntil:'load'});await p.waitForFunction(()=>window.__tutorial&&window.__tutorial.duration>0);await p.waitForTimeout(1500);
|
||||||
|
await p.evaluate(()=>{window.__tutorial.pause();window.__tutorial.seek(25);});
|
||||||
|
const out=await p.evaluate(()=>{
|
||||||
|
const T=window.__three.THREE, scene=window.__three.scene;
|
||||||
|
const a=scene.getObjectByName('hand_right'); if(!a)return 'no anchor';
|
||||||
|
const res=[]; a.updateMatrixWorld(true);
|
||||||
|
a.traverse(o=>{ if(o.isMesh && o.geometry && o.geometry.type==='CylinderGeometry'){ const s=new T.Vector3(); o.getWorldScale(s); const wp=new T.Vector3(); o.getWorldPosition(wp); res.push({name:o.parent&&o.parent.name, scale:s.toArray().map(x=>+x.toFixed(3)), pos:wp.toArray().map(x=>+x.toFixed(1)), params:o.geometry.parameters}); } });
|
||||||
|
return res;
|
||||||
|
});
|
||||||
|
console.log(JSON.stringify(out,null,1));
|
||||||
|
await b.close();
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import { chromium } from 'playwright';
|
||||||
|
import path from 'node:path';
|
||||||
|
const root=process.cwd();const html='file://'+path.join(root,'tutorial_teste_kit_cnc.html');
|
||||||
|
const exe=process.env.HOME+'/.cache/ms-playwright/chromium_headless_shell-1243/chrome-headless-shell-linux64/chrome-headless-shell';
|
||||||
|
const b=await chromium.launch({executablePath:exe,args:['--use-angle=swiftshader','--enable-unsafe-swiftshader','--ignore-gpu-blocklist','--no-sandbox']});
|
||||||
|
const p=await b.newPage({viewport:{width:400,height:300}});
|
||||||
|
await p.goto(html,{waitUntil:'load'});await p.waitForFunction(()=>window.__tutorial&&window.__tutorial.duration>0);await p.waitForTimeout(1500);
|
||||||
|
await p.evaluate(()=>{window.__tutorial.pause();window.__tutorial.seek(25);});
|
||||||
|
const out=await p.evaluate(()=>{
|
||||||
|
const T=window.__three.THREE, scene=window.__three.scene;
|
||||||
|
const a=scene.getObjectByName('hand_right'); a.updateMatrixWorld(true);
|
||||||
|
const g=n=>a.getObjectByName(n);
|
||||||
|
const wp=o=>{const v=new T.Vector3();o.getWorldPosition(v);return v.toArray().map(x=>+x.toFixed(1));};
|
||||||
|
return {
|
||||||
|
ua: wp(g('upper_armR_03')),
|
||||||
|
fa: wp(g('forearmR_04')),
|
||||||
|
faRoot: wp(g('forearmR001_09')),
|
||||||
|
hand: wp(g('handR_010')),
|
||||||
|
itip: wp(g('f_index03R_end_057')),
|
||||||
|
uaScale: g('upper_armR_03').scale.toArray(),
|
||||||
|
anchorPos: a.position.toArray().map(x=>+x.toFixed(2)),
|
||||||
|
anchorScale: a.scale.toArray(),
|
||||||
|
rootScale: a.children[0] ? a.children[0].scale.toArray() : null,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
console.log(JSON.stringify(out,null,1));
|
||||||
|
await b.close();
|
||||||
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 81 KiB |
|
After Width: | Height: | Size: 81 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 81 KiB |
|
After Width: | Height: | Size: 81 KiB |
|
After Width: | Height: | Size: 81 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 91 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 97 KiB |
|
After Width: | Height: | Size: 91 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 90 KiB |
|
After Width: | Height: | Size: 87 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 86 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 67 KiB |
|
After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 105 KiB |
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 95 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 67 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 73 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 77 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 77 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 91 KiB |
|
After Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 97 KiB |
|
After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 97 KiB |
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 91 KiB |
|
After Width: | Height: | Size: 91 KiB |
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 97 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 98 KiB |