Giter Club home page Giter Club logo

altro's Introduction

altro

A Fast Solver for Constrained Trajectory Optimization

Installation

CMake FetchContent

One of the best modern ways to include a dependency in a CMake project is through the FetchContent module. To bring altro into your CMake project, add these lines into your CMakeLists.txt file:

list(APPEND CMAKE_MESSAGE_CONTEXT altro)
FetchContent_Declare(altro
  GIT_REPOSITORY https://github.com/bjack205/altro
  GIT_TAG 9819e66a6d20daf39e23bd9b45444b7f5aeb3322 
  )
FetchContent_MakeAvailable(altro)
list(POP_BACK CMAKE_MESSAGE_CONTEXT)

Then link against the altro::altro target, same as if you had brought it in via find_package (described below). Note that this clones the repo into your build folder and builds all of the altro targets as part of your CMake project, ensuring uniform compilation and dependency management. Note this will also bring in the Eigen and fmt libraries (also through FetchContent).

CMake Install

To install altro locally onto your computer, simply build the install CMake target:

git clone https://github.com/bjack205/altro
cd altro
mkdir build
cd build   # TIP: you can shortcut these two with `take build` with zsh
cmake -D BUILD_SHARED_LIBS=ON -D CMAKE_INSTALL_PREFIX=/desired/install/location ..
cmake --build . -j4
cmake --install .

If the --prefix flag is left off (or CMAKE_INSTALL_PREFIX is unset), it will install to /opt/rexlab/altro by default.

To use the installed version, use the find_package command. Here's a minimal working example:

cmake_minimum_required(VERSION 3.19)
project(AltroCMakeExample)

find_package(altro 0.1 REQUIRED)
find_package(fmt REQUIRED)

add_executable(main main.cpp)
target_link_libraries(main PRIVATE altro::altro fmt::fmt Eigen3::Eigen)

Note that altro internally uses the fmt and Eigen libraries. To link against the same versions used by altro, use the fmt::fmt and Eigen3::Eigen targets brought in automatically when importing altro.

Also note that CMAKE_PREFIX_PATH should be set to whatever directory you used in the install.

Arduino

This shows how to compile the code to use on a Teensy microcontroller.

  1. Install Arduino CLI
cd ~/.local
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
  1. Change directory back to altro root
cd <altro/root/directory>
  1. Install Teensy Arduino libraries and Teensy rules
sudo cp resources/00-teensy.rules /etc/udev/rules.d/
arduino-cli core install teensy:avr --additional-urls https://www.pjrc.com/teensy/td_156/package_teensy_index.json
  1. If needed, add yourself to the dialout and tty groups
sudo usermod -a -G tty $USER 
sudo usermod -a -G dialout $USER 

altro's People

Contributors

bjack205 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.