1
0
mirror of https://gitlab.com/lander-team/lander-cpp.git synced 2025-08-17 02:24:50 +00:00

Update lc values to be calibrated and vector math

This commit is contained in:
Matthew Robinaugh
2021-11-13 11:32:42 -07:00
parent b9c2e7fb35
commit 717bb92678
3 changed files with 13 additions and 10 deletions

View File

@@ -97,19 +97,22 @@ void processTVC(Vehicle &State, LoadCells &loadCells) {
if (State.time == 0) {
Serial.println("WARNING: processTVC not implemented for TEENSY");
}
double r = 3.0;
double R = 5.0;
// Vector math to aqcuire thrust vector components
// PLACEHOLDER PLACEHOLDERPLACEHOLDER PLACEHOLDERPLACEHOLDER
// PLACEHOLDERPLACEHOLDER PLACEHOLDERPLACEHOLDER PLACEHOLDER
State.Fx = loadCells.lc1Val + loadCells.lc2Val;
State.Fy = loadCells.lc0Val + loadCells.lc3Val;
State.Fz = sqrt(pow(State.thrust, 2) - pow(State.Fx, 2) - pow(State.Fy, 2)) +
(State.mass * g);
State.Fx = (loadCells.lc1Val - loadCells.lc2Val) * r / R;
State.Fy = (loadCells.lc0Val - loadCells.lc3Val) * r / R;
State.Fz =
loadCells.lc0Val + loadCells.lc1Val + loadCells.lc2Val + loadCells.lc3Val;
// Calculate moment created by Fx and Fy
State.momentX = State.Fx * State.momentArm;
State.momentY = State.Fy * State.momentArm;
State.momentZ = 0.0;
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) {