- sm_SPS 이벤트 핸들러에서 장치 연결 및 상태 전송을 비동기로 처리
- DeviceConnectionWorker 스레드로 장치 연결 분리
- SPS(1초), Running(2초) 타임아웃 보호 추가
- 상태머신 모니터링 디버그 창 추가 (fStateMachineDebug)
- F11/F12 단축키로 스레드 덤프 및 디버그 브레이크 지원
- RaiseMessage 이벤트 비동기 처리로 로그 블로킹 방지
상태머신에서 장치 연결(AGV, XBee, BMS)이 메인 루프를 블로킹하는 문제 해결
주요 변경사항:
- DeviceConnectionWorker: 별도 쓰레드에서 장치 연결 처리
- StartDeviceConnectionThread: 쓰레드 시작 로직
- StopDeviceConnectionThread: 프로그램 종료 시 안전한 쓰레드 종료
- sm_SPS: 연결 로직 제거, 쓰레드 시작만 담당
- __Closing: 프로그램 종료 시 쓰레드 종료 호출
이점:
- 장치 연결 중 상태머신 블로킹 방지
- 1초 간격으로 비동기 연결 시도
- 프로그램 종료 시 안전한 쓰레드 정리
파일:
- StateMachine/_SPS.cs: 쓰레드 로직 추가
- fMain.cs: 종료 시 쓰레드 정리
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- 맵 에디터 메인폼 UI 개선
- AGV 캔버스 컨트롤 수정
- 설정 파일 업데이트
- 상태머신 AGV 로직 조정
- 자동 모드 화면 개선
- 메인폼 디자이너 및 로직 수정
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
## 신규 기능
- ACS(중앙제어시스템) 시뮬레이터 프로젝트 생성
- 8가지 AGV 제어 명령어 지원:
* SetCurrent: 현재 위치 설정
* Goto: RFID 이동
* GotoAlias: 별칭 이동 (v1.1.0)
* Stop: 정지
* Reset: 에러 리셋
* Manual: 수동 제어
* MarkStop: 마크센서 정지
* LiftControl: 리프트 제어
## AGV 상태 실시간 표시 (v1.3.0)
- AGV 상태 그룹박스 추가 (8가지 상태 정보)
- Status 메시지(cmd=3) 자동 수신 및 UI 업데이트
- 상태별 색상 표시로 직관적 모니터링
## 설정 관리
- 실행 폴더에 JSON 형식 설정 파일 저장 (v1.4.0)
- COM 포트, 보레이트, RFID, 별칭, AGV 선택 자동 저장
- 설정 파일 직접 편집 가능
## 기술 스택
- .NET Framework 4.8
- ENIGProtocol 프로젝트 참조
- RS232/Xbee 통신
- Newtonsoft.Json
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add motor/magnet/speed enums and AGVCommand class for AGV control
- Implement Predict() method for next action prediction based on path and state
- Add RFID position tracking (requires 2 RFIDs for position confirmation)
- Add SetPath() method to VirtualAGV for path management
- Implement GetCommandFromPath() to extract motor/magnet/speed from DetailedPath
- Add real-time prediction display in SimulatorForm (timer1_Tick)
- Support automatic forward movement at low speed when position unconfirmed
- Support stop command when destination reached or no destination set
Key Features:
- Position unconfirmed (RFID < 2): Forward + Straight + Low speed
- Position confirmed + no destination: Stop (position found)
- Position confirmed + destination reached: Stop (arrived)
- Path execution: Motor/Magnet/Speed from DetailedPath NodeMotorInfo
- Rotation nodes: Automatic low speed
- Junction handling: Magnet direction (Left/Right/Straight)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add ghost rendering at original position during node drag
- Implement real-time drag preview with Update() for immediate rendering
- Add visual feedback: shadow effects, cyan borders, pulse animations
- Improve pan movement accuracy with zoom level compensation (PointF precision)
- Add mouse capture for stable drag operations
- Fix coordinate precision loss by changing _panOffset from Point to PointF
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
MapNode.cs:
- Padding 속성 추가 (기본값 8px, 텍스트 주변 여백)
- Clone 메서드에 Padding 복사 추가
NodePropertyWrapper.cs:
- LabelNodePropertyWrapper에 Padding 속성 추가
- PropertyGrid에서 0~50px 범위로 조정 가능
UnifiedAGVCanvas.Events.cs:
- DrawLabelNode: 하드코딩된 패딩을 node.Padding 사용
- GetNodeBrush: RFID 없는 노드를 회색 계통으로 표시
* Normal: Blue → LightGray
* Rotation: Orange → DarkGray
* Docking: Green → Gray
* Charging: Red → Silver
UnifiedAGVCanvas.Mouse.cs:
- HandleLabelNodeDoubleClick: node.Name → node.LabelText 사용
이제 라벨 노드 패딩을 속성창에서 조정 가능하고,
RFID 미할당 노드를 시각적으로 쉽게 구분 가능
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
노드 타입별 더블클릭 액션 구현:
UnifiedAGVCanvas.Mouse.cs:
- MouseDoubleClick 핸들러 수정 - 노드 타입별 분기 처리
- HandleNormalNodeDoubleClick() 추가 - RFID 입력 InputBox 표시
- HandleLabelNodeDoubleClick() 추가 - 라벨 텍스트 입력 InputBox 표시
- HandleImageNodeDoubleClick() 추가 - ImageNodeDoubleClicked 이벤트 발생
UnifiedAGVCanvas.cs:
- ImageNodeDoubleClicked 이벤트 정의 추가
MainForm.cs:
- OnImageNodeDoubleClicked 이벤트 핸들러 추가
- 이미지 편집창(ImageEditorForm) 자동 표시
AGVNavigationCore.csproj:
- Microsoft.VisualBasic 참조 추가 (InputBox 사용)
이제 노드 더블클릭 시:
- 일반노드(Normal/Rotation/Docking/Charging): RFID 입력창 표시
- 라벨노드: 텍스트 입력창 표시
- 이미지노드: 이미지 편집창 자동 표시
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
UnifiedAGVCanvas.Mouse.cs 수정 내용:
- MouseClick switch문에 AddLabel, AddImage case 추가
- HandleAddLabelClick() 메서드 추가 (NodeType.Label 노드 생성)
- HandleAddImageClick() 메서드 추가 (NodeType.Image 노드 생성)
이제 라벨 추가 및 이미지 추가 드롭다운 메뉴를 선택하고 맵을 클릭하면
해당 위치에 라벨/이미지 노드가 정상적으로 생성됩니다.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
btnAddNode가 ToolStripSplitButton으로 변경되면서 이벤트 처리 수정:
- btnAddNode: Click → ButtonClick 이벤트 사용
- btnAddLabel, btnAddImage: 드롭다운 항목으로 Click 이벤트 유지
이제 노드 추가 버튼과 라벨/이미지 추가 드롭다운 메뉴가 정상 작동합니다.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Replaced Panel + Button controls with ToolStrip + ToolStripButton
- Unified toolbar design with toolStrip2 style
- Simplified WireToolbarButtonEvents() method
- Updated UpdateImageEditButton() and DisableImageEditButton() for ToolStripButton
- Image edit button now properly enables/disables based on selected node type
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
주요 변경사항:
- Graphics Transform 순서 수정 (Translate → Scale)
- ScreenToWorld/WorldToScreen 공식 통일
- 마우스 휠 줌 계산 수정
- FitToNodes, PanTo 계산 수정
- GetVisibleBounds 공식 수정
- 이제 줌 상태에서 노드 선택이 정확하게 작동
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
주요 변경사항:
- 그리드가 화면 전체를 덮도록 수정
- ScreenToWorld를 사용하여 정확한 월드 좌표 계산
- 스케일 표시를 동적으로 계산 (줌에 따라 변경)
- 스케일 정보를 별도 박스로 표시 (좌하단)
- 줌 정보와 스케일 정보 분리 표시
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
주요 변경사항:
- ProgressLogForm.Designer.cs 생성
- VS에서 레이아웃 편집 가능하도록 개선
- 고정 컨트롤을 디자이너 파일로 이동
- ProgressLogForm.cs 간소화
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
주요 변경사항:
- CleanupOrphanConnections() 함수 추가
- 저장 시 고아 연결 자동 정리
- 로드 시 고아 연결 자동 제거
- 경로 예측에서 삭제된 노드 연결 사용 방지
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
주요 변경사항:
- ConnectedMapNodes 속성 추가로 런타임 객체 참조 지원
- 이미지 에디터 UI 개선 (ImageEditorCanvas 추가)
- 연결 생성 버그 수정: 양방향 연결 생성
- 연결 삭제 버그 수정: 양방향 모두 제거
- CleanupDuplicateConnections 비활성화 (단방향 변환 버그)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add ProgressLogForm.cs for test result logging with ListView
- Implement real UI workflow simulation in path prediction test
- Test all connected node pairs to all docking targets
- Support CSV export for test results
- Keep List<string> ConnectedNodes structure (reverted List<MapNode> changes)
- Display RFID values in log for better readability
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
방향 유지 시 이전 노드로 되돌아가는 문제 수정
- 방향 유지(prevDirection == direction): 이전 노드 제외
- 방향 전환(prevDirection != direction): 모든 연결 노드 허용 (U-turn 가능)
수정 파일: DirectionalHelper.cs:61-73
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
마그넷 방향(Straight/Left/Right) 가중치 강화:
- Straight 보너스: 0.3 → 0.5
- 올바른 회전 보너스: 0.25 → 1.0
- 잘못된 회전 페널티: 0.2 → 0.8
이를 통해 GetNextNodeByDirection에서 마그넷 방향이 주요 결정 요소로 작동.
실제 경로 예측 정확도 개선 (Left 마그넷 방향 테스트: 100% 일치).
## 발견된 이슈 (다음 세션)
- 기본 내적(dot product) 차이가 큰 경우 (>1.0) 마그넷 보너스(+1.0)로 극복 못함
- 경로 계산 결과는 올바르지만, 검증 단계에서 다르게 평가되는 경우 존재
- 예: N022→N004→N011 경로, 마그넷 Right일 때
- 경로 생성: N011 선택 (내적 -0.1275, 마그넷 Right 일치)
- 검증 예측: N031 선택 (내적 0.9646, 마그넷 Right 일치)
- 원인: 내적 차이(1.0921) > 마그넷 보너스 효과(1.0)
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- Added detailed debug output to GetNextNodeByDirection() with:
- Initial node information (positions, movement vectors)
- All candidate nodes evaluation with step-by-step scoring
- Score calculations: base score → motor direction → magnet direction
- Final selection with best score
- Added detailed debug output to ValidateDockingDirection() with:
- Path validation stage information
- Expected vs actual next node comparison
- Movement vector analysis for mismatch debugging
- Success/failure status for each path segment
Debug output includes:
- Node IDs, RFIDs, positions, and vectors
- Normalized vectors and dot products
- Score progression through each bonus/penalty application
- Direction consistency analysis
- Final scoring results with selection indicators
This enables detailed tracing of path prediction and validation issues.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Added MagnetDirection parameter to GetNextNodeByDirection() function in DirectionalHelper
- Implemented ApplyMagnetDirectionBonus() helper method using vector cross product for turn direction detection
- Straight magnet direction: +0.3f bonus for consistent forward direction
- Left/Right magnet direction: +0.25f bonus for correct turn, -0.2f penalty for wrong turn direction
- Updated DockingValidator to pass actual magnet direction from DetailedPath
- Updated AGVPathfinder calls to use MagnetDirection.Straight as default during path planning phase
- Includes debug output for scoring decisions with magnet direction analysis
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
## Summary
- Changed Path property type from List<string> to List<MapNode> for better type safety
- Eliminated O(n) node lookups throughout pathfinding system
- Added DirectionalHelper with motor direction consistency bonus/penalty
- Updated all path processing to work with MapNode objects directly
## Files Modified
- AGVPathResult.cs: Path property and CreateSuccess() method signature
- AStarPathfinder.cs: Path generation and node lookup optimization
- AGVPathfinder.cs: Path processing with MapNode objects
- DirectionChangePlanner.cs: Direction change planning with MapNode paths
- DockingValidator.cs: Docking validation with direct node access
- UnifiedAGVCanvas.Events.cs: Path visualization with MapNode iteration
- UnifiedAGVCanvas.cs: Destination node access
- VirtualAGV.cs: Path conversion to string IDs for storage
- DirectionalHelper.cs: Enhanced with motor direction awareness
- NodeMotorInfo.cs: Updated for new path structure
## Benefits
- Performance: Eliminated O(n) lookup searches
- Type Safety: Compile-time checking for node properties
- Code Quality: Direct property access instead of repeated lookups
- Maintainability: Single source of truth for node data
## Build Status
✅ AGVNavigationCore: Build successful (0 errors, 2 warnings)
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
Path Direction Detection (AGVPathfinder.cs):
- Added GetNextNodeByDirection() method to determine next node based on Forward/Backward direction
- Implements vector-based angle calculation for intelligent node selection
- Forward: selects node in continuous direction
- Backward: selects node in opposite direction
- Validates if selected direction matches path requirements
Logic additions at line 150-167:
- Detects next node for Forward and Backward directions
- Checks if backward movement aligns with path's next node
- Returns path with appropriate motor direction (ReverseDirection when applicable)
Improved Path Visualization (UnifiedAGVCanvas.Events.cs):
- Refined equilateral triangle arrows (8 pixels, symmetric)
- 50% transparency for purple path lines with 2x thickness
- Bidirectional path detection (darker color for repeated segments)
- Better visual distinction for calculated paths
Technical Details:
- Added System.Drawing using statement for PointF operations
- Added DirectionalPathfinder initialization
- Vector normalization for angle-based decisions
- Dot product calculation for direction similarity scoring
Result: AGV can now intelligently select next node based on current movement direction and validate path feasibility
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Enhanced path drawing with better visibility:
1. Arrow improvements:
- Changed from line-based arrows to filled triangle shapes
- Increased arrow size by 1.5x for better visibility
- Added polygon fill with outline for clearer identification
2. Path line improvements:
- Added 50% transparency to purple path color (Alpha: 128)
- Increased line thickness by 2x (from 4 to 8 pixels)
- Improved visual contrast and clarity
3. Bidirectional path detection:
- Detect routes that traverse the same segment multiple times
- Display bidirectional paths with higher opacity (darker color, Alpha: 200)
- Visual distinction helps identify round-trip routes
Changes in UnifiedAGVCanvas.Events.cs:
- Modified DrawDirectionArrow() to use FillPolygon instead of DrawLine
- Enhanced DrawPath() with transparency, thickness, and bidirectional detection
- Added System.Collections.Generic using statement
Result: Much better visual identification of calculated paths in HMI
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Removed from AGVPathfinder.cs:
- ConvertToDetailedPath() - unused private method
- CalculatePathDistance() - unused private method
- ValidatePath() - unused public method
- ValidatePhysicalConstraints() - only called by ValidatePath (now removed)
- OptimizePath() - unused public method (TODO placeholder only)
- GetPathSummary() - unused public method (debug helper)
Kept essential methods:
- FindNearestJunction() - used by FindPath_test
- FindNearestJunctionOnPath() - used by FindPath_test
- MakeDetailData() - used by FindPath_test
- MakeMagnetDirection() - used by FindPath_test
Removed from VirtualAGV.cs:
- _targetId field - never used
- _currentId field - never used
- _rotationSpeed field - never used (read-only, no references)
Removed from UnifiedAGVCanvas.cs:
- AGVSelected event - unused
- AGVStateChanged event - unused
Result: Cleaner codebase, reduced technical debt, easier maintenance
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fixed critical issue in ConvertToDetailedPath where motor direction was not passed to GetRequiredMagnetDirection
- Motor direction is essential for backward movement as Left/Right directions must be inverted
- Modified AGVPathfinder.cs line 280 to pass currentDirection parameter
- Ensures backward motor direction properly inverts magnet sensor directions
feat: Add waypoint support to pathfinding system
- Added FindPath overload with params string[] waypointNodeIds in AStarPathfinder
- Supports sequential traversal through multiple intermediate nodes
- Validates waypoints and prevents duplicates in sequence
- Returns combined path result with aggregated metrics
feat: Implement path result merging with DetailedPath preservation
- Added CombineResults method in AStarPathfinder for intelligent path merging
- Automatically deduplicates nodes when last of previous path equals first of current
- Preserves DetailedPath information including motor and magnet directions
- Essential for multi-segment path operations
feat: Integrate magnet direction with motor direction awareness
- Modified JunctionAnalyzer.GetRequiredMagnetDirection to accept AgvDirection parameter
- Inverts Left/Right magnet directions when moving Backward
- Properly handles motor direction context throughout pathfinding
feat: Add automatic start node selection in simulator
- Added SetStartNodeToCombo method to SimulatorForm
- Automatically selects start node combo box when AGV position is set via RFID
- Improves UI usability and workflow efficiency
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fix grid line coordinate transformation (world to screen)
- Properly align grid with zoom and pan transformations
- Calculate grid start position at GRID_SIZE multiples
- Draw grid lines across entire visible canvas area
- Ensure grid lines render completely regardless of zoom level
- Grid now displays consistently at all zoom magnifications
Fixes: Grid no longer disappears or renders incompletely when zoomed in
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- Support middle mouse button (wheel) for map panning alongside left button
- Middle button drag always enables panning regardless of edit mode
- Change cursor to hand icon during middle button panning for clarity
- Left button panning remains unchanged (mode-dependent behavior preserved)
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- Fix ScreenToWorld coordinate transformation bug in wheel event
- Implement proper mouse cursor-centered zoom calculation
- Calculate world coordinates before zoom and maintain them after zoom
- Adjust pan offset to keep mouse cursor pointing at same world position
- Remove matrix-based transformation that was causing coordinate issues
Fixes: Wheel zoom now correctly centers on mouse cursor position and no longer causes erratic panning
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- Reorganized AGVMapEditor, AGVNavigationCore, AGVSimulator into AGVLogic folder
- Removed deleted project files from root folder tracking
- Updated CLAUDE.md with AGVLogic-specific development guidelines
- Clean separation of independent project development from main codebase
- Projects now ready for independent development and future integration
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- UnifiedAGVCanvas 마우스 휠 줌 로직 개선
- 마우스 커서 위치를 기준점으로 하는 정확한 줌 구현
- 줌 비율 1.2배 → 1.15배로 조정 (더 부드러운 동작)
- 스크린 좌표와 월드 좌표 변환을 명시적으로 처리
- 마우스 위치가 줌 전후 동일한 월드 좌표를 가리키도록 보장
개선 효과:
✅ 마우스 아래의 콘텐츠가 줌 중심
✅ 더 자연스럽고 예측 가능한 줌 동작
✅ 좌표 계산 로직 명확화
추가:
- PROJECT_SUMMARY.md: 3개 프로젝트 상세 요약
- AGVMapEditor (맵 편집 도구)
- AGVNavigationCore (경로 계산 엔진)
- AGVSimulator (시뮬레이터)
- UnifiedAGVCanvas 기능 설명
- 현재 미완성 부분 정리
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- AGVMapEditor/Models/MapData.cs 제거 (미사용)
- SubProject/AGVControl/Models/MapData.cs 제거 (레거시 코드)
- AGVMapEditor.csproj에서 MapData.cs 항목 제거
- AGVMapEditor/Forms/MainForm.cs에서 불필요한 using 제거
모든 맵 데이터 관리는 AGVNavigationCore.Models.MapLoader를 사용
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- 불필요한 AGVPathTester 프로젝트 제거
- 불필요한 PathLogic 프로젝트 제거
- AGVCSharp.sln에서 두 프로젝트 참조 제거
- 핵심 개발은 AGVNavigationCore에 집중
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- agv_path_planner.py: JSON 형식 맵 파일 지원 추가
* parse_map_json() 함수로 MapData.json/NewMap.agvmap 파싱
* RFID 정규화 및 별칭 지원 (007/7 등)
* TP(터닝포인트) 기반 방향전환 알고리즘 검증 완료
- universal_pathfinder.py: 범용 패턴 기반 경로 탐색
* Q1-1, Q1-2, Q2-1, Q2-2 모든 시나리오 패턴 구현
* UniversalPathFormatter 방향전환 표기 수정
* 28개 테스트 케이스 중 20개 성공 (71.4%)
- test_all_scenarios.py: 전체 테스트 케이스 검증 스크립트
* 4개 시나리오 × 7개 목표 = 28개 케이스 자동 검증
* 사용자 제공 정답과 비교 분석
- show_map_info.py: 맵 구조 분석 도구
* RFID 목록, 연결 정보, 갈림길 분석
* 노드 타입별 분류 및 통계
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>