1
0
mirror of https://gitlab.com/lander-team/lander-cpp.git synced 2025-06-15 22:56:53 +00:00

Merge branch '31-avionics-integration-test' of gitlab.com:lander-team/lander-cpp into 31-avionics-integration-test

This commit is contained in:
Matthew Robinaugh 2021-11-13 11:32:49 -07:00
commit c05bbb6845
3 changed files with 9 additions and 8 deletions

View File

@ -1,5 +1,6 @@
#include <HX711.h>
#pragma once
struct LoadCells {
HX711 lc0;

View File

@ -1,3 +1,4 @@
#include "LoadCells.h"
#include "Vehicle.h"
#include <Arduino.h>
#include <SD.h>
@ -65,7 +66,7 @@ void initFile() {
// File Header
dataFile.println(
"t,x,y,z,vx,vy,vz,ax,ay,az,yaw,pitch,roll,yawdot,pitchdot,rolldot,"
"Servo1,Servo2,thrustFiring,thrust,simResponse,l0,l1,l2,l3");
"Servo1,Servo2,thrustFiring,thrust,simResponse,lc0,lc1,lc2,lc3");
}
void thrustInfo(Vehicle &State) {
@ -115,7 +116,7 @@ void processTVC(Vehicle &State, LoadCells &loadCells) {
State.F = sqrt(pow(State.Fx, 2) + pow(State.Fy, 2) + pow(State.Fz, 2));
}
void write2CSV(Vehicle &State, double a, double b, double c, double d) {
void write2CSV(Vehicle &State, LoadCells &loadCells) {
dataFile.print(String(State.time, 5));
dataFile.print(",");
@ -167,13 +168,13 @@ void write2CSV(Vehicle &State, double a, double b, double c, double d) {
dataFile.print(String(State.stepDuration, 5));
dataFile.print(",");
dataFile.print(String(a, 5));
dataFile.print(String(loadCells.lc0Val, 5));
dataFile.print(",");
dataFile.print(String(b, 5));
dataFile.print(String(loadCells.lc1Val, 5));
dataFile.print(",");
dataFile.print(String(c, 5));
dataFile.print(String(loadCells.lc2Val, 5));
dataFile.print(",");
dataFile.print(String(d, 5));
dataFile.print(String(loadCells.lc3Val, 5));
dataFile.print("\n");
}

View File

@ -121,8 +121,7 @@ void loop() {
processTVC(State, loadCells);
State.stepDuration = micros() - last;
write2CSV(State, loadCells.lc0Val, loadCells.lc1Val, loadCells.lc2Val,
loadCells.lc3Val);
write2CSV(State, loadCells);
// Set "prev" values for next timestep
PrevState = State;