/Titan-Processing

Titan Robotics #2022 repository for reusable vision and networking code

Primary LanguageC++MIT LicenseMIT

Titan Processing

Building

Linux

  1. Install OpenCV 4.8.x or above with Aruco contrib module, and Python support if using calibration.py
  2. Install nlohmann/json using vcpkg. If you want to install vcpkg using our binaries, do:
curl -OL https://github.com/ethanc8/titanian-repo/raw/master/debian/pool/main/v/vcpkg/vcpkg_2023.12.10-2+titan2022_amd64.deb
sudo apt install ./vcpkg_2023.12.10-2+titan2022_amd64.deb
vcpkg install nlohmann-json
  1. Run to generate Makefile and link vcpkg with CMake
mkdir build && cd build
cmake -B . -S .. -DCMAKE_TOOLCHAIN_FILE=[PATH TO VCPKG]/scripts/buildsystems/vcpkg.cmake -DBUILD_EXAMPLES=1

# Production builds:
cmake -B . -S .. -DCMAKE_TOOLCHAIN_FILE=/opt/vcpkg/scripts/buildsystems/vcpkg.cmake -DBUILD_EXAMPLES=1

# Development builds:
cmake -B . -S .. -DCMAKE_TOOLCHAIN_FILE=/opt/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DBUILD_EXAMPLES=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja
  • If you want to use clangd in your IDE, add -DCMAKE_EXPORT_COMPILE_COMMANDS=1 to the end of the CMake commands
  • Also works with Ninja build system
  1. Run make -j to build
  2. Done! Example binaries generated in /bin

Build options

  • -DBUILD_EXAMPLES: builds example files (found in example/ folder)
  • -DNO_REALSENSE: builds without RealSense code for compatiblity

Config

  • ip, port: UDP server IP/port
  • threads: threads per camera stream
  • quadDecimate: n/a
  • quadSigma: n/a
  • decodeSharpening: n/a
  • cameras
    • name: keyword that will be matched when selecting camera stream
    • width, height, fps, exposure: stream parameters (Camset is helpful)
    • Everything else is generated by calibration.py
  • apriltags
    • id: id
    • position: field position in meters
    • rotation: field rotation in degrees
    • size: Apriltag size in meters

Other tools

  • Camset
    • Quick way to calibrate OpenCV camera parameters
  • calibration.py
    • Calibrating camera matrix and distortion coefficients
    • Use ChArUco board generator and print it
    • Take pictures with [space] (best to try multiple angles, 20+ photos)
  • Java networking server example
    • UDP server for networking values
    • All types implimented

Deploying to production

The deployment scripts assume a computer running Debian Bookworm, with Titan-Processing already built and its source code in /home/titan/Projects/Titan-Processing, with username titan and a password which you may find in the scripts.

# Set up pushes to the Orange Pi at 10.0.0.159, and create a git remote called orangepi
./scripts/host-orangepi/set-up-push.sh orangepi 10.0.0.159
# Push the current HEAD to the Orange Pi's branch __titan_deployment_staging and build
./scripts/host-orangepi/push-build.sh orangepi 10.0.0.159
# Autostart the example `detect_headless`
./scripts/host-orangepi/autostart.sh orangepi 10.0.0.159
# Reboot the Orange Pi so that the autostart goes into effect
./scripts/host-orangepi/reboot.sh orangepi 10.0.0.159
# Show the log for the titan2022-apriltag.service
./scripts/host-orangepi/log.sh orangepi 10.0.0.159
# Disable autostart and go back to the desktop
./scripts/host-orangepi/no-autostart.sh orangepi 10.0.0.159