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:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user