Skip to content

Geoffrey-8814/BlackholeVision2

Repository files navigation

BlackholeVision2

A vision system


BlackholeVision Setup Guide

Step 1: Setup Your Device

  1. Install Ubuntu on your device.

Step 2: Install Conda

  1. Download and install Conda or Anaconda:
    👉 Download here
  2. Create a Python 3.11 environment:
    conda create -n blackhole_vision python=3.11

Step 3: Clone the Repository

  1. Open a terminal and run:
    git clone https://github.com/Geoffrey-8814/BlackholeVision2.git

Step 4: Install Required Libraries

  1. Install nano (text editor):
    sudo apt update
    sudo apt install nano
  2. Activate your Conda environment:
    conda activate blackhole_vision
  3. Navigate to the project directory:
    cd BlackholeVision2
  4. Install dependencies:
    pip install -r requirements.txt
  5. Install RobotPy (for FRC support):
    python3 -m pip install --extra-index-url=https://wpilib.jfrog.io/artifactory/api/pypi/wpilib-python-release-2025/simple robotpy
  6. Install PyTorch:
    • With CUDA 11.8:
      pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
    • With CUDA 12.6:
      pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
    • Without CUDA:
      pip3 install torch torchvision torchaudio

Step 5: Modify the Configuration File

  1. Open the config.json file in a text editor:

    nano config.json
  2. Modify the following fields:

    • Replace BlackholeVision with your device name.
    • Replace 10.12.34.2 with your roboRIO IP. Use the following format:
      • Team number 432110.43.21.2
      • Team number 1234510.123.45.2
  3. Save and exit (CTRL+X, then Y, then Enter).


Step 6: Setup USB Ports

1. Identify Camera USB Ports

  1. Connect a camera to your device.
  2. Run the following command to get the USB port details:
    udevadm info --name=/dev/video0 --attribute-walk
  3. Look for an ID that looks like /usb1/1-2/1-2.1/1-2.1:1.0.
  4. Extract the port ID (e.g., 1-2.1 from 1-2.1:1.0).

2. Create and Edit USB Rules

  1. Open the USB rules file:
    sudo nano /etc/udev/rules.d/99-usb-cameras.rules
  2. Add the following rule, replacing 1-2.1 with your port ID and PORTNAME with your desired name:
    SUBSYSTEM=="video4linux", KERNELS=="1-2.1", SYMLINK+="PORTNAME"
  3. Save and exit (CTRL+X, then Y, then Enter).

3. Apply the New Rules

sudo udevadm control --reload-rules

4. Verify the Assigned Port

ls -l /dev/PORTNAME
  • If a camera is detected, the port assignment is successful.
  • Repeat these steps for additional cameras.

Step 7: Run sudo Without Password

  1. Open a terminal and edit the sudoers file:
    sudo visudo
  2. Scroll to the bottom and add this line, replacing $USER with your actual username:
    $USER ALL=(ALL) NOPASSWD: ALL
  3. Save and exit (CTRL+X, then Y, then Enter).
  4. Open a new terminal and test:
    sudo visudo
    • If no password is required, the setup is successful.

Step 8: Create a Setup Script

  1. Open a terminal and create a script:

    nano ~/startBlackholeVision.sh
  2. Add the following lines:

    # Navigate to the project directory
    cd BlackholeVision2
    
    # Apply USB rules
    sudo udevadm trigger
    
    # Run the program (replace with your Conda Python path)
    /path/to/conda/envs/blackhole_vision/bin/python __init__.py
  3. Save and exit (CTRL+X, then Y, then Enter).

  4. Make the script executable:

    sudo chmod +x ~/startBlackholeVision.sh

Step 9: Add BlackholeVision to Startup Applications

  1. Open Startup Applications on Ubuntu.
  2. Click Add.
  3. Enter the command:
    ./startBlackholeVision.sh
  4. Click Add to confirm.

Step 10: Enable Automatic Login

Follow this guide or:

  1. Open Settings > System.
  2. Select Users.
  3. Click Unlock (top-right corner) and enter your password.
  4. Select the user account you want to log in automatically.
  5. Enable Automatic Login.

🚀 Setup Complete! Now your BlackholeVision system will start automatically upon boot. 🚀

About

A FRC vision system

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages