mirror of
https://gitlab.com/lander-team/lander-cpp.git
synced 2025-08-02 11:31:34 +00:00
Merge branch '15-integrate-with-sd-card' into 'main'
Resolve "Integrate with SD Card" Closes #15 See merge request lander-team/lander-cpp!20
This commit is contained in:
23
src/main.cpp
23
src/main.cpp
@@ -19,13 +19,13 @@ unsigned long last;
|
||||
|
||||
#if defined(NATIVE) || defined(_WIN32)
|
||||
#include "native.h"
|
||||
outVector stateVector;
|
||||
#elif defined(TEENSY)
|
||||
#include "teensy.h"
|
||||
#endif
|
||||
|
||||
Vehicle State;
|
||||
Vehicle PrevState;
|
||||
outVector stateVector;
|
||||
|
||||
#if defined(NATIVE) || defined(_WIN32)
|
||||
void setup() {
|
||||
@@ -48,6 +48,8 @@ void setup() {
|
||||
loadCellCalibrate();
|
||||
Serial.println("Load Cells Calibrated");
|
||||
delay(1000);
|
||||
initFile();
|
||||
delay(1000);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -60,6 +62,9 @@ void loop() {
|
||||
processTVC(State);
|
||||
state2vec(State, PrevState, stateVector);
|
||||
|
||||
// Set "prev" values for next timestep
|
||||
PrevState = State;
|
||||
|
||||
State.time += State.stepSize;
|
||||
|
||||
if (State.z < 0.0) {
|
||||
@@ -70,24 +75,32 @@ void loop() {
|
||||
}
|
||||
#elif defined(TEENSY)
|
||||
void loop() {
|
||||
|
||||
last = millis();
|
||||
vehicleDynamics(State, PrevState);
|
||||
thrustInfo(State);
|
||||
pidController(State, PrevState);
|
||||
TVC(State, PrevState);
|
||||
processTVC(State);
|
||||
// state2vec(State, PrevState, stateVector);
|
||||
write2CSV(State);
|
||||
|
||||
// Set "prev" values for next timestep
|
||||
PrevState = State;
|
||||
|
||||
State.time += State.stepSize;
|
||||
|
||||
if (State.z < 0.0) {
|
||||
write2CSV(stateVector, State);
|
||||
printSimResults(State);
|
||||
init_Vehicle(State);
|
||||
Serial.println("Last run duration:" + String(millis() - last + " ms"));
|
||||
|
||||
delay(1000);
|
||||
Serial.println("Last run duration:" + String(millis() - last) + " ms");
|
||||
|
||||
closeFile();
|
||||
delay(10000);
|
||||
|
||||
Serial.println("Restarting Sim");
|
||||
Serial.println(
|
||||
"===============================================================");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user