1
0
mirror of https://gitlab.com/lander-team/lander-cpp.git synced 2025-06-16 15:17:23 +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> #include <HX711.h>
#pragma once
struct LoadCells { struct LoadCells {
HX711 lc0; HX711 lc0;

View File

@ -1,3 +1,4 @@
#include "LoadCells.h"
#include "Vehicle.h" #include "Vehicle.h"
#include <Arduino.h> #include <Arduino.h>
#include <SD.h> #include <SD.h>
@ -65,7 +66,7 @@ void initFile() {
// File Header // File Header
dataFile.println( dataFile.println(
"t,x,y,z,vx,vy,vz,ax,ay,az,yaw,pitch,roll,yawdot,pitchdot,rolldot," "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) { 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)); 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(String(State.time, 5));
dataFile.print(","); 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(String(State.stepDuration, 5));
dataFile.print(","); dataFile.print(",");
dataFile.print(String(a, 5)); dataFile.print(String(loadCells.lc0Val, 5));
dataFile.print(","); dataFile.print(",");
dataFile.print(String(b, 5)); dataFile.print(String(loadCells.lc1Val, 5));
dataFile.print(","); dataFile.print(",");
dataFile.print(String(c, 5)); dataFile.print(String(loadCells.lc2Val, 5));
dataFile.print(","); dataFile.print(",");
dataFile.print(String(d, 5)); dataFile.print(String(loadCells.lc3Val, 5));
dataFile.print("\n"); dataFile.print("\n");
} }

View File

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