Skip to content

Library for generating time-optimal trajectories for FRC robots. Used by the HelixNavigator path planning app.

License

Notifications You must be signed in to change notification settings

Awesomeplayer165/TrajoptLib

 
 

Repository files navigation

TrajoptLib

Build C++ Documentation Discord

This library is used to generate time-optimal trajectories for FRC robots.

Trajectory Optimization

Trajectory optimization works by mathematically formulating the problem of travelling along a given path with the minimum possible time. The physical constraints of motor power capacity are applied along with waypoint constraints, which force the robot to begin and end a segment of the trajectory with a certain state. A mathematical solver must vary the position of the robot at each discrete timestamp to minimize total time.

Features

Trajopt

  • Currently only supports swerve drives with arbitray module configurations
  • Position and velocity constraints at each waypoint
  • Circle and polygon obstacle avoidance
  • Custom physical constraints of robot
  • Custom bumper shape

API

  • Java and C++ API with almost complete parity
  • CasADi dependencies bundled with Jar

Dependencies

  • C++20 compiler
    • On Windows, install Visual Studio Community 2022 and select the C++ programming language during installation
    • On Linux, install GCC 11 or greater via sudo apt install gcc
    • On macOS, install the Xcode command-line build tools via xcode-select --install. Xcode 13 or later is required.
  • CMake 3.24 or greater
    • On Windows, install from the link above
    • On Linux, install via sudo apt install cmake
    • On macOS, install via brew install cmake
  • Rust compiler
  • Sleipnir (optional backend)
  • CasADi (optional backend)
  • Catch2 (tests only)

Library dependencies which aren't installed locally will be automatically downloaded and built by CMake.

Build instructions

On Windows, open a Developer PowerShell. On Linux or macOS, open a Bash shell.

Clone the repository.

git clone [email protected]:SleipnirGroup/TrajoptLib
cd TrajoptLib

C++ library

# Configure with Sleipnir backend; automatically downloads library dependencies
cmake -B build -S . -DOPTIMIZER_BACKEND=sleipnir

# Configure with CasADi backend; automatically downloads library dependencies
cmake -B build -S . -DOPTIMIZER_BACKEND=casadi

# Build
cmake --build build

# Test
cd build
ctest
cd ..

# Install
cmake --install build --prefix pkgdir

The following build types can be specified via -DCMAKE_BUILD_TYPE during CMake configure:

  • Debug
    • Optimizations off
    • Debug symbols on
  • Release
    • Optimizations on
    • Debug symbols off
  • RelWithDebInfo (default)
    • Release build type, but with debug info
  • MinSizeRel
    • Minimum size release build

Rust library

cargo build --features sleipnir  # Sleipnir backend
cargo build --features casadi  # CasADi backend

About

Library for generating time-optimal trajectories for FRC robots. Used by the HelixNavigator path planning app.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 59.7%
  • NASL 19.2%
  • Rust 9.2%
  • CMake 8.6%
  • C 3.3%