Compare commits

..

No commits in common. "f8d0b85defe20a819fa3b630db82f10e117573d5" and "81bec195f01d712c7ce04fd95d9a9df18db65305" have entirely different histories.

4 changed files with 17 additions and 25 deletions

Binary file not shown.

View file

@ -2,7 +2,6 @@
#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
@ -92,7 +91,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.complete) { if (setpoint.completed) {
switch (robot_state) { switch (robot_state) {
case FORWARD: case FORWARD:
robot_state = TURN; robot_state = TURN;

View file

@ -1,22 +0,0 @@
#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
};
// 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
struct Setpoint trapezoidal_planner(struct Trapezoidal* trapezoidal, float time);
// returns the time a given plan will take
float trapezoidal_time(struct Trapezoidal* trapezoidal);

View file

@ -1,6 +1,21 @@
#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
// this could be baked if too computationally expensive
// not fully fuzzed
struct Setpoint trapezoidal_planner(struct Trapezoidal* trapezoidal, float time) { struct Setpoint trapezoidal_planner(struct Trapezoidal* trapezoidal, float time) {
float max_vel = trapezoidal->max_vel; float max_vel = trapezoidal->max_vel;
float max_acc = trapezoidal->max_acc; float max_acc = trapezoidal->max_acc;