First Git Push
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#ifndef MOTIONCONTROLLER_H
|
||||
#define MOTIONCONTROLLER_H
|
||||
|
||||
#include <Adafruit_PWMServoDriver.h>
|
||||
#include "Protocol.h"
|
||||
|
||||
struct MotionFrame { int leg[6][3]; };
|
||||
|
||||
class MotionController {
|
||||
public:
|
||||
MotionController();
|
||||
void begin();
|
||||
void update(); // The 5ms interpolation "heartbeat"
|
||||
bool pushFrame(int leg[6][3]);
|
||||
void setConfigs(int minP, int maxP, int interval);
|
||||
|
||||
private:
|
||||
void writeServos(float leg[6][3]);
|
||||
int degToPulse(int deg);
|
||||
|
||||
Adafruit_PWMServoDriver board0;
|
||||
Adafruit_PWMServoDriver board1;
|
||||
|
||||
// Movement state
|
||||
float targetLeg[6][3];
|
||||
float currentLegF[6][3];
|
||||
float stepSize[6][3];
|
||||
|
||||
// Circular Buffer
|
||||
MotionFrame buffer[10];
|
||||
int head = 0;
|
||||
int tail = 0;
|
||||
|
||||
// Configs
|
||||
int _servoMin = 125;
|
||||
int _servoMax = 625;
|
||||
int _pythonInterval = 50;
|
||||
unsigned long lastUpdate = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user