'2026/06'에 해당되는 글 77건

  1. 2026.06.20 openSCAD MCP
  2. 2026.06.20 pythonSCAD
  3. 2026.06.20 openSCAD cheatsheet
  4. 2026.06.20 openSCAD 설치
  5. 2026.06.19 포맷할때가 되었나..
  6. 2026.06.19 moviad / stftpm / 1080 ti / webcam feat claude
  7. 2026.06.19 stm32f429i disco boot0 stm32flash
  8. 2026.06.19 elephant robotics cobot python api
  9. 2026.06.18 moviad stfpm
  10. 2026.06.18 llama-swap 구현 (채팅)

'프로그램 사용 > openSCAD' 카테고리의 다른 글

pythonSCAD  (0) 2026.06.20
openSCAD cheatsheet  (0) 2026.06.20
openSCAD 설치  (0) 2026.06.20
openscad  (0) 2026.05.27
Posted by 구차니

python을 통해 직접 컨트롤 하는게 MCP 쓰는것 보다 편할것 같아서 검색

 

[링크 : https://learn.cadhub.xyz/blog/curated-code-cad/]

[링크 : https://www.pythonscad.org/]

'프로그램 사용 > openSCAD' 카테고리의 다른 글

openSCAD MCP  (0) 2026.06.20
openSCAD cheatsheet  (0) 2026.06.20
openSCAD 설치  (0) 2026.06.20
openscad  (0) 2026.05.27
Posted by 구차니

primitive 도형들이 별로 없네?

logo 예제의 difference도 함수였군. 차집합을 만드는..

[링크 : https://openscad.org/cheatsheet/]

'프로그램 사용 > openSCAD' 카테고리의 다른 글

openSCAD MCP  (0) 2026.06.20
pythonSCAD  (0) 2026.06.20
openSCAD 설치  (0) 2026.06.20
openscad  (0) 2026.05.27
Posted by 구차니

[링크 : https://openscad.org/]

 

// logo.scad - Basic example of module, top-level variable and $fn usage

Logo(50);

// The $fn parameter will influence all objects inside this module
// It can, optionally, be overridden when instantiating the module
module Logo(size=50, $fn=100) {
    // Temporary variables
    hole = size/2;
    cylinderHeight = size * 1.25;

    // One positive object (sphere) and three negative objects (cylinders)
    difference() {
        sphere(d=size);
        
        cylinder(d=hole, h=cylinderHeight, center=true);
        // The '#' operator highlights the object
        #rotate([90, 0, 0]) cylinder(d=hole, h=cylinderHeight, center=true);
        rotate([0, 90, 0]) cylinder(d=hole, h=cylinderHeight, center=true);
    }
}

echo(version=version());
// Written by Clifford Wolf <clifford@clifford.at> and Marius
// Kintel <marius@kintel.net>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to the
// public domain worldwide. This software is distributed without any
// warranty.
//
// You should have received a copy of the CC0 Public Domain
// Dedication along with this software.
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.

 

주석 처리는 모르겠고 딱 봐서 sphere만 있으면 구를 그릴것 같아서 해보니 ok

오호.. 이래서 LLM 연동해서 그리기 쉽다고 하는 거였나?

Logo(50);

module Logo(size=50, $fn=100) {
    hole = size/2;
    cylinderHeight = size * 1.25;

    difference() {
        sphere(d=size);
    
    }
}

'프로그램 사용 > openSCAD' 카테고리의 다른 글

openSCAD MCP  (0) 2026.06.20
pythonSCAD  (0) 2026.06.20
openSCAD cheatsheet  (0) 2026.06.20
openscad  (0) 2026.05.27
Posted by 구차니
개소리 왈왈/컴퓨터2026. 6. 19. 22:19

왜 암호 바꾼지 얼마 되었다고 또 털리지?

aka.ms 라서 스미싱인가 했는데

메일로도 와있고 흐음.. 

 

의심되는건

1. iptime 문제(일단 업데이트 함)

2. 구글이 털렸다. (크롬 암호 저장)

3. ms가 털렸다.

4. 다른 사이트가 또 털렸다.

어느쪽이려나..

'개소리 왈왈 > 컴퓨터' 카테고리의 다른 글

iptime as 접수  (0) 2026.06.15
asrock B360M pro4  (0) 2026.05.01
지름 - 케이스, 램  (0) 2026.04.30
되는게 없네 ㅋㅋㅋ - 라이트 컴 NA210  (0) 2026.04.30
듀얼 그래픽 카드!  (0) 2026.04.25
Posted by 구차니

최초 커밋으로 내려가니 그래도 조금만 손대서 돌아간다. 휴

$git checkout cfef9771
$ python main_stfpm.py --train --eval     --model_name mobilenet_v2     --categories bottle     --ad_layers 3 4 5     --boot_layer 2     --results_dirpath debug_outputs/metrics     --checkpoint_dir debug_outputs/checkpoints     --seeds 0 --epochs 1000 --input_size 224 224     --device cuda:1

[링크 : https://github.com/AMCO-UniPD/moviad]

 

아래 사진을 모니터에 띄우고

 

예제 클로드(무료)로 작성하라고 했는데

처음에는 모니터 없어서 안된다고(아니.. ssh -X로 해서 떠야 하는데?)

그래서 웹으로 뚝딱 만들어 줌.. 오.. 나보다 100배 낫네

 

 

cudnn 비활성화 하고 (빨간색 부분)

웹캠으로 노트북 모니터 비추도록 해서 테스트. 음.. 잘 되는건지 안되는건지 미묘하다

"""
MoViAD STFPM + 웹캠 실시간 이상 감지 (브라우저 스트리밍 버전)
=============================================================

cv2.imshow 없이 HTTP MJPEG 스트리밍으로 브라우저에서 확인합니다.
→  http://localhost:8080  에 접속하면 실시간 영상이 표시됩니다.

[사전 준비]
  cd moviad && pip install -e ./
  pip install opencv-python-headless torch torchvision

[모델 학습]
  python main_scripts/main_stfpm.py \
      --train \
      --model_name mobilenet_v2 \
      --ad_layers 4 7 10 \
      --categories bottle \
      --dataset_path /path/to/mvtec \
      --checkpoint_dir ./checkpoints/stfpm \
      --device cuda:0 \
      --epochs 100

[실행]
  python webcam_stfpm_anomaly.py \
      --checkpoint ./checkpoints/stfpm/bottle/mobilenet_v2_100ep_IMAGENET1K_V2_4_7_10_s0.pth.tar

[REST 제어 API]  (curl 또는 브라우저로 호출)
  GET /threshold/up      임계값 +0.02
  GET /threshold/down    임계값 -0.02
  GET /threshold/auto    자동 보정 (현재 점수 기준)
  GET /heatmap/toggle    히트맵 ON/OFF
  GET /reset             점수 히스토리 초기화
  GET /status            현재 상태 JSON
"""

import argparse
import sys
import time
import threading
import json
from datetime import datetime
from pathlib import Path
from http.server import HTTPServer, BaseHTTPRequestHandler
from io import BytesIO

import cv2
import numpy as np
import torch
from torchvision import transforms

torch.backends.cudnn.enabled = False
torch.backends.cudnn.benchmark = False

try:
    from moviad.models import Stfpm
except ImportError:
    sys.exit(
        "\n[ERROR] moviad 패키지를 찾을 수 없습니다.\n"
        "  moviad 레포 루트에서 'pip install -e ./' 를 실행하세요.\n"
    )

# ──────────────────────────────────────────────────────────────────
# 전역 공유 상태 (스레드 간 공유)
# ──────────────────────────────────────────────────────────────────
class AppState:
    def __init__(self):
        self.lock          = threading.Lock()
        self.jpeg_frame    = b""          # MJPEG 브라우저 전송용 프레임
        self.threshold     = 0.5
        self.show_heat     = True
        self.norm_score    = 0.0
        self.raw_score     = 0.0
        self.is_anomaly    = False
        self.fps           = 0.0
        self.score_hist: list[float] = []
        self.running       = True

STATE = AppState()

# ──────────────────────────────────────────────────────────────────
# 전처리
# ──────────────────────────────────────────────────────────────────
IMG_SIZE = 224
RESIZE   = 256

def make_preprocess(img_size=224):
    resize = int(img_size * 256 / 224)
    return transforms.Compose([
        transforms.ToPILImage(),
        transforms.Resize(resize),
        transforms.CenterCrop(img_size),
        transforms.ToTensor(),
        transforms.Normalize(mean=[0.485, 0.456, 0.406],
                             std =[0.229, 0.224, 0.225]),
    ])

# ──────────────────────────────────────────────────────────────────
# 모델 로드
# ──────────────────────────────────────────────────────────────────
def load_stfpm(checkpoint_path: str, device: torch.device) -> Stfpm:
    print(f"[INFO] 체크포인트 로드: {checkpoint_path}")
    state = torch.load(checkpoint_path, map_location=device)
    model = Stfpm()
    model.load_state_dict(state, strict=False)
    model.to(device)
    model.eval()
    print(f"[INFO] 백본={model.backbone_model_name}  "
          f"AD레이어={model.ad_layers}  입력크기={model.input_size}")
    return model

# ──────────────────────────────────────────────────────────────────
# 시각화 헬퍼
# ──────────────────────────────────────────────────────────────────
C_NORMAL  = (50,  205,  50)
C_ANOMALY = (30,   30, 220)
C_PANEL   = (15,   15,  15)

def score_to_heatmap(score_map: torch.Tensor, wh: tuple) -> np.ndarray:
    arr  = score_map.squeeze().cpu().numpy()
    arr  = cv2.normalize(arr, None, 0, 255, cv2.NORM_MINMAX).astype(np.uint8)
    heat = cv2.applyColorMap(arr, cv2.COLORMAP_JET)
    return cv2.resize(heat, wh)

def draw_ui(frame, norm_score, raw_score, threshold,
            is_anomaly, fps, heatmap, show_heat) -> np.ndarray:
    out = frame.copy()
    h, w = out.shape[:2]

    if show_heat and heatmap is not None:
        out = cv2.addWeighted(out, 0.5, heatmap, 0.5, 0)

    color = C_ANOMALY if is_anomaly else C_NORMAL
    cv2.rectangle(out, (0, 0), (w-1, h-1), color, 6)

    # 반투명 상단 패널
    panel_h = 100
    overlay = out.copy()
    cv2.rectangle(overlay, (0, 0), (w, panel_h), C_PANEL, -1)
    cv2.addWeighted(overlay, 0.70, out, 0.30, 0, out)

    label = "[ ANOMALY ]" if is_anomaly else "[  NORMAL  ]"
    cv2.putText(out, label, (10, 36),
                cv2.FONT_HERSHEY_DUPLEX, 1.1, color, 2, cv2.LINE_AA)

    info = (f"Score(norm): {norm_score:.4f}  Raw: {raw_score:.4f}  "
            f"Thr: {threshold:.4f}  FPS: {fps:.1f}")
    cv2.putText(out, info, (10, 64),
                cv2.FONT_HERSHEY_SIMPLEX, 0.52, (210, 210, 210), 1, cv2.LINE_AA)
    cv2.putText(out, "http://localhost:8080  |  /status /threshold/up /threshold/down /threshold/auto /heatmap/toggle /reset",
                (10, 88), cv2.FONT_HERSHEY_SIMPLEX, 0.38, (160, 160, 160), 1, cv2.LINE_AA)

    # 점수 바
    bx, by0, by1 = 12, 74, 88
    bw = w - 24
    fill = int(bw * min(norm_score, 1.0))
    tx   = bx + int(bw * min(threshold, 1.0))
    cv2.rectangle(out, (bx, by0), (bx+bw, by1), (55,55,55), -1)
    cv2.rectangle(out, (bx, by0), (bx+fill, by1), color, -1)
    cv2.line(out, (tx, by0-3), (tx, by1+3), (0, 255, 255), 2)

    return out

# ──────────────────────────────────────────────────────────────────
# 추론 스레드
# ──────────────────────────────────────────────────────────────────
def inference_loop(model, preprocess, device, camera_id, width, height):
    cap = cv2.VideoCapture(camera_id)
    if not cap.isOpened():
        print(f"[ERROR] 카메라(id={camera_id})를 열 수 없습니다.")
        STATE.running = False
        return

    cap.set(cv2.CAP_PROP_FRAME_WIDTH,  width)
    cap.set(cv2.CAP_PROP_FRAME_HEIGHT, height)

    t_prev = time.time()
    fps    = 0.0
    save_dir = Path("captures")

    print(f"[INFO] 카메라 시작 (id={camera_id}, {width}x{height})")
    print("[INFO] 브라우저에서  http://localhost:8080  접속하세요\n")

    while STATE.running:
        ret, frame = cap.read()
        if not ret:
            time.sleep(0.03)
            continue

        # 추론
        rgb    = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
        tensor = preprocess(rgb).unsqueeze(0).to(device)

        with torch.no_grad():
            score_maps, anomaly_scores = model(tensor)

        raw_score = float(anomaly_scores[0].cpu())

        # 정규화 (min-max, 최근 500프레임)
        with STATE.lock:
            STATE.score_hist.append(raw_score)
            if len(STATE.score_hist) > 500:
                STATE.score_hist.pop(0)
            s_min = min(STATE.score_hist)
            s_max = max(STATE.score_hist)
            norm  = (raw_score - s_min) / (s_max - s_min + 1e-8)
            threshold  = STATE.threshold
            show_heat  = STATE.show_heat

        is_anomaly = norm > threshold

        heatmap = score_to_heatmap(score_maps, (frame.shape[1], frame.shape[0]))

        # FPS
        t_now = time.time()
        fps   = 0.9 * fps + 0.1 / max(t_now - t_prev, 1e-6)
        t_prev = t_now

        # 화면 렌더링
        display = draw_ui(frame, norm, raw_score, threshold,
                          is_anomaly, fps, heatmap, show_heat)

        # JPEG 인코딩 → 공유 버퍼
        ok, buf = cv2.imencode('.jpg', display, [cv2.IMWRITE_JPEG_QUALITY, 85])
        if ok:
            with STATE.lock:
                STATE.jpeg_frame = buf.tobytes()
                STATE.norm_score = norm
                STATE.raw_score  = raw_score
                STATE.is_anomaly = is_anomaly
                STATE.fps        = fps

        # 콘솔 출력
        tag = "ANOMALY ⚠" if is_anomaly else "normal ✓ "
        print(f"\r[{tag}]  norm={norm:.4f}  raw={raw_score:.4f}  "
              f"thr={threshold:.4f}  fps={fps:.1f}   ",
              end="", flush=True)

    cap.release()
    print("\n[INFO] 카메라 종료")

# ──────────────────────────────────────────────────────────────────
# HTTP 서버 (MJPEG + REST API)
# ──────────────────────────────────────────────────────────────────
HTML_PAGE = """\
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>MoViAD STFPM - Bottle Anomaly Detection</title>
  <style>
    body {{ background:#111; color:#eee; font-family:monospace;
            display:flex; flex-direction:column; align-items:center; margin:0; padding:16px; }}
    h2   {{ color:#4fc3f7; margin:8px 0; }}
    img  {{ max-width:100%; border:3px solid #333; border-radius:6px; }}
    .controls {{ display:flex; gap:10px; flex-wrap:wrap; justify-content:center; margin:12px 0; }}
    button {{ padding:8px 18px; border:none; border-radius:5px; cursor:pointer;
              background:#1e88e5; color:#fff; font-size:14px; font-weight:bold; }}
    button:hover {{ background:#1565c0; }}
    button.danger {{ background:#e53935; }}
    button.success {{ background:#43a047; }}
    #status {{ background:#1e1e1e; border-radius:6px; padding:12px 20px;
               font-size:15px; min-width:340px; text-align:center; margin-top:6px; }}
    .normal  {{ color:#69f0ae; font-weight:bold; }}
    .anomaly {{ color:#ff5252; font-weight:bold; }}
  </style>
</head>
<body>
  <h2>🔍 MoViAD STFPM — Bottle Anomaly Detection</h2>
  <img src="/stream" alt="webcam stream">
  <div class="controls">
    <button onclick="api('/threshold/up')"  >Threshold ▲ (+0.02)</button>
    <button onclick="api('/threshold/down')">Threshold ▼ (−0.02)</button>
    <button class="success" onclick="api('/threshold/auto')">Auto Calibrate (t)</button>
    <button onclick="api('/heatmap/toggle')">Heatmap Toggle (h)</button>
    <button class="danger"  onclick="api('/reset')"          >Reset History (r)</button>
  </div>
  <div id="status">로딩 중...</div>
  <script>
    function api(path) {{
      fetch(path).then(r=>r.json()).then(updateStatus);
    }}
    function updateStatus(d) {{
      const cls = d.is_anomaly ? 'anomaly' : 'normal';
      const lab = d.is_anomaly ? '⚠ ANOMALY' : '✓ NORMAL';
      document.getElementById('status').innerHTML =
        `<span class="${{cls}}">${{lab}}</span> &nbsp;|&nbsp; `+
        `norm: <b>${{d.norm_score.toFixed(4)}}</b> &nbsp; `+
        `raw: ${{d.raw_score.toFixed(4)}} &nbsp; `+
        `thr: <b>${{d.threshold.toFixed(4)}}</b> &nbsp; `+
        `fps: ${{d.fps.toFixed(1)}} &nbsp; `+
        `heatmap: ${{d.show_heat ? 'ON' : 'OFF'}}`;
    }}
    setInterval(() => fetch('/status').then(r=>r.json()).then(updateStatus), 500);
  </script>
</body>
</html>
"""

class StreamHandler(BaseHTTPRequestHandler):
    def log_message(self, *args):
        pass  # 콘솔 노이즈 억제

    def do_GET(self):
        p = self.path.split('?')[0]

        # ── MJPEG 스트림 ─────────────────────────────
        if p == '/stream':
            self.send_response(200)
            self.send_header('Content-Type',
                             'multipart/x-mixed-replace; boundary=frame')
            self.end_headers()
            try:
                while STATE.running:
                    with STATE.lock:
                        frame = STATE.jpeg_frame
                    if frame:
                        self.wfile.write(
                            b"--frame\r\n"
                            b"Content-Type: image/jpeg\r\n\r\n"
                            + frame + b"\r\n"
                        )
                    time.sleep(0.03)
            except (BrokenPipeError, ConnectionResetError):
                pass
            return

        # ── REST API ──────────────────────────────────
        with STATE.lock:
            if p == '/threshold/up':
                STATE.threshold = min(STATE.threshold + 0.02, 0.99)
            elif p == '/threshold/down':
                STATE.threshold = max(STATE.threshold - 0.02, 0.01)
            elif p == '/threshold/auto':
                STATE.threshold = float(
                    np.clip(STATE.norm_score + 0.05, 0.01, 0.99)
                )
            elif p == '/heatmap/toggle':
                STATE.show_heat = not STATE.show_heat
            elif p == '/reset':
                STATE.score_hist.clear()

            resp = {
                "threshold" : STATE.threshold,
                "norm_score": STATE.norm_score,
                "raw_score" : STATE.raw_score,
                "is_anomaly": STATE.is_anomaly,
                "fps"       : STATE.fps,
                "show_heat" : STATE.show_heat,
            }

        # ── HTML 홈 ───────────────────────────────────
        if p == '/':
            body = HTML_PAGE.encode()
            self.send_response(200)
            self.send_header('Content-Type', 'text/html; charset=utf-8')
            self.send_header('Content-Length', str(len(body)))
            self.end_headers()
            self.wfile.write(body)
            return

        body = json.dumps(resp).encode()
        self.send_response(200)
        self.send_header('Content-Type', 'application/json')
        self.send_header('Content-Length', str(len(body)))
        self.end_headers()
        self.wfile.write(body)

# ──────────────────────────────────────────────────────────────────
# 메인
# ──────────────────────────────────────────────────────────────────
def run(args):
    # 디바이스
    dev_str = args.device
    if "cuda" in dev_str and not torch.cuda.is_available():
        print("[WARN] CUDA 불가 — CPU로 전환합니다.")
        dev_str = "cpu"
    device = torch.device(dev_str)

    # 모델 로드
    model = load_stfpm(args.checkpoint, device)

    # 입력 크기 동기화
    img_size = model.input_size[0] if model.input_size else 224
    preprocess = make_preprocess(img_size)

    STATE.threshold = args.threshold

    # 추론 스레드 시작
    t = threading.Thread(
        target=inference_loop,
        args=(model, preprocess, device,
              args.camera_id, args.width, args.height),
        daemon=True,
    )
    t.start()

    # HTTP 서버 시작
    server = HTTPServer(("0.0.0.0", args.port), StreamHandler)
    print(f"[INFO] HTTP 서버 시작: http://localhost:{args.port}")
    print("[INFO] Ctrl+C 로 종료\n")
    try:
        server.serve_forever()
    except KeyboardInterrupt:
        print("\n[INFO] 서버 종료")
    finally:
        STATE.running = False
        server.server_close()

# ──────────────────────────────────────────────────────────────────
# CLI
# ──────────────────────────────────────────────────────────────────
def parse_args():
    p = argparse.ArgumentParser(
        description="MoViAD STFPM bottle — 웹캠 이상 감지 (브라우저 스트리밍)"
    )
    p.add_argument("--checkpoint", type=str, required=True,
                   help=".pth.tar 체크포인트 경로")
    p.add_argument("--camera_id",  type=int,   default=0)
    p.add_argument("--device",     type=str,   default="cuda:0")
    p.add_argument("--threshold",  type=float, default=0.5)
    p.add_argument("--width",      type=int,   default=640)
    p.add_argument("--height",     type=int,   default=480)
    p.add_argument("--port",       type=int,   default=8080)
    return p.parse_args()

if __name__ == "__main__":
    run(parse_args())

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

moviad stfpm  (0) 2026.06.18
ubuntu 26.04 + 3070 + tensorflow + python 3.14 + docker...  (0) 2026.06.17
STFPM 실행  (0) 2026.06.01
딥러닝 학습 관련(epoch, loss)  (0) 2026.05.27
NAS - Neural Architecture Search  (0) 2026.05.21
Posted by 구차니
embeded/Cortex-M4 STM2026. 6. 19. 14:58

BOOT1 이라고 오른쪽 중간에 있는 곳을 잘 보면

BOOT0가 있는데 그걸 좌측 세번째 X3 crystal 근처의 3V 와 연결(pull up)

 

우측의 SDRAM 이라고 써있는 근처에 PA9 PA10를 USB TTL UART에 적당히~ 연결해주면 끝

[링크 : https://www.st.com/resource/en/user_manual/um1670-discovery-kit-with-stm32f429zi-mcu-stmicroelectronics.pdf]

 

잘 읽네. 그런데 속도 못 올리나.. 쩝..

$ stm32flash /dev/ttyUSB0 
stm32flash 0.5

http://stm32flash.sourceforge.net/

Interface serial_posix: 57600 8E1
Version      : 0x31
Option 1     : 0x00
Option 2     : 0x00
Device ID    : 0x0419 (STM32F42xxx/43xxx)
- RAM        : Up to 192KiB  (12288b reserved by bootloader)
- Flash      : Up to 2048KiB (size first sector: 1x16384)
- Option RAM : 65552b
- System RAM : 30KiB

 

$ stm32flash -r dump.bin /dev/ttyUSB0 
stm32flash 0.5

http://stm32flash.sourceforge.net/

Interface serial_posix: 57600 8E1
Version      : 0x31
Option 1     : 0x00
Option 2     : 0x00
Device ID    : 0x0419 (STM32F42xxx/43xxx)
- RAM        : Up to 192KiB  (12288b reserved by bootloader)
- Flash      : Up to 2048KiB (size first sector: 1x16384)
- Option RAM : 65552b
- System RAM : 30KiB
Memory read
Read address 0x08052100 (16.03%) ^C

 

'embeded > Cortex-M4 STM' 카테고리의 다른 글

stm32_programmer_cli 를 이용한 option byte 변경  (0) 2026.03.19
NUCLEO-WL55JC  (0) 2026.03.17
stm32g473 ART accelerator on/off ?  (0) 2026.02.06
stm32g473 flash doubleword  (0) 2026.02.04
STM32G47x dual bank flash  (0) 2026.02.03
Posted by 구차니
embeded/robot2026. 6. 19. 11:40

좌표는 mm 단위인가?

mycobot_280 mycobot_320

 

atom 버튼 누르면 release_all_servos() 를 실행하고

damping 모드 되어있으면 팔이 떨어지진 않을것 같으니 원하는대로 옮기고

atom 버튼 떼면

get_angles() 나 get_coords() 해서 좌표 받고, power_on() 해서 서보 고정하고 끝.. 하면 좀 편하게 되려나?

### 1. System Status
#### `get_modify_version()`
#### `clear_queue()`
#### `check_async_or_sync()`
#### `get_system_version()`
#### `get_basic_version()`
#### `get_error_information()`
#### `clear_error_information()`
#### `get_reboot_count()`

### 2. Overall Status
#### `power_on()`
#### `power_off()`
#### `is_power_on()`
#### `release_all_servos()`
#### `focus_servo(servo_id)`
#### `is_controller_connected()`
#### `read_next_error()`
#### `get_fresh_mode()`
#### `set_fresh_mode()`
#### `set_free_mode()`
#### `is_free_mode()`
#### `focus_all_servos()`
#### `set_vision_mode()`

### 3.MDI Mode and Operation
#### `get_angles()`
#### `get_angles_plan()`
#### `send_angle(id, degree, speed)`
#### `send_angles(angles, speed)`
#### `get_coords()`
#### `get_coords_plan()`
#### `send_coord(id, coord, speed)`
#### `send_coords(coords, speed, mode)`
#### `pause()`
#### `sync_send_angles(angles, speed, timeout=15)`
#### `sync_send_coords(coords, speed, mode=0, timeout=15)`
#### `get_angles_coords()`
#### `is_paused()`
#### `resume()`
#### `stop()`
#### `is_in_position(data, flag)`
#### `is_moving()`
#### `angles_to_coords(angles)`
#### `solve_inv_kinematics(target_coords, current_angles)`
#### `drag_start_record()`
#### `drag_end_record()`
#### `drag_get_record_data()`
#### `drag_get_record_len()`
#### `drag_clear_record_data()`

### 4. JOG Mode and Operation
#### `jog_angle(joint_id, direction, speed)`
#### `jog_coord(coord_id, direction, speed)`
#### `jog_rpy(end_direction, direction, speed)`
#### `jog_increment_angle(joint_id, increment, speed)`
#### `jog_increment_coord(id, increment, speed)`
#### `set_encoder(joint_id, encoder, speed)`
#### `get_encoder(joint_id)`
#### `set_encoders(encoders, speed)`
#### `get_encoders()`

### 5. Running status and Settings
#### `get_joint_min_angle(joint_id)`
#### `get_joint_max_angle(joint_id)`
#### `set_joint_min(id, angle)`
#### `set_joint_max(id, angle)`

### 6. Joint motor control
#### `is_servo_enable(servo_id)`
#### `is_all_servo_enable()`
#### `set_servo_calibration(servo_id)`
#### `release_servo(servo_id)`
#### `focus_servo(servo_id)`
#### `set_servo_data(servo_id, data_id,  value, mode=None)`
#### `get_servo_data(servo_id, data_id, mode=None)`
#### `joint_brake(joint_id)`

### 7. 9g Servo
#### `move_round()`
#### `set_four_pieces_zero()`

### 8. Servo state value
#### `get_servo_speeds()`
#### `get_servo_voltages()`
#### `get_servo_status()`
#### `get_servo_temps()`

### 9. Robotic arm end IO control
#### `set_color(r, g, b)`
#### `set_digital_output(pin_no, pin_signal)`
#### `get_digital_input(pin_no)`
#### `set_pin_mode(pin_no, pin_mode)`

### 10. Robotic arm end gripper control
#### `set_gripper_state(flag, speed, _type_1=None)`
#### `set_gripper_value(gripper_value, speed, gripper_type=None)`
#### `gripper_stop()`
#### `set_gripper_calibration()`
#### `is_gripper_moving()`
#### `get_gripper_value()`
#### `set_pwm_output(channel, frequency, pin_val)`
#### `set_HTS_gripper_torque(torque)`
#### `get_HTS_gripper_torque()`
#### `get_gripper_protect_current()`
#### `set_gripper_protect_current(current)`
#### `init_gripper()`

### 11. Set bottom IO input/output status
#### `set_basic_output(pin_no, pin_signal)`
#### `get_basic_input(pin_no)`

### 12. WLAN Setting
#### `set_ssid_pwd(account, password)`
#### `get_ssid_pwd()`
#### `set_server_port(port)`

### 13. TOF
#### `get_tof_distance()`

### 14. Communication mode
#### `set_transponder_mode(mode)`
#### `get_transponder_mode()`

### 15. Cartesian space coordinate parameter setting
#### `set_tool_reference(coords)`
#### `get_tool_reference(coords)`
#### `set_world_reference(coords)`
#### `get_world_reference()`
#### `set_reference_frame(rftype)`
#### `get_reference_frame()`
#### `set_movement_type(move_type)`
#### `get_movement_type()`
#### `set_end_type(end)`
#### `get_end_type()`

### 16. Raspberry pi -- GPIO
#### `gpio_init()`
#### `gpio_output(pin, v)`

### 17. utils (module)
#### `utils.get_port_list()`
#### `utils.detect_port_of_basic()`

[링크 : https://github.com/elephantrobotics/pymycobot/blob/main/docs/MyCobot_280_en.md]

    [링크 : https://github.com/elephantrobotics/pymycobot]

 

Gcode 읽어서 그거대로 움직이는 예제가 demo로 있다.

[링크 : https://github.com/elephantrobotics/pymycobot/tree/main/demo/myCobot_280_demo[

 

'embeded > robot' 카테고리의 다른 글

mycobot280_pi urdf  (0) 2026.06.22
블루로봇 밸런스 스테이지  (0) 2026.06.21
elephant robotics mycobot 280 pi python 예제  (0) 2026.06.16
유니버셜 로봇 polyscope 5  (0) 2026.06.16
로봇 tcp 확인  (0) 2025.04.25
Posted by 구차니

하.. 갈길이 멀다 ㅠㅠ

patchcore는 cudnn만 꺼주면 어떻게 되는데

stfpm은 소스가 문제라 .. -_-

~/src/moviad/main_scripts$ python3 main_stfpm.py --train --eval     --model_name mobilenet_v2     --categories bottle     --ad_layers 3 4 5     --boot_layer 2     --results_dirpath debug_outputs/metrics     --checkpoint_dir debug_outputs/checkpoints     --seeds 0 --epochs 3 --input_size 224 224     --device cuda:0
ERROR:root:micromind not found in current environment
Traceback (most recent call last):
  File "/home/falinux/src/moviad/main_scripts/main_stfpm.py", line 12, in <module>
    from moviad.trainers.trainer_stfpm import train_param_grid_search
ImportError: cannot import name 'train_param_grid_search' from 'moviad.trainers.trainer_stfpm' (/home/falinux/src/moviad/moviad/trainers/trainer_stfpm.py)

 

$ git log
commit 5d547292f3e1e4402b91d2950b884be74a37900f (HEAD -> main, origin/main, origin/HEAD)
Author: FrancescoBorsatti <francesco.borsatti.1@phd.unipd.it>
Date:   Mon Apr 13 18:16:40 2026 +0200

    update readme

 

괜히 verified가 붙은게 아닌듯. 저 버전으로는 내려가야 한다. merge 하다가 꼬인듯.

[링크 : https://github.com/AMCO-UniPD/moviad/blob/5bf4b63a89a860ab3d76679fffe35ee50225901d/moviad/trainers/trainer_stfpm.py] 없음

[링크 : https://github.com/AMCO-UniPD/moviad/blob/ec89d3e145615c9c1fbae69480f7da2eb4f9c606/moviad/trainers/trainer_stfpm.py] 있음(verified)

[링크 : https://github.com/AMCO-UniPD/moviad/blob/a209ec364aba6f5f33be010af948a578af4971ce/moviad/trainers/trainer_stfpm.py] 있음

 

+

아래 커밋으로 이동해버리고(!)

git checkout ec89d3e145615c9c1fbae69480f7da2eb4f9c606

 

실행하면 안된다!

정해진 경로에 넣으란거지? -_-+

~/src/moviad/main_scripts$ python3 main_stfpm.py --train --eval     --model_name mobilenet_v2     --categories bottle     --ad_layers 3 4 5     --boot_layer 2     --results_dirpath debug_outputs/metrics     --checkpoint_dir debug_outputs/checkpoints     --seeds 0 --epochs 3 --input_size 224 224     --device cuda:0
ERROR:root:micromind not found in current environment
Training with params: {'dataset_path': '../../datasets/mvtec/', 'categories': ['bottle'], 'ad_layers': [[3, 4, 5]], 'epochs': [3], 'seeds': [0], 'batch_size': 64, 'backbone_model_name': 'mobilenet_v2', 'device': device(type='cuda', index=0), 'img_input_size': [224, 224], 'img_output_size': (224, 224), 'early_stopping': None, 'student_bootstrap_layer': [2], 'checkpoint_dir': 'debug_outputs/checkpoints', 'normalize_dataset': True, 'log_dirpath': None, 'contamination_ratio': None, 'test_dataset': False}
TRAIN | cat: bottle, ad_layers: [3, 4, 5], epochs: 3, seed: 0, early_stopping: None, bootstrap: 2
Traceback (most recent call last):
  File "/home/minimonk/src/moviad/main_scripts/main_stfpm.py", line 405, in <module>
    raise e
  File "/home/minimonk/src/moviad/main_scripts/main_stfpm.py", line 387, in <module>
    main(args)
  File "/home/minimonk/src/moviad/main_scripts/main_stfpm.py", line 86, in main
    trained_models_filepaths = train_param_grid_search(params)
  File "/home/minimonk/src/moviad/moviad/trainers/trainer_stfpm.py", line 321, in train_param_grid_search
    log, snapshot_path = train_param_grid_step(
  File "/home/minimonk/src/moviad/moviad/trainers/trainer_stfpm.py", line 209, in train_param_grid_step
    train_dataset.load_dataset()
  File "/home/minimonk/src/moviad/moviad/datasets/mvtec/mvtec_dataset.py", line 175, in load_dataset
    raise RuntimeError(msg)
RuntimeError: Found 0 images in ../../datasets/mvtec/bottle
Posted by 구차니

/v1/chat/completions 통해서 문맥을 유지할때 어떻게 구현되나 했더니

llama-swap 에서 대화내용을 보니 이해된다.

assistant에 ai 대답을 넣는다고만 해서 복수개면 어떻게 하나 했는데

 

UI 상으로는 이렇게 나오고

 

로그 상으로는 아래와 같이 나온다

1번 째 질문 "하이하이"

 

2번 쩨 질문 "엉 왜 refused"

그리고 이전 대화를 messages의 배열에 순서대로 넣으면

가장 마지막 대화를 기준으로 답을 주게 되는걸려나?

당연(?) 하지만 reasoning은 빼고 순수 응답 내용만 assistant에 넣어서 보낸다.

'프로그램 사용 > ai 프로그램' 카테고리의 다른 글

local llm - mcp  (0) 2026.06.20
gemma4-e4b mtp..?  (0) 2026.06.18
openai api 변경에 따른 llama.cpp / llama-swap 리포트 차이  (0) 2026.06.18
llama-swap 버전 업데이트!  (0) 2026.06.18
stable diffusion --device-id  (0) 2026.06.18
Posted by 구차니