modified: src/Hippie.cpp
modified: src/Hippie.h
This commit is contained in:
parent
ddca9ce8ce
commit
caa9fc4584
@ -4,14 +4,31 @@
|
|||||||
#include <Oscillator.h>
|
#include <Oscillator.h>
|
||||||
|
|
||||||
|
|
||||||
|
void Hippie::init(int YL, int YR, int RL, int RR, int OYL, int OYR, int ORL, int ORR) {
|
||||||
void Hippie::init(int YL, int YR, int RL, int RR) {
|
|
||||||
|
|
||||||
servo_pins[0] = YL;
|
servo_pins[0] = YL;
|
||||||
servo_pins[1] = YR;
|
servo_pins[1] = YR;
|
||||||
servo_pins[2] = RL;
|
servo_pins[2] = RL;
|
||||||
servo_pins[3] = RR;
|
servo_pins[3] = RR;
|
||||||
|
|
||||||
|
attachServos();
|
||||||
|
isHippieResting=false;
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++) servo_position[i] = 90;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Hippie::init_with_trim(int YL, int YR, int RL, int RR, int OYL, int OYR, int ORL, int ORR) {
|
||||||
|
|
||||||
|
servo_pins[0] = YL;
|
||||||
|
servo_pins[1] = YR;
|
||||||
|
servo_pins[2] = RL;
|
||||||
|
servo_pins[3] = RR;
|
||||||
|
servo[0].SetTrim(OYL);
|
||||||
|
servo[1].SetTrim(OYR);
|
||||||
|
servo[2].SetTrim(ORL);
|
||||||
|
servo[3].SetTrim(ORR);
|
||||||
|
|
||||||
attachServos();
|
attachServos();
|
||||||
isHippieResting=false;
|
isHippieResting=false;
|
||||||
|
|
||||||
@ -71,6 +88,7 @@ void Hippie::oscillateServos(int A[4], int O[4], int T, double phase_diff[4], fl
|
|||||||
servo[i].SetA(A[i]);
|
servo[i].SetA(A[i]);
|
||||||
servo[i].SetT(T);
|
servo[i].SetT(T);
|
||||||
servo[i].SetPh(phase_diff[i]);
|
servo[i].SetPh(phase_diff[i]);
|
||||||
|
servo[i].SetTrim(servo_trim[i]);
|
||||||
}
|
}
|
||||||
double ref=millis();
|
double ref=millis();
|
||||||
for (double x=ref; x<=T*cycle+ref; x=millis()){
|
for (double x=ref; x<=T*cycle+ref; x=millis()){
|
||||||
|
@ -19,7 +19,7 @@ class Hippie
|
|||||||
|
|
||||||
//-- Hippie initialisation
|
//-- Hippie initialisation
|
||||||
void init(int YL, int YR, int RL, int RR);
|
void init(int YL, int YR, int RL, int RR);
|
||||||
|
void init_with_trim(int YL, int YR, int RL, int RR, int OYL, int OYR, int ORL, int ORR);
|
||||||
//-- Attach & detach functions
|
//-- Attach & detach functions
|
||||||
void attachServos();
|
void attachServos();
|
||||||
void detachServos();
|
void detachServos();
|
||||||
|
Loading…
Reference in New Issue
Block a user