Compare commits

..

3 commits

4 changed files with 25 additions and 17 deletions

BIN
cad/Drive Wheel-2.SLDPRT Normal file

Binary file not shown.

View file

@ -2,6 +2,7 @@
#include <Wire.h>
#include <smartmotor.h>
#include <SMC_gains.h>
#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;

View file

@ -0,0 +1,22 @@
#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,21 +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
struct Setpoint trapezoidal_planner(struct Trapezoidal* trapezoidal, float time) {
float max_vel = trapezoidal->max_vel;
float max_acc = trapezoidal->max_acc;