version 1.1
This commit is contained in:
@@ -20,23 +20,23 @@ MotorGyro motorGyro[] = {
|
||||
DRONE::DRONE() {
|
||||
}
|
||||
|
||||
void DRONE::setPinESC(int pin, MotorPosition mp) {
|
||||
void DRONE::setPinESC(int pin, MotorPosition mp, int speedOffset) {
|
||||
switch (mp) {
|
||||
case BR:
|
||||
back_right.setMotorPosition(mp);
|
||||
back_right.setPinESC(pin);
|
||||
back_right.setPinESC(pin, speedOffset);
|
||||
break;
|
||||
case BL:
|
||||
back_left.setMotorPosition(mp);
|
||||
back_left.setPinESC(pin);
|
||||
back_left.setPinESC(pin, speedOffset);
|
||||
break;
|
||||
case FR:
|
||||
front_right.setMotorPosition(mp);
|
||||
front_right.setPinESC(pin);
|
||||
front_right.setPinESC(pin, speedOffset);
|
||||
break;
|
||||
case FL:
|
||||
front_left.setMotorPosition(mp);
|
||||
front_left.setPinESC(pin);
|
||||
front_left.setPinESC(pin, speedOffset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -73,10 +73,10 @@ void DRONE::decelerate() {
|
||||
}
|
||||
|
||||
void DRONE::stop() {
|
||||
back_right.setSpeed(1000);
|
||||
back_left.setSpeed(1000);
|
||||
front_left.setSpeed(1000);
|
||||
front_right.setSpeed(1000);
|
||||
back_right.stop();
|
||||
back_left.stop();
|
||||
front_left.stop();
|
||||
front_right.stop();
|
||||
}
|
||||
|
||||
String DRONE::getSpeedFromMotor(MotorPosition mp) {
|
||||
@@ -112,7 +112,7 @@ void DRONE::updateMotors(float* mpuValues) {
|
||||
float pitch = mpuValues[0];
|
||||
float roll = mpuValues[1];
|
||||
|
||||
float threshold = 0.3;
|
||||
float threshold = 0.5;
|
||||
|
||||
PitchRollStates pitchStatus = IDLE;
|
||||
if (pitch < -threshold) {
|
||||
@@ -128,7 +128,7 @@ void DRONE::updateMotors(float* mpuValues) {
|
||||
rollStatus = PLUS;
|
||||
}
|
||||
|
||||
// Serial.println("PS: " + String(pitchStatus) + " | RS: " + String(rollStatus));
|
||||
Serial.println("PS: " + String(pitchStatus) + " | RS: " + String(rollStatus));
|
||||
|
||||
int numCond = sizeof(motorGyro) / sizeof(motorGyro[0]);
|
||||
for (int i = 0; i < numCond; i++) {
|
||||
|
||||
Reference in New Issue
Block a user