Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 132 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion flight-computer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ edition = "2024"

[dependencies]
protocols = { version = "0.1.0", path = "../protocols" }
tokio = { version = "1.48.0", features = ["macros", "rt-multi-thread", "time"] }
tokio = { version = "1.48.0", features = ["macros", "rt-multi-thread", "time", "fs"] }
csv-async = "1.3.1"
serde = "1.0.228"


[lints]
workspace = true

2 changes: 2 additions & 0 deletions flight-computer/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
use protocols::api::{TelemetryDataMessage, Velocity};
use protocols::client::MessageSender;
use protocols::server::MessageReceiver;
use serde::Serialize;

Check failure on line 9 in flight-computer/src/input.rs

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/input.rs#L9

error: unused import: `serde::Serialize` --> flight-computer/src/input.rs:9:5 | 9 | use serde::Serialize; | ^^^^^^^^^^^^^^^^
Raw output
flight-computer/src/input.rs:9:5:e:error: unused import: `serde::Serialize`
 --> flight-computer/src/input.rs:9:5
  |
9 | use serde::Serialize;
  |     ^^^^^^^^^^^^^^^^


__END__

Check failure on line 9 in flight-computer/src/input.rs

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/input.rs#L9

error: unused import: `serde::Serialize` --> flight-computer/src/input.rs:9:5 | 9 | use serde::Serialize; | ^^^^^^^^^^^^^^^^
Raw output
flight-computer/src/input.rs:9:5:e:error: unused import: `serde::Serialize`
 --> flight-computer/src/input.rs:9:5
  |
9 | use serde::Serialize;
  |     ^^^^^^^^^^^^^^^^


__END__

/// Stores the current inputs of the system, given by the avionics
#[derive(serde::Serialize)]
Copy link
Collaborator

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

pub struct Inputs {
pub location: Location,
pub velocity: Velocity,
Expand Down
27 changes: 27 additions & 0 deletions flight-computer/src/main.rs
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

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/main.rs#L9

error: unused import: `std::error::Error` --> flight-computer/src/main.rs:9:5 | 9 | use std::error::Error; | ^^^^^^^^^^^^^^^^^ | = note: `-D unused-imports` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(unused_imports)]`
Raw output
flight-computer/src/main.rs:9:5:e:error: unused import: `std::error::Error`
 --> flight-computer/src/main.rs:9:5
  |
9 | use std::error::Error;
  |     ^^^^^^^^^^^^^^^^^
  |
  = note: `-D unused-imports` implied by `-D warnings`
  = help: to override `-D warnings` add `#[allow(unused_imports)]`


__END__

Check failure on line 9 in flight-computer/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/main.rs#L9

error: unused import: `std::error::Error` --> flight-computer/src/main.rs:9:5 | 9 | use std::error::Error; | ^^^^^^^^^^^^^^^^^ | = note: `-D unused-imports` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(unused_imports)]`
Raw output
flight-computer/src/main.rs:9:5:e:error: unused import: `std::error::Error`
 --> flight-computer/src/main.rs:9:5
  |
9 | use std::error::Error;
  |     ^^^^^^^^^^^^^^^^^
  |
  = note: `-D unused-imports` implied by `-D warnings`
  = help: to override `-D warnings` add `#[allow(unused_imports)]`


__END__
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

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/main.rs#L18

error: variable does not need to be mutable --> flight-computer/src/main.rs:18:9 | 18 | let mut file_location = File::create("loc.csv").await?; | ----^^^^^^^^^^^^^ | | | help: remove this `mut` | = note: `-D unused-mut` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(unused_mut)]`
Raw output
flight-computer/src/main.rs:18:9:e:error: variable does not need to be mutable
  --> flight-computer/src/main.rs:18:9
   |
18 |     let mut file_location = File::create("loc.csv").await?;
   |         ----^^^^^^^^^^^^^
   |         |
   |         help: remove this `mut`
   |
   = note: `-D unused-mut` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unused_mut)]`


__END__

Check failure on line 18 in flight-computer/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/main.rs#L18

error: unused variable: `file_location` --> flight-computer/src/main.rs:18:9 | 18 | let mut file_location = File::create("loc.csv").await?; | ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_file_location` | = note: `-D unused-variables` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(unused_variables)]`
Raw output
flight-computer/src/main.rs:18:9:e:error: unused variable: `file_location`
  --> flight-computer/src/main.rs:18:9
   |
18 |     let mut file_location = File::create("loc.csv").await?;
   |         ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_file_location`
   |
   = note: `-D unused-variables` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unused_variables)]`


__END__

Check failure on line 18 in flight-computer/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/main.rs#L18

error: variable does not need to be mutable --> flight-computer/src/main.rs:18:9 | 18 | let mut file_location = File::create("loc.csv").await?; | ----^^^^^^^^^^^^^ | | | help: remove this `mut` | = note: `-D unused-mut` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(unused_mut)]`
Raw output
flight-computer/src/main.rs:18:9:e:error: variable does not need to be mutable
  --> flight-computer/src/main.rs:18:9
   |
18 |     let mut file_location = File::create("loc.csv").await?;
   |         ----^^^^^^^^^^^^^
   |         |
   |         help: remove this `mut`
   |
   = note: `-D unused-mut` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unused_mut)]`


__END__

Check failure on line 18 in flight-computer/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/main.rs#L18

error: unused variable: `file_location` --> flight-computer/src/main.rs:18:9 | 18 | let mut file_location = File::create("loc.csv").await?; | ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_file_location` | = note: `-D unused-variables` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(unused_variables)]`
Raw output
flight-computer/src/main.rs:18:9:e:error: unused variable: `file_location`
  --> flight-computer/src/main.rs:18:9
   |
18 |     let mut file_location = File::create("loc.csv").await?;
   |         ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_file_location`
   |
   = note: `-D unused-variables` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unused_variables)]`


__END__

let mut file_velocity = File::create("velocity.csv").await?;

Check failure on line 20 in flight-computer/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/main.rs#L20

error: variable does not need to be mutable --> flight-computer/src/main.rs:20:9 | 20 | let mut file_velocity = File::create("velocity.csv").await?; | ----^^^^^^^^^^^^^ | | | help: remove this `mut`
Raw output
flight-computer/src/main.rs:20:9:e:error: variable does not need to be mutable
  --> flight-computer/src/main.rs:20:9
   |
20 |     let mut file_velocity = File::create("velocity.csv").await?;
   |         ----^^^^^^^^^^^^^
   |         |
   |         help: remove this `mut`


__END__

Check failure on line 20 in flight-computer/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/main.rs#L20

error: unused variable: `file_velocity` --> flight-computer/src/main.rs:20:9 | 20 | let mut file_velocity = File::create("velocity.csv").await?; | ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_file_velocity`
Raw output
flight-computer/src/main.rs:20:9:e:error: unused variable: `file_velocity`
  --> flight-computer/src/main.rs:20:9
   |
20 |     let mut file_velocity = File::create("velocity.csv").await?;
   |         ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_file_velocity`


__END__

Check failure on line 20 in flight-computer/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/main.rs#L20

error: variable does not need to be mutable --> flight-computer/src/main.rs:20:9 | 20 | let mut file_velocity = File::create("velocity.csv").await?; | ----^^^^^^^^^^^^^ | | | help: remove this `mut`
Raw output
flight-computer/src/main.rs:20:9:e:error: variable does not need to be mutable
  --> flight-computer/src/main.rs:20:9
   |
20 |     let mut file_velocity = File::create("velocity.csv").await?;
   |         ----^^^^^^^^^^^^^
   |         |
   |         help: remove this `mut`


__END__

Check failure on line 20 in flight-computer/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/main.rs#L20

error: unused variable: `file_velocity` --> flight-computer/src/main.rs:20:9 | 20 | let mut file_velocity = File::create("velocity.csv").await?; | ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_file_velocity`
Raw output
flight-computer/src/main.rs:20:9:e:error: unused variable: `file_velocity`
  --> flight-computer/src/main.rs:20:9
   |
20 |     let mut file_velocity = File::create("velocity.csv").await?;
   |         ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_file_velocity`


__END__

// initialize writer
let mut wrt = AsyncWriterBuilder::new().has_headers(true).create_writer(vec![]);

Check failure on line 23 in flight-computer/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/main.rs#L23

error: variable does not need to be mutable --> flight-computer/src/main.rs:23:9 | 23 | let mut wrt = AsyncWriterBuilder::new().has_headers(true).create_writer(vec![]); | ----^^^ | | | help: remove this `mut`
Raw output
flight-computer/src/main.rs:23:9:e:error: variable does not need to be mutable
  --> flight-computer/src/main.rs:23:9
   |
23 |     let mut wrt = AsyncWriterBuilder::new().has_headers(true).create_writer(vec![]);
   |         ----^^^
   |         |
   |         help: remove this `mut`


__END__

Check failure on line 23 in flight-computer/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/main.rs#L23

error: unused variable: `wrt` --> flight-computer/src/main.rs:23:9 | 23 | let mut wrt = AsyncWriterBuilder::new().has_headers(true).create_writer(vec![]); | ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_wrt`
Raw output
flight-computer/src/main.rs:23:9:e:error: unused variable: `wrt`
  --> flight-computer/src/main.rs:23:9
   |
23 |     let mut wrt = AsyncWriterBuilder::new().has_headers(true).create_writer(vec![]);
   |         ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_wrt`


__END__

Check failure on line 23 in flight-computer/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/main.rs#L23

error: variable does not need to be mutable --> flight-computer/src/main.rs:23:9 | 23 | let mut wrt = AsyncWriterBuilder::new().has_headers(true).create_writer(vec![]); | ----^^^ | | | help: remove this `mut`
Raw output
flight-computer/src/main.rs:23:9:e:error: variable does not need to be mutable
  --> flight-computer/src/main.rs:23:9
   |
23 |     let mut wrt = AsyncWriterBuilder::new().has_headers(true).create_writer(vec![]);
   |         ----^^^
   |         |
   |         help: remove this `mut`


__END__

Check failure on line 23 in flight-computer/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/main.rs#L23

error: unused variable: `wrt` --> flight-computer/src/main.rs:23:9 | 23 | let mut wrt = AsyncWriterBuilder::new().has_headers(true).create_writer(vec![]); | ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_wrt`
Raw output
flight-computer/src/main.rs:23:9:e:error: unused variable: `wrt`
  --> flight-computer/src/main.rs:23:9
   |
23 |     let mut wrt = AsyncWriterBuilder::new().has_headers(true).create_writer(vec![]);
   |         ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_wrt`


__END__

// 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

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/main.rs#L28

error: variable does not need to be mutable --> flight-computer/src/main.rs:28:9 | 28 | let mut wrt = AsyncWriterBuilder::new().has_headers(true).create_writer(vec![]); | ----^^^ | | | help: remove this `mut`
Raw output
flight-computer/src/main.rs:28:9:e:error: variable does not need to be mutable
  --> flight-computer/src/main.rs:28:9
   |
28 |     let mut wrt = AsyncWriterBuilder::new().has_headers(true).create_writer(vec![]);
   |         ----^^^
   |         |
   |         help: remove this `mut`


__END__

Check failure on line 28 in flight-computer/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/main.rs#L28

error: unused variable: `wrt` --> flight-computer/src/main.rs:28:9 | 28 | let mut wrt = AsyncWriterBuilder::new().has_headers(true).create_writer(vec![]); | ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_wrt`
Raw output
flight-computer/src/main.rs:28:9:e:error: unused variable: `wrt`
  --> flight-computer/src/main.rs:28:9
   |
28 |     let mut wrt = AsyncWriterBuilder::new().has_headers(true).create_writer(vec![]);
   |         ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_wrt`


__END__

Check failure on line 28 in flight-computer/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/main.rs#L28

error: variable does not need to be mutable --> flight-computer/src/main.rs:28:9 | 28 | let mut wrt = AsyncWriterBuilder::new().has_headers(true).create_writer(vec![]); | ----^^^ | | | help: remove this `mut`
Raw output
flight-computer/src/main.rs:28:9:e:error: variable does not need to be mutable
  --> flight-computer/src/main.rs:28:9
   |
28 |     let mut wrt = AsyncWriterBuilder::new().has_headers(true).create_writer(vec![]);
   |         ----^^^
   |         |
   |         help: remove this `mut`


__END__

Check failure on line 28 in flight-computer/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy results

[clippy results] flight-computer/src/main.rs#L28

error: unused variable: `wrt` --> flight-computer/src/main.rs:28:9 | 28 | let mut wrt = AsyncWriterBuilder::new().has_headers(true).create_writer(vec![]); | ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_wrt`
Raw output
flight-computer/src/main.rs:28:9:e:error: unused variable: `wrt`
  --> flight-computer/src/main.rs:28:9
   |
28 |     let mut wrt = AsyncWriterBuilder::new().has_headers(true).create_writer(vec![]);
   |         ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_wrt`


__END__
let mut ser_2 = AsyncSerializer::from_writer(vec![]);
Copy link
Collaborator

Choose a reason for hiding this comment

The 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();

Expand Down Expand Up @@ -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
Expand Down
Empty file added foo.csv
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could have excluded this in gitignores.

Empty file.
Empty file added loc.csv
Empty file.
Empty file added velocity.csv
Empty file.
Loading