diff --git a/doc/setup.md b/doc/setup.md index 513c810..accaddc 100644 --- a/doc/setup.md +++ b/doc/setup.md @@ -1,8 +1,8 @@ -# Setup +# Repo Setup Please see the section that pertains to your operating system below. -## Windows +### Windows Please install a recent version of Visual Studio Build Tools: https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022 @@ -16,7 +16,7 @@ cd ../.. pip install -r requirements.txt ``` -## Linux +### Linux Install python3.11. If you are on a Debian-based distribution and you cannot find that version of Python, you can try the deadsnakes ppa: https://askubuntu.com/questions/1398568/installing-python-who-is-deadsnakes-and-why-should-i-trust-them @@ -35,3 +35,8 @@ pip install -r requirements.txt wxPython wheel failure, try: https://wxpython.org/blog/2017-08-17-builds-for-linux-with-pip/index.html +# Detector Setup + +This system is intended to be used over a LAN connecting Raspberry Pi -based detector(s) and a main computer. The Raspberry Pi's run the src.main_detector, while the main computer runs the src.main_pose_solver and optionally the src.gui.gui module. + +To setup the Raspberry Pi -based detectors, run the setup/create_image.sh script on a compatible linux system. Flash the resulting image to a microSD card (or multiple) for use. diff --git a/setup/create_image.sh b/setup/create_image.sh new file mode 100755 index 0000000..9b2a906 --- /dev/null +++ b/setup/create_image.sh @@ -0,0 +1,116 @@ +#!/bin/bash + +# Setup script for custom Raspbian Lite image for Pi detectors + +# If this is your first time running this script and it does not work, try to download these dependencies +#apt-get install coreutils quilt parted qemu-user-static debootstrap zerofree zip \ +#dosfstools libarchive-tools libcap2-bin grep rsync xz-utils file git curl bc \ +#gpg pigz xxd arch-test + +# If it not your first time and it still doesn't work, try deleting the pi-gen directory first +# The below version clones the arm64 branch specfically because I have been building this on a Raspberry Pi 5 +# You might need to change this depending on your build system +git clone --branch arm64 https://github.com/RPI-Distro/pi-gen.git +pushd pi-gen +chmod +x build.sh + +# Start build process +SECONDS=0 +clean=false + +# NOTE: This config currently configures the detectors to have default user/pass and ssh open at first boot +# This is obviously a security risk on certain networks, be careful +cat > config < 00-run.sh < edited_requirements.txt +pip3 install --break-system-packages -r edited_requirements.txt +popd + +# Create startup script +cat > /usr/local/bin/startup << EOF +#!/bin/bash +sudo ufw allow 8001 +cd /home/pi/MCSTrack +source .venv/bin/activate +python -m src.main_detector +EOF + +chmod +x /usr/local/bin/startup + +# Schedule the script to run at boot +echo '@reboot root /usr/local/bin/startup >> startup_log.log' > /etc/cron.d/startup +CHROOT +RUN + +chmod +x 00-run.sh + +popd +popd # stage 02 + +# run build +if [ "$clean" = true ] ; then + echo "Running build with clean to rebuild last stage" + CLEAN=1 ./build.sh +else + echo "Running build" + ./build.sh +fi + +exitCode=$? + +duration=$SECONDS +echo "Build process completed in $(($duration / 60)) minutes" + +if [ $exitCode -ne 0 ]; then + echo "Custom Raspbian lite build failed with exit code ${exitCode}" ; exit -1 +fi + +ls ./deploy