-
Notifications
You must be signed in to change notification settings - Fork 15
Use cubic spline for initial guess #148
Use cubic spline for initial guess #148
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think this should manually copy in Eigen or wpimath....
Instead, after fetching Sleipnir, it could set the following then fetch allwpilib via FetchContent: set(USE_SYSTEM_EIGEN ON)
set(USE_SYSTEM_FMTLIB ON)
set(WITH_JAVA OFF)
set(WITH_CSCORE OFF)
set(WITH_NTCORE OFF)
set(WITH_WPIMATH ON)
set(WITH_WPILIB OFF)
set(WITH_TESTS OFF)
set(WITH_GUI OFF)
set(WITH_SIMULATION_MODULES OFF) |
I tried the thing I suggested, and WPILib's CMake setup is kinda broken. Here's the changes I had to make to WPILib: diff --git a/wpimath/CMakeLists.txt b/wpimath/CMakeLists.txt
index a22ffc0b8..c7a99729c 100644
--- a/wpimath/CMakeLists.txt
+++ b/wpimath/CMakeLists.txt
@@ -200,6 +200,7 @@ target_include_directories(
)
install(TARGETS wpimath EXPORT wpimath)
+export(TARGETS wpimath FILE wpimath.cmake NAMESPACE wpimath::)
configure_file(wpimath-config.cmake.in ${WPILIB_BINARY_DIR}/wpimath-config.cmake)
install(FILES ${WPILIB_BINARY_DIR}/wpimath-config.cmake DESTINATION share/wpimath)
diff --git a/wpiutil/CMakeLists.txt b/wpiutil/CMakeLists.txt
index 4caa3521b..e01203f6c 100644
--- a/wpiutil/CMakeLists.txt
+++ b/wpiutil/CMakeLists.txt
@@ -258,6 +258,7 @@ target_include_directories(
)
install(TARGETS wpiutil EXPORT wpiutil)
+export(TARGETS wpiutil FILE wpiutil.cmake NAMESPACE wpiutil::)
configure_file(wpiutil-config.cmake.in ${WPILIB_BINARY_DIR}/wpiutil-config.cmake)
install(FILES ${WPILIB_BINARY_DIR}/wpiutil-config.cmake DESTINATION share/wpiutil) Here's the TrajoptLib CMake changes: diff --git a/CMakeLists.txt b/CMakeLists.txt
index 02e4ad4..f952f55 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,9 @@ set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
)
+# Allow overriding options in parent projects
+cmake_policy(SET CMP0077 NEW)
+
project(TrajoptLib LANGUAGES CXX)
# Use, i.e. don't skip the full RPATH for the build tree
@@ -146,6 +149,25 @@ elseif(${OPTIMIZER_BACKEND} STREQUAL "sleipnir")
target_link_libraries(TrajoptLib PRIVATE Sleipnir)
endif()
+# wpimath dependency
+set(WITH_CSCORE OFF CACHE INTERNAL "With CSCore")
+set(WITH_GUI OFF CACHE INTERNAL "With GUI")
+set(WITH_JAVA OFF CACHE INTERNAL "With Java")
+set(WITH_NTCORE OFF CACHE INTERNAL "With NTCore")
+set(WITH_SIMULATION_MODULES OFF CACHE INTERNAL "With Simulation Modules")
+set(WITH_TESTS OFF CACHE INTERNAL "With Tests")
+set(WITH_WPIMATH ON CACHE INTERNAL "With WPIMath")
+set(WITH_WPILIB OFF CACHE INTERNAL "With WPILib")
+fetchcontent_declare(
+ wpilib
+ #GIT_REPOSITORY https://github.com/wpilibsuite/allwpilib.git
+ #GIT_TAG v2024.3.2
+ GIT_REPOSITORY file:///home/tav/frc/wpilib/allwpilib
+ GIT_TAG 9ffce38bf71b1a96c009fc7e46c79b3beb6468a9
+)
+fetchcontent_makeavailable(wpilib)
+target_link_libraries(TrajoptLib PRIVATE Eigen3::Eigen wpimath)
+
target_include_directories(
TrajoptLib
PUBLIC I changed the fetchcontent target to a |
Here's the cleanup PR: bruingineer#1 |
With regard to the merge conflicts, the linear initial guess generator moved to https://github.com/SleipnirGroup/TrajoptLib/blob/main/include/trajopt/util/GenerateLinearInitialGuess.hpp, so this PR can mirror that structure. |
TrajoptLib has moved to a subfolder within SleipnirGroup/Choreo. The changes here should be merged into SleipnirGroup/Choreo#478. |
use wpi spline generator to create the initial guess translation. heading is interpolated separately between each waypoint and initial guess point.