moukle / LegoSortMachine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

README

This README provides instructions for setting up and using the BrickScanner project for the LEGO sorting machine.

Requirements

Files

Before starting, make sure you have the following files and directories:

To set up the necessary files and directories, follow these steps:

# Clone the BrickScanner repository
git clone https://github.com/flowmeadow/BrickScanner

# or our fork...
git clone https://github.com/moukle/BrickScanner BrickScanner2

# Download STLs.zip and unzip it
unzip STLs.zip

# Copy the base_obb_data.pkl file
cp BrickScanner/resources/base_obb_data.pkl ./data

Docker

A Docker image is provided with the necessary dependencies already installed and set up. We use x11docker to handle graphical outputs.

Usage

Follow the steps below to build and run the BrickScanner project.

  1. Build: to build the image, run the following command:

    docker buildx build --tag lego .
  2. Run:

    • with GUI (recommended)
      x11docker --interactive --webcam \
          -- \
          "-v $(pwd)/BrickScanner:/lego/src \
          -v $(pwd)/stl:/lego/stl \
          -v $(pwd)/data:/lego/data \
          -v $(pwd)/images:/lego/images" \
          lego bash
    • without GUI (cams not tested...)
      docker-compose run --rm --build scanner 

    After running the above command, you will have an interactive shell inside the Docker container. From there, you can run the provided scripts, such as real_recon.py, as follows:

    ./real_recon.py

    This should produce an output similar to this:

NOTE: all directories are mounted as VOLUME which means all changes on the host will be directly reflected inside the container and vice versa.

Cameras

If you have cameras, make sure they are mounted under /dev/video#. By default, the StereoCam class assumes camera indices 0 and 2. Adjust these indices based on your camera setup. You can use the command mpv /dev/video# to determine the correct indices for your cameras.

About


Languages

Language:Dockerfile 100.0%