blob: 43707b4bd55921c5e86cd60ae80cb6f7e9052aec [file] [log] [blame]
James Kuszmaulfb0e0ae2014-03-25 07:04:47 -07001#ifndef FRC971_CONTROL_LOOPS_COERCE_GOAL_H_
2#define FRC971_CONTROL_LOOPS_COERCE_GOAL_H_
3
4#include "Eigen/Dense"
5
6#include "aos/controls/polytope.h"
7
8namespace frc971 {
9namespace control_loops {
10
11// Intersects a line with a region, and finds the closest point to R.
12// Finds a point that is closest to R inside the region, and on the line
13// defined by K X = w. If it is not possible to find a point on the line,
14// finds a point that is inside the region and closest to the line.
15Eigen::Matrix<double, 2, 1> CoerceGoal(aos::controls::HPolytope<2> &region,
16 const Eigen::Matrix<double, 1, 2> &K,
17 double w,
18 const Eigen::Matrix<double, 2, 1> &R);
19
20} // namespace control_loops
21} // namespace frc971
22
23#endif // FRC971_CONTROL_LOOPS_COERCE_GOAL_H_