A script setup.sh
has been provided to install these dependencies on a Mac-based system. It will install Homebrew and use it to install these dependencies. To execute it, run chmod +x setup.sh && ./setup.sh
.
Linux support has not been added to the script yet.
TrajectoryOptimization can be easily used as a git submodule in any other CMake-based project. Let's walk through integrating TrajectoryOptimization into an existing source project.
- cd into your project directory,
git init
if it isn't already a git repository. mkdir -p lib && git submodule add [insert this project's clone URL (https/ssh)] lib/trajectoryOptimization
- If you don't already use CMake, run
touch CMakeLists.txt
. Insertcmake_minimum_required(VERSION 3.8)
as the first line. - Insert these into your
CMakeLists.txt
to import and link theTrajectoryOptimization::TrajectoryOptimizationLib
target:
add_subdirectory(lib/trajectoryOptimization)
add_executable([yourExecutableName] [yourSourceFiles])
target_link_libraries([yourExecutableName]
PUBLIC
TrajectoryOptimization::TrajectoryOptimizationLib
)
mkdir build && cd build && cmake ..
make
./[yourExecutableName]
Now you can build software using TrajectoryOptimization!
To ever recompile and rerun, just cd into build/
and run make && ./[yourExecutableName]
.
To build tests, run cmake like this: cmake -Dtraj_opt_build_tests=ON ..
. Then cd into lib/trajectoryOptimization
and run ctest
.
To build samples, run cmake like this: cmake -Dtraj_opt_build_samples=ON ..
. Then cd into lib/trajectoryOptimization
and run ./trajectoryOptimizationSample
. The sample currently optimizes a 3D trajectory. Inspect the source for more information and to learn about usage.
Mujoco support is currently baked into this project, but disabled.
To enable building/linking it:
- Uncomment the relevant lines in CMakeLists.txt that are marked for Mujoco.
- Copy this file to cmake/LocalProperties.cmake and replace the FIXME with the path to your Mujoco installation.