Removed mallocs from polydrive code
Since most of the places where we create a polytope are just affine
transformations of another polytope, we can transform the original
vertices to avoid needing libcdd at runtime. This is in preparation
for the battlebot.
Change-Id: Ic35af2d918095dc23b90a4ab248d0c142cf3588a
diff --git a/frc971/control_loops/coerce_goal.h b/frc971/control_loops/coerce_goal.h
index 3933050..83c401d 100644
--- a/frc971/control_loops/coerce_goal.h
+++ b/frc971/control_loops/coerce_goal.h
@@ -8,21 +8,19 @@
namespace frc971 {
namespace control_loops {
-Eigen::Matrix<double, 2, 1> DoCoerceGoal(const aos::controls::HPolytope<2> ®ion,
- const Eigen::Matrix<double, 1, 2> &K,
- double w,
- const Eigen::Matrix<double, 2, 1> &R,
- bool *is_inside);
+Eigen::Matrix<double, 2, 1> DoCoerceGoal(
+ const aos::controls::HVPolytope<2, 4, 4> ®ion,
+ const Eigen::Matrix<double, 1, 2> &K, double w,
+ const Eigen::Matrix<double, 2, 1> &R, bool *is_inside);
// Intersects a line with a region, and finds the closest point to R.
// Finds a point that is closest to R inside the region, and on the line
// defined by K X = w. If it is not possible to find a point on the line,
// finds a point that is inside the region and closest to the line.
-static inline Eigen::Matrix<double, 2, 1>
- CoerceGoal(const aos::controls::HPolytope<2> ®ion,
- const Eigen::Matrix<double, 1, 2> &K,
- double w,
- const Eigen::Matrix<double, 2, 1> &R) {
+static inline Eigen::Matrix<double, 2, 1> CoerceGoal(
+ const aos::controls::HVPolytope<2, 4, 4> ®ion,
+ const Eigen::Matrix<double, 1, 2> &K, double w,
+ const Eigen::Matrix<double, 2, 1> &R) {
return DoCoerceGoal(region, K, w, R, nullptr);
}