factored out header

This commit is contained in:
Andy Killorin 2025-12-06 14:47:00 -05:00
parent 99dc53a79f
commit b3c09c6047
Signed by: ank
GPG key ID: 23F9463ECB67FE8C
3 changed files with 17 additions and 14 deletions

View file

@ -2,6 +2,7 @@
#include <Wire.h> #include <Wire.h>
#include <smartmotor.h> #include <smartmotor.h>
#include <SMC_gains.h> #include <SMC_gains.h>
#include "trapezoidal.h"
const float ACCEL_LIMIT = 4.0; // cm/s/s const float ACCEL_LIMIT = 4.0; // cm/s/s
const float VEL_LIMIT = 16.0; // cm/s const float VEL_LIMIT = 16.0; // cm/s
@ -91,7 +92,7 @@ void loop() {
Serial.println(""); Serial.println("");
// move on if at setpoint TODO: check that the error is low as well // move on if at setpoint TODO: check that the error is low as well
if (setpoint.completed) { if (setpoint.complete) {
switch (robot_state) { switch (robot_state) {
case FORWARD: case FORWARD:
robot_state = TURN; robot_state = TURN;

View file

@ -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
};

View file

@ -1,18 +1,6 @@
#include "trapezoidal.h"
// trapezoidal impl, not fuzzed // 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 // returns the position and velocity at the given time on a trapezoidal motion plan
// this could be baked if too computationally expensive // this could be baked if too computationally expensive
// not fully fuzzed // not fully fuzzed