Merge changes I50952a08,I3f1d1d1a
* changes:
Add superstructure control loop boiler plate
Convert y2014 to y2016, and get the drivetrain running.
diff --git a/.clang-format b/.clang-format
index 11973e3..510c427 100644
--- a/.clang-format
+++ b/.clang-format
@@ -1 +1,8 @@
-BasedOnStyle: 'google'
+---
+BasedOnStyle: Google
+---
+Language: Cpp
+# Force pointers to the type for C++.
+DerivePointerAlignment: false
+PointerAlignment: Right
+Standard: Cpp11
diff --git a/aos/common/logging/matrix_logging.h b/aos/common/logging/matrix_logging.h
index e763ed5..a915643 100644
--- a/aos/common/logging/matrix_logging.h
+++ b/aos/common/logging/matrix_logging.h
@@ -15,23 +15,30 @@
// Logs the contents of a matrix and a constant string.
// matrix must be an instance of an Eigen matrix (or something similar).
-#define LOG_MATRIX(level, message, matrix) \
- do { \
- static const ::std::string kAosLoggingMessage( \
- LOG_SOURCENAME ": " STRINGIFY(__LINE__) ": " message); \
- ::aos::logging::DoLogMatrixTemplated(level, kAosLoggingMessage, matrix); \
- /* so that GCC knows that it won't return */ \
- if (level == FATAL) { \
- ::aos::Die("DoLogStruct(FATAL) fell through!!!!!\n"); \
- } \
+#define LOG_MATRIX(level, message, matrix) \
+ do { \
+ static const ::std::string kAosLoggingMessage( \
+ LOG_SOURCENAME ": " STRINGIFY(__LINE__) ": " message); \
+ ::aos::logging::DoLogMatrixTemplated(level, kAosLoggingMessage, \
+ (matrix).eval()); \
+ /* so that GCC knows that it won't return */ \
+ if (level == FATAL) { \
+ ::aos::Die("DoLogStruct(FATAL) fell through!!!!!\n"); \
+ } \
} while (false)
template <class T>
void DoLogMatrixTemplated(log_level level, const ::std::string &message,
const T &matrix) {
- static_assert(!T::IsRowMajor, "we only handle column-major storage");
- internal::DoLogMatrix(level, message, TypeID<typename T::Scalar>::id,
- matrix.rows(), matrix.cols(), matrix.data(), 1);
+ if (T::IsRowMajor) {
+ typename T::Scalar data[matrix.rows() * matrix.cols()];
+ ::Eigen::Map<T>(data, matrix.rows(), matrix.cols()) = matrix;
+ internal::DoLogMatrix(level, message, TypeID<typename T::Scalar>::id,
+ matrix.rows(), matrix.cols(), data, 1);
+ } else {
+ internal::DoLogMatrix(level, message, TypeID<typename T::Scalar>::id,
+ matrix.rows(), matrix.cols(), matrix.data(), 1);
+ }
}
} // namespace logging
diff --git a/frc971/control_loops/python/BUILD b/frc971/control_loops/python/BUILD
index fa94d01..d172983 100644
--- a/frc971/control_loops/python/BUILD
+++ b/frc971/control_loops/python/BUILD
@@ -16,3 +16,13 @@
'//third_party/cddlib:_cddlib.so',
],
)
+
+py_test(
+ name = 'polytope_test',
+ srcs = [
+ 'polytope_test.py',
+ ],
+ deps = [
+ ':controls',
+ ],
+)
diff --git a/frc971/control_loops/python/polytope_test.py b/frc971/control_loops/python/polytope_test.py
index 9a35ebe..51bf6fd 100755
--- a/frc971/control_loops/python/polytope_test.py
+++ b/frc971/control_loops/python/polytope_test.py
@@ -2,9 +2,10 @@
import numpy
from numpy.testing import *
-import polytope
import unittest
+import frc971.control_loops.python.polytope as polytope
+
__author__ = 'Austin Schuh (austin.linux@gmail.com)'
def MakePoint(*args):