-
Notifications
You must be signed in to change notification settings - Fork 0
feat: write flight log to csv #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: workshop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,34 @@ | ||
| use std::time::Duration; | ||
|
|
||
| use csv_async::{AsyncSerializer, AsyncWriterBuilder}; | ||
| use protocols::api::{ | ||
| AvionicsCommandMessage, SensorMessage, TelemetryCommandMessage, TelemetryDataMessage, | ||
| }; | ||
| use protocols::client::MessageSender; | ||
| use protocols::server::MessageReceiver; | ||
| use std::error::Error; | ||
|
Check failure on line 9 in flight-computer/src/main.rs
|
||
| use tokio::fs::File; | ||
|
|
||
| pub mod input; | ||
| pub mod state_machine; | ||
|
|
||
| #[tokio::main] | ||
| async fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
| // create csv file | ||
| let mut file_location = File::create("loc.csv").await?; | ||
|
Check failure on line 18 in flight-computer/src/main.rs
|
||
|
|
||
| let mut file_velocity = File::create("velocity.csv").await?; | ||
|
Check failure on line 20 in flight-computer/src/main.rs
|
||
|
|
||
| // initialize writer | ||
| let mut wrt = AsyncWriterBuilder::new().has_headers(true).create_writer(vec![]); | ||
|
Check failure on line 23 in flight-computer/src/main.rs
|
||
|
|
||
| // initialize serializer | ||
| let mut ser = AsyncSerializer::from_writer(vec![]); | ||
|
|
||
| let mut wrt = AsyncWriterBuilder::new().has_headers(true).create_writer(vec![]); | ||
|
Check failure on line 28 in flight-computer/src/main.rs
|
||
| let mut ser_2 = AsyncSerializer::from_writer(vec![]); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean, you know yourself that this isn't the best variable name, but idk |
||
|
|
||
|
|
||
| // Initialize inputs | ||
| let mut inputs = input::Inputs::default(); | ||
|
|
||
|
|
@@ -41,6 +59,15 @@ | |
| inputs.location.altitude, | ||
| inputs.velocity.down | ||
| ); | ||
| // insert data | ||
| ser.serialize(& | ||
| inputs.location | ||
| ).await?; | ||
|
|
||
| ser_2.serialize(&inputs.velocity).await?; | ||
|
|
||
|
|
||
|
|
||
| } | ||
|
|
||
| // Handle incoming telemetry commands | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you could have excluded this in gitignores. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't needed anymore