Skip to content

titan2022/Titan-Processing

Repository files navigation

Titan Processing

Building

Running locally in a Conda environment

Installing the Conda environment

First, please have Conda or Mamba installed on your computer. If it's not installed, please install Miniforge3, which includes Conda, Mamba and a conda-forge based Python environment. You can install Miniforge3 using the following command:

wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh
rm Miniforge3-$(uname)-$(uname -m).sh

Close and reopen your shell, and run:

# Prevent Conda from polluting your environment when you're not working on Conda-managed projects.
conda config --set auto_activate_base false

Now, you can use Conda to install the dependencies.

mamba env create -f environment.yml
mamba activate Titan-Processing

If you modify environment.yml, please run

mamba env update -f environment.yml

Occassionally, you should update all the packages to the latest versions:

mamba activate Titan-Processing
mamba update --all -c https://repo.prefix.dev/titan-forge

Building the library and examples

mamba activate Titan-Processing

mkdir build && cd build
export CC=clang
export CXX=clang++
export CXXFLAGS="-pthread"

# Debug/development builds:
cmake -B . -S .. -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DBUILD_EXAMPLES=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja
# Release builds:
cmake -B . -S .. -DBUILD_EXAMPLES=1 -GNinja

# Actually run the build
ninja

Linux (without Conda)

  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

About

Titan Robotics #2022 repository for reusable vision and networking code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •