mirror of
https://gitlab.com/lander-team/lander-cpp.git
synced 2025-06-16 23:26:43 +00:00
new load cell gains, conditions for ignition while loop
This commit is contained in:
parent
c30984600d
commit
1e4fbe8b20
@ -35,10 +35,10 @@ const int pin_lc2 = 19; // White
|
|||||||
const int pin_lc3 = 20; // Black
|
const int pin_lc3 = 20; // Black
|
||||||
const int pin_igniter = 7;
|
const int pin_igniter = 7;
|
||||||
|
|
||||||
double lcGain0 = -107.39;
|
double lcGain0 = -300.72;
|
||||||
double lcGain1 = -107.39;
|
double lcGain1 = -367.5;
|
||||||
double lcGain2 = -107.39;
|
double lcGain2 = -565.78;
|
||||||
double lcGain3 = -107.39;
|
double lcGain3 = -505.02;
|
||||||
|
|
||||||
// SD card stuff
|
// SD card stuff
|
||||||
const int chipSelect = BUILTIN_SDCARD;
|
const int chipSelect = BUILTIN_SDCARD;
|
||||||
@ -238,10 +238,13 @@ void thrustInfo(Vehicle &State) {
|
|||||||
digitalWrite(pin_igniter, HIGH);
|
digitalWrite(pin_igniter, HIGH);
|
||||||
|
|
||||||
// Wait for motor to start burning
|
// Wait for motor to start burning
|
||||||
Serial.println("waiting for motor to start.");
|
Serial.println("Waiting for motor to start.");
|
||||||
while (lc_val * 1.5 < State.lc0_processed + State.lc1_processed +
|
while ((lc_val * 10) > (State.lc0_processed + State.lc1_processed +
|
||||||
State.lc2_processed + State.lc3_processed) {
|
State.lc2_processed + State.lc3_processed)) {
|
||||||
;
|
// Serial.print(lc_val * 10);
|
||||||
|
// Serial.print(", ");
|
||||||
|
// Serial.println(State.lc0_processed + State.lc1_processed +
|
||||||
|
// State.lc2_processed + State.lc3_processed);
|
||||||
}
|
}
|
||||||
|
|
||||||
State.thrustFiring = 1;
|
State.thrustFiring = 1;
|
||||||
@ -269,6 +272,14 @@ void thrustInfo(Vehicle &State) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
State.thrust = 0.0;
|
State.thrust = 0.0;
|
||||||
|
|
||||||
|
State.Fx = 0.0;
|
||||||
|
State.Fy = 0.0;
|
||||||
|
State.Fz = g * State.massInitial;
|
||||||
|
|
||||||
|
State.momentX = 0.0;
|
||||||
|
State.momentY = 0.0;
|
||||||
|
State.momentZ = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@ void setup() {
|
|||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
last = micros();
|
last = micros();
|
||||||
|
Serial.println(State.vz);
|
||||||
|
|
||||||
vehicleDynamics(State, PrevState);
|
vehicleDynamics(State, PrevState);
|
||||||
thrustInfo(State);
|
thrustInfo(State);
|
||||||
@ -88,8 +89,13 @@ void loop() {
|
|||||||
teensyAbort();
|
teensyAbort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (State.burnElapsed < 0.01) {
|
||||||
|
State.stepDuration = State.stepSize;
|
||||||
|
|
||||||
|
} else {
|
||||||
State.stepDuration = micros() - last;
|
State.stepDuration = micros() - last;
|
||||||
delayMicroseconds((1000.0 * State.stepSize) - State.stepDuration);
|
delayMicroseconds((1000.0 * State.stepSize) - State.stepDuration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user