factored out header
This commit is contained in:
parent
99dc53a79f
commit
b3c09c6047
3 changed files with 17 additions and 14 deletions
|
|
@ -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;
|
||||||
|
|
|
||||||
14
robot_controller/trapezoidal.h
Normal file
14
robot_controller/trapezoidal.h
Normal 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
|
||||||
|
};
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue