1
0
mirror of https://gitlab.com/lander-team/lander-cpp.git synced 2025-06-16 23:26:43 +00:00

addressed in gitlab issues

This commit is contained in:
Anson Biggs 2021-09-15 14:46:17 -07:00
parent 18e75925d5
commit a8019c6dc8
2 changed files with 4 additions and 11 deletions

View File

@ -48,8 +48,7 @@ void sim(struct sVars &Vars) {
lqrCalc(Vars); lqrCalc(Vars);
TVC(Vars); TVC(Vars);
vehicleDynamics(Vars, t); vehicleDynamics(Vars, t);
write2CSV(Vars, outfile, write2CSV(Vars, outfile, t);
t); // TODO: Need to append to memory instead of writing each step
} }
outfile.close(); outfile.close();
@ -101,7 +100,7 @@ void thrustSelection(struct sVars &Vars, int t) {
Vars.burnElapsed = 0; Vars.burnElapsed = 0;
} }
else // TODO: Make this not arbitrary else
Vars.burnElapsed = 2000; // arbitrary number to ensure we don't burn Vars.burnElapsed = 2000; // arbitrary number to ensure we don't burn
if ((Vars.burnElapsed > 0.147) && (Vars.burnElapsed < 0.420)) if ((Vars.burnElapsed > 0.147) && (Vars.burnElapsed < 0.420))
@ -217,7 +216,7 @@ void TVC(struct sVars &Vars) {
void vehicleDynamics(struct sVars &Vars, int t) { void vehicleDynamics(struct sVars &Vars, int t) {
// Idot // Idot
if (t < 1) { // TODO: Initial conditions should be set at sim start if (t < 1) {
Vars.I11dot = 0; Vars.I11dot = 0;
Vars.I22dot = 0; Vars.I22dot = 0;
Vars.I33dot = 0; Vars.I33dot = 0;
@ -241,7 +240,7 @@ void vehicleDynamics(struct sVars &Vars, int t) {
Vars.I22 * Vars.pitchdot * Vars.yawdot) / Vars.I22 * Vars.pitchdot * Vars.yawdot) /
Vars.I33; Vars.I33;
if (t < 1) { // TODO: Initial conditions should be set at sim start if (t < 1) {
Vars.x = 0; Vars.x = 0;
Vars.y = 0; Vars.y = 0;
@ -289,10 +288,6 @@ void vehicleDynamics(struct sVars &Vars, int t) {
Vars.roll = integral(Vars.psidot, Vars.rollPrev, Vars.stepSize); Vars.roll = integral(Vars.psidot, Vars.rollPrev, Vars.stepSize);
} }
// TODO: Maybe we should just have a `Vars` for the last time step and at the
// end of each time step make a copy of it
// TODO: Delete, section not needed
// Set "prev" values for next timestep // Set "prev" values for next timestep
Vars.I11prev = Vars.I11; Vars.I11prev = Vars.I11;
Vars.I22prev = Vars.I22; Vars.I22prev = Vars.I22;
@ -372,7 +367,6 @@ void write2CSV(struct sVars &Vars, std::fstream &outfile, int t) {
} }
double derivative(double x2, double x1, double dt) { double derivative(double x2, double x1, double dt) {
// TODO: is 1000 arbitrary?
double dxdt = (x2 - x1) / (dt / 1000); double dxdt = (x2 - x1) / (dt / 1000);
return dxdt; return dxdt;
} }

View File

@ -38,7 +38,6 @@ int main() {
Vars.momentArm = 0.145; // [m] Vars.momentArm = 0.145; // [m]
// Sim Step Size // Sim Step Size
// TODO: use dt instead?
Vars.stepSize = 1; // [ms] Vars.stepSize = 1; // [ms]
// Other Properties // Other Properties