mirror of
https://gitlab.com/lander-team/lander-cpp.git
synced 2025-07-23 14:41:25 +00:00
its angry
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#include "Vehicle.h"
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <SD.h>
|
||||
#include <SPI.h>
|
||||
@@ -35,20 +34,43 @@ void initFile() {
|
||||
}
|
||||
Serial.println("Card initialized.");
|
||||
|
||||
// Delete any previous existing files
|
||||
int i = 1;
|
||||
Serial.print("simOut_" + String(i) + ".csv");
|
||||
String fileName;
|
||||
|
||||
if (SD.exists("simOut.csv")) {
|
||||
SD.remove("simOut.csv");
|
||||
}
|
||||
while (i > 0) {
|
||||
fileName = "simOut_" + String(i) + ".csv";
|
||||
|
||||
// Open simOut.csv
|
||||
dataFile = SD.open("simOut.csv", FILE_WRITE);
|
||||
if (dataFile) {
|
||||
Serial.println("File successfully opened!");
|
||||
if (!SD.exists(fileName)) {
|
||||
// Open simOut_i.csv
|
||||
dataFile = SD.open(fileName, FILE_WRITE);
|
||||
|
||||
if (dataFile) {
|
||||
Serial.println("File successfully opened!");
|
||||
|
||||
} else {
|
||||
// if the file didn't open, print an error:
|
||||
Serial.println("Error opening output file. \n\nABORTING SIMULATION");
|
||||
teensyAbort();
|
||||
}
|
||||
i = 0;
|
||||
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// if the file didn't open, print an error:
|
||||
Serial.println("Error opening simOut.csv. \n\nABORTING SIMULATION");
|
||||
teensyAbort();
|
||||
// Open simOut.csv
|
||||
dataFile = SD.open("simOut.csv", FILE_WRITE);
|
||||
if (dataFile) {
|
||||
Serial.println("File successfully opened!");
|
||||
|
||||
} else {
|
||||
// if the file didn't open, print an error:
|
||||
Serial.println("Error opening output file. \n\nABORTING SIMULATION");
|
||||
teensyAbort();
|
||||
}
|
||||
}
|
||||
|
||||
// File Header
|
||||
@@ -176,7 +198,7 @@ void printSimResults(Vehicle &State) {
|
||||
State.yaw = State.yaw * 180 / M_PI;
|
||||
State.pitch = State.pitch * 180 / M_PI;
|
||||
State.roll = State.roll * 180 / M_PI;
|
||||
|
||||
|
||||
double landing_angle =
|
||||
pow(State.yaw * State.yaw + State.pitch * State.pitch, .5);
|
||||
|
||||
|
Reference in New Issue
Block a user