diff --git a/robot_controller/robot_controller.ino b/robot_controller/robot_controller.ino index 82f0ad1..10e0ed7 100644 --- a/robot_controller/robot_controller.ino +++ b/robot_controller/robot_controller.ino @@ -2,6 +2,7 @@ #include #include #include +#include "trapezoidal.h" const float ACCEL_LIMIT = 4.0; // cm/s/s const float VEL_LIMIT = 16.0; // cm/s @@ -91,7 +92,7 @@ void loop() { Serial.println(""); // move on if at setpoint TODO: check that the error is low as well - if (setpoint.completed) { + if (setpoint.complete) { switch (robot_state) { case FORWARD: robot_state = TURN; diff --git a/robot_controller/trapezoidal.h b/robot_controller/trapezoidal.h new file mode 100644 index 0000000..78dcaa8 --- /dev/null +++ b/robot_controller/trapezoidal.h @@ -0,0 +1,14 @@ +#pragma once + +// unitless trapezoidal +struct Trapezoidal { + float max_vel; + float max_acc; + float dist; +}; + +struct Setpoint { + float velocity; // unitless + float position; // unitless + bool complete; // the setpoint will no longer change +}; diff --git a/robot_controller/trapezoidal.ino b/robot_controller/trapezoidal.ino index 87799bc..e0ab6e5 100644 --- a/robot_controller/trapezoidal.ino +++ b/robot_controller/trapezoidal.ino @@ -1,18 +1,6 @@ +#include "trapezoidal.h" // trapezoidal impl, not fuzzed -// unitless trapezoidal -struct Trapezoidal { - float max_vel; - float max_acc; - float dist; -}; - -struct Setpoint { - float velocity; // unitless - float position; // unitless - bool complete; // the setpoint will no longer change -}; - // returns the position and velocity at the given time on a trapezoidal motion plan // this could be baked if too computationally expensive // not fully fuzzed