Skip to content
Draft
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
3 changes: 3 additions & 0 deletions applications/autoware/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ libm = "0.2"
csv-core = "0.1"
awkernel_async_lib = { path = "../../awkernel_async_lib", default-features = false }
awkernel_lib = { path = "../../awkernel_lib", default-features = false }
common_types = { path = "./common_types", default-features = false }
imu_driver = { path = "./imu_driver", default-features = false }
imu_corrector = { path = "./imu_corrector", default-features = false }
vehicle_velocity_converter = { path = "./vehicle_velocity_converter", default-features = false }
gyro_odometer = { path = "./gyro_odometer", default-features = false}
ekf_localizer = { path = "./ekf_localizer", default-features = false}
31 changes: 31 additions & 0 deletions applications/autoware/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
use std::{env, fs, path::PathBuf};

fn main() {
let out_dir = PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR is not set"));
let csv_data_path = out_dir.join("csv_data.rs");

let imu_csv = read_csv_from_env("IMU_CSV_PATH");
let velocity_csv = read_csv_from_env("VELOCITY_CSV_PATH");

let generated = format!(
"pub const IMU_CSV_DATA_STR: &str = {imu:?};\npub const VELOCITY_CSV_DATA_STR: &str = {velocity:?};\n",
imu = imu_csv,
velocity = velocity_csv,
);

fs::write(&csv_data_path, generated).expect("failed to write generated csv constants");
}

fn read_csv_from_env(var_name: &str) -> String {
let Ok(path) = env::var(var_name) else {
return String::new();
};

match fs::read_to_string(&path) {
Ok(contents) => contents,
Err(err) => {
println!("cargo:warning=failed to read {var_name} from {path}: {err}");
String::new()
}
}
}
6 changes: 6 additions & 0 deletions applications/autoware/common_types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "common_types"
version = "0.1.0"
edition = "2021"

[dependencies]
21 changes: 21 additions & 0 deletions applications/autoware/common_types/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#![no_std]
extern crate alloc;

#[derive(Debug, Clone)]
pub struct Header {
pub frame_id: &'static str,
pub timestamp: u64,
}

#[derive(Debug, Clone)]
pub struct Vector3 {
pub x: f64,
pub y: f64,
pub z: f64,
}

impl Vector3 {
pub fn new(x: f64, y: f64, z: f64) -> Self {
Self { x, y, z }
}
}
11 changes: 11 additions & 0 deletions applications/autoware/ekf_localizer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "ekf_localizer"
version = "0.1.0"
edition = "2021"

[dependencies]
libm = "0.2"
nalgebra = { version = "0.32", default-features = false}
approx = "0.5"
common_types = { path = "../common_types", default-features = false }
vehicle_velocity_converter = { path = "../vehicle_velocity_converter", default-features = false}
Loading
Loading