From ff475a667d0f71ac40fca5604575a26380a76612 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Tue, 18 Jun 2024 23:41:58 -0700 Subject: [PATCH] Reduce macro usage in OptimalTrajectoryGenerator.cpp (#182) --- include/trajopt/OptimalTrajectoryGenerator.h | 1 - src/OptimalTrajectoryGenerator.cpp | 17 +++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/include/trajopt/OptimalTrajectoryGenerator.h b/include/trajopt/OptimalTrajectoryGenerator.h index 4b9cbc4d..62586954 100644 --- a/include/trajopt/OptimalTrajectoryGenerator.h +++ b/include/trajopt/OptimalTrajectoryGenerator.h @@ -8,7 +8,6 @@ #include "trajopt/SymbolExports.h" #include "trajopt/expected" -#include "trajopt/path/Path.h" #include "trajopt/path/SwervePathBuilder.h" #include "trajopt/solution/SwerveSolution.h" diff --git a/src/OptimalTrajectoryGenerator.cpp b/src/OptimalTrajectoryGenerator.cpp index 9f728811..79607886 100644 --- a/src/OptimalTrajectoryGenerator.cpp +++ b/src/OptimalTrajectoryGenerator.cpp @@ -2,29 +2,26 @@ #include "trajopt/OptimalTrajectoryGenerator.h" -#include - -#include "trajopt/expected" -#include "trajopt/path/SwervePathBuilder.h" - #if defined(OPTIMIZER_BACKEND_CASADI) #include "optimization/CasADiOpti.h" -#define _OPTI_BACKEND casadi::MX, CasADiOpti #elif defined(OPTIMIZER_BACKEND_SLEIPNIR) #include "optimization/SleipnirOpti.h" -#define _OPTI_BACKEND SleipnirExpr, SleipnirOpti #endif -#include "trajopt/drivetrain/SwerveDrivetrain.h" + #include "optimization/algorithms/SwerveDiscreteOptimal.h" -#include "trajopt/solution/SwerveSolution.h" namespace trajopt { expected OptimalTrajectoryGenerator::Generate( const SwervePathBuilder& path, bool diagnostics, int64_t handle) { - SwerveDiscreteOptimal<_OPTI_BACKEND> problem( +#if defined(OPTIMIZER_BACKEND_CASADI) + SwerveDiscreteOptimal problem( +#elif defined(OPTIMIZER_BACKEND_SLEIPNIR) + SwerveDiscreteOptimal problem( +#endif path.GetPath(), path.GetControlIntervalCounts(), path.CalculateInitialGuess(), handle); return problem.Generate(diagnostics); } + } // namespace trajopt