mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
[wpimath] Upgrade to Drake v0.34.0 (#3607)
This commit is contained in:
28
upstream_utils/drake-dllexport-dare.patch
Normal file
28
upstream_utils/drake-dllexport-dare.patch
Normal file
@@ -0,0 +1,28 @@
|
||||
diff --git b/wpimath/src/main/native/include/drake/math/discrete_algebraic_riccati_equation.h a/wpimath/src/main/native/include/drake/math/discrete_algebraic_riccati_equation.h
|
||||
index cb0a4ee13..5d7a316f3 100644
|
||||
--- b/wpimath/src/main/native/include/drake/math/discrete_algebraic_riccati_equation.h
|
||||
+++ a/wpimath/src/main/native/include/drake/math/discrete_algebraic_riccati_equation.h
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <cstdlib>
|
||||
|
||||
#include <Eigen/Core>
|
||||
+#include <wpi/SymbolExports.h>
|
||||
|
||||
namespace drake {
|
||||
namespace math {
|
||||
@@ -20,6 +21,7 @@ namespace math {
|
||||
/// "On the Numerical Solution of the Discrete-Time Algebraic Riccati Equation"
|
||||
/// by Thrasyvoulos Pappas, Alan J. Laub, and Nils R. Sandell
|
||||
///
|
||||
+WPILIB_DLLEXPORT
|
||||
Eigen::MatrixXd DiscreteAlgebraicRiccatiEquation(
|
||||
const Eigen::Ref<const Eigen::MatrixXd>& A,
|
||||
const Eigen::Ref<const Eigen::MatrixXd>& B,
|
||||
@@ -69,6 +71,7 @@ Eigen::MatrixXd DiscreteAlgebraicRiccatiEquation(
|
||||
/// @throws std::runtime_error if Q − NR⁻¹Nᵀ is not positive semi-definite.
|
||||
/// @throws std::runtime_error if R is not positive definite.
|
||||
///
|
||||
+WPILIB_DLLEXPORT
|
||||
Eigen::MatrixXd DiscreteAlgebraicRiccatiEquation(
|
||||
const Eigen::Ref<const Eigen::MatrixXd>& A,
|
||||
const Eigen::Ref<const Eigen::MatrixXd>& B,
|
||||
@@ -8,7 +8,7 @@ from upstream_utils import setup_upstream_repo, comment_out_invalid_includes, wa
|
||||
|
||||
def main():
|
||||
root, repo = setup_upstream_repo("https://github.com/RobotLocomotion/drake",
|
||||
"v0.33.0")
|
||||
"v0.34.0")
|
||||
wpimath = os.path.join(root, "wpimath")
|
||||
|
||||
# Delete old install
|
||||
@@ -61,7 +61,10 @@ def main():
|
||||
os.path.join(wpimath, "src/test/native/include")
|
||||
])
|
||||
|
||||
apply_patches(root, ["upstream_utils/drake-replace-dense-with-core.patch"])
|
||||
apply_patches(root, [
|
||||
"upstream_utils/drake-dllexport-dare.patch",
|
||||
"upstream_utils/drake-replace-dense-with-core.patch"
|
||||
])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -88,6 +88,14 @@ namespace internal {
|
||||
// Report an assertion failure; will either Abort(...) or throw.
|
||||
[[noreturn]] void AssertionFailed(const char* condition, const char* func,
|
||||
const char* file, int line);
|
||||
template <bool>
|
||||
constexpr void DrakeAssertWasUsedWithRawPointer() {}
|
||||
template<>
|
||||
[[deprecated("\nDRAKE DEPRECATED: When using DRAKE_ASSERT or DRAKE_DEMAND on"
|
||||
" a raw pointer, always write out DRAKE_ASSERT(foo != nullptr), do not write"
|
||||
" DRAKE_ASSERT(foo) and rely on implicit pointer-to-bool conversion."
|
||||
"\nThe deprecated code will be removed from Drake on or after 2021-12-01.")]]
|
||||
constexpr void DrakeAssertWasUsedWithRawPointer<true>() {}
|
||||
} // namespace internal
|
||||
namespace assert {
|
||||
// Allows for specialization of how to bool-convert Conditions used in
|
||||
@@ -114,6 +122,8 @@ struct ConditionTraits {
|
||||
typedef ::drake::assert::ConditionTraits< \
|
||||
typename std::remove_cv_t<decltype(condition)>> Trait; \
|
||||
static_assert(Trait::is_valid, "Condition should be bool-convertible."); \
|
||||
::drake::internal::DrakeAssertWasUsedWithRawPointer< \
|
||||
std::is_pointer_v<decltype(condition)>>(); \
|
||||
if (!Trait::Evaluate(condition)) { \
|
||||
::drake::internal::AssertionFailed( \
|
||||
#condition, __func__, __FILE__, __LINE__); \
|
||||
@@ -139,10 +149,14 @@ namespace drake {
|
||||
constexpr bool kDrakeAssertIsArmed = false;
|
||||
constexpr bool kDrakeAssertIsDisarmed = true;
|
||||
} // namespace drake
|
||||
# define DRAKE_ASSERT(condition) static_assert( \
|
||||
::drake::assert::ConditionTraits< \
|
||||
typename std::remove_cv_t<decltype(condition)>>::is_valid, \
|
||||
"Condition should be bool-convertible.");
|
||||
# define DRAKE_ASSERT(condition) do { \
|
||||
static_assert( \
|
||||
::drake::assert::ConditionTraits< \
|
||||
typename std::remove_cv_t<decltype(condition)>>::is_valid, \
|
||||
"Condition should be bool-convertible."); \
|
||||
::drake::internal::DrakeAssertWasUsedWithRawPointer< \
|
||||
std::is_pointer_v<decltype(condition)>>(); \
|
||||
} while (0)
|
||||
# define DRAKE_ASSERT_VOID(expression) static_assert( \
|
||||
std::is_convertible_v<decltype(expression), void>, \
|
||||
"Expression should be void.")
|
||||
|
||||
Reference in New Issue
Block a user