Skip to content

Commit

Permalink
Merge pull request #38 from Propulsive-Landing/feature-dataformatting
Browse files Browse the repository at this point in the history
Changed data logging format to make easier to extract
  • Loading branch information
jackbogatz authored Nov 12, 2024
2 parents 4456e9d + ad9a836 commit c04b60f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
3 changes: 1 addition & 2 deletions include/Controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ class Controller{
Controller(TVC& tvc);
void UpdateLaunch(Navigation& navigation, double current_time);
void UpdateTestTVC(double testTime);

void UpdateLand(Navigation &navigation, double current_time);
void stabilizeAtOffset(Navigation& navigation, double current_time, double offset);

void UpdateSafe();
void GetNextController_Gain_Time_Index(double startTime);
void CalculateInput();
Expand All @@ -42,6 +40,7 @@ class Controller{
void Center();
void ImportControlParameters(std::string file_name);
void ResetKIteration(double current_time);
int GetCurrentIterationIndex();
Eigen::Matrix<double, 2, 8> GetCurrentKMatrix();

};
1 change: 0 additions & 1 deletion include/Navigation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class Navigation
IMU& imu;
Barometer& barometer;
TVC& tvc;

Eigen::Matrix<double, 12, 1> stateMat;
std::deque<std::vector<double>> d_theta_queue_reckon;
double pressureInit;
Expand Down
6 changes: 6 additions & 0 deletions src/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,9 @@ Eigen::Matrix<double, 2, 8> Controller::GetCurrentKMatrix()
{
return controller_gains.block(current_iteration_index*2, 0, 2, 8);
}


int Controller::GetCurrentIterationIndex()
{
return current_iteration_index;
}
20 changes: 7 additions & 13 deletions src/Telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,18 @@ void Telemetry::HardwareSaveFrame(Navigation& navigation, Controller& controller
auto time_now = std::chrono::system_clock::now();
auto in_time_t = std::chrono::system_clock::to_time_t(time_now);

HardwareSaved << std::put_time(std::localtime(&in_time_t), "%c") << ",";
HardwareSaved << std::put_time(std::localtime(&in_time_t), "%c") << ", " ;

// Navigation state, U, k matrix current index
// Write data to file


for(int i = 0; i < 12; ++i){
HardwareSaved << "State[" << i << "]: " << std::to_string(navigation.GetNavigation()(i))<< ", \n";
}

for(int i = 0; i < 2; ++i)
{
for(int j = 0; j < 8; ++j)
{
double value = controller.GetCurrentKMatrix()(i,j);
HardwareSaved << "k[" << i << "][" << j << "]: " << std::to_string(value)<< ", ";
}
HardwareSaved<<"\n" << std::flush;
HardwareSaved << std::to_string(navigation.GetNavigation()(i))<< ", ";
}
HardwareSaved << std::to_string(controller.GetCurrentIterationIndex());


HardwareSaved<<"\n" << std::flush;
}


Expand Down Expand Up @@ -138,6 +129,9 @@ Telemetry::Telemetry()
Logs.open ("../logs/logs"+str+".txt");
HardwareSaved.open ("../logs/data"+str+".txt");

HardwareSaved << "Date, x, y, z, vx, vy, vz, phi, theta, psi, p, q, r, K_Matrix_Index \n";


//TODO Write headers to data file where needed
}

Expand Down

0 comments on commit c04b60f

Please sign in to comment.