How jyjblrd/low-cost-mocap works
Main Components
• Frontend (User Interface):
• Located in the computer_code directory, mainly under src (with React components written in TypeScript such as App.tsx, CameraWireframe.tsx, Toolbar.tsx, etc.).
• This layer provides the interactive dashboard through which users can view motion capture data, trajectory planning, and charts.
• Backend / API Server:
• The Python code in computer_code/api (e.g., index.py, KalmanFilter.py, LowPassFilter.py) processes camera inputs, performs motion capture computations, and serves the processed data to the frontend.
• It is started separately (using “python3 api/index.py”) and handles integration with external libraries (like pseyepy and OpenCV’s structure from motion module).
• Hardware & Firmware:
• Receiver and sender directories contain ESP32 Arduino code (.ino files) which likely interface with camera sensors or control data transmission between components.
• 3D Models / CAD Data:
• Found in the 3d_files directory, these components provide the physical design elements (for example, camera parts) used in building the hardware aspects of the system.
• External Dependencies:
• Integration with external libraries (pseyepy, OpenCV SFM) and infrastructure (the external YouTube demo and additional blog posts) as documented in the README.
Relationships and Data Flow
• Data Flow from Cameras to Processing:
• API Interaction:
• The backend receives and processes this streamed data (applying filters like Kalman and low-pass filters) then makes the processed data available to the UI.
• User Interaction:
• The frontend, built with modern web technologies (React/TypeScript), retrieves processed data from the API server (over RESTful endpoints or sockets, as hinted by the socket scripts in src/shared/styles/scripts/socket.ts) to update visualizations in real time.
• Hardware Design Feedback:
• The physical hardware (3D printed camera parts) might be iteratively designed and verified against system models, which can be annotated as a supporting component for overall system development.
Architectural Patterns/Design Principles
• Separation of Concerns:
• Clearly separate the presentation layer (React UI) from the application/business logic (Python API) and hardware control (ESP32 firmware).
• Modular Design:
• Each piece (frontend, backend, communication modules, and hardware) is implemented as a separate module, facilitating maintainability.
• Integration of Real-time Data:
• Emphasis on real-time data processing and communication between modules, potentially using websockets (as seen in the scripts for socket communications) and standard RESTful API endpoints.
• Dependency Management:
• Within the Application Logic, add sub-components for data processing (filter modules, API endpoints) and note interactions with both the external camera streams and the UI.
• In the Hardware section, represent both the transmitter (sender_esp32) and receiver (receiver_esp32) units, linking these to the sensors/camera streams and noting any communication protocols used (wired/wireless).
• Optionally, include a layer showing how the 3D physical designs (from the 3d_files directory) feed into the hardware manufacturing process.