Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c9c177d
add: test_autoware/lib.rs
nokosaaan May 8, 2026
a20c0f3
fix: apply cargo fmt 5
nokosaaan May 8, 2026
15c8668
fix: fallback when len=0
nokosaaan May 8, 2026
3f8bd22
fix: apply clippy error
nokosaaan May 8, 2026
7625192
fix: apply clippy error 2
nokosaaan May 8, 2026
581a3fd
fix: apply clippy error 3
nokosaaan May 8, 2026
57887bc
fix: apply cargo fmt 6
nokosaaan May 8, 2026
c9261d2
fix: apply clippy error 4
nokosaaan May 8, 2026
4989f94
fix: apply clippy error 5
nokosaaan May 8, 2026
c77328e
fix: apply clippy error 6
nokosaaan May 8, 2026
f88665b
fix: dependics path 2
nokosaaan May 11, 2026
a96a065
fix: move autoware position 4
nokosaaan May 11, 2026
cb25fdc
fix: default feature
nokosaaan May 11, 2026
e99da01
fix: comment 3
nokosaaan May 11, 2026
9fbaf13
fix: comment 4
nokosaaan May 11, 2026
d1c2875
fix: delete Odometry from vehicle_velocity_converter
nokosaaan May 20, 2026
9750c99
Merge branch 'main' of https://github.com/tier4/awkernel into test_au…
nokosaaan Jun 4, 2026
568ca02
Merge branch 'test_autoware' of https://github.com/tier4/awkernel int…
nokosaaan Jun 4, 2026
2d8d871
fix: resolve merge conflict
nokosaaan Jun 4, 2026
cbd04c2
Merge branch 'main' of https://github.com/tier4/awkernel into test_au…
nokosaaan Jul 22, 2026
c601ebe
Merge branch 'main' of https://github.com/tier4/awkernel into test_au…
nokosaaan Jul 23, 2026
428d3e2
fix: ignore log file 2
nokosaaan Aug 1, 2026
bdcba3f
Merge branch 'main' of https://github.com/tier4/awkernel into test_au…
nokosaaan Aug 1, 2026
bec592e
Merge branch 'ekf_localizer' of https://github.com/tier4/awkernel int…
nokosaaan Aug 1, 2026
712f7dd
feat: DAG FasS connection with KVM option
nokosaaan Aug 1, 2026
3620756
fix: cargo clippy_aarch64_virt
nokosaaan Aug 1, 2026
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
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ else
OPT = --features debug
endif

# KVM=1 to accelerate x86_64 QEMU with KVM (requires /dev/kvm access on the host).
# Off by default since not every environment (CI, nested virtualization without KVM
# passthrough, non-Linux hosts) has it available.
ifeq ($(KVM), 1)
QEMU_KVM_ARGS = -enable-kvm -cpu host
else
QEMU_KVM_ARGS =
endif

# 2MiB Stack
STACKSIZE = 1024 * 1024 * 2

Expand Down Expand Up @@ -143,7 +152,7 @@ check_x86_64: $(X86ASM)
cargo +$(RUSTV) check_x86

kernel-x86_64.elf: $(X86ASM) FORCE
RUSTFLAGS="$(RUSTC_MISC_ARGS)" cargo +$(RUSTV) x86 $(OPT)
RUSTFLAGS="$(RUSTC_MISC_ARGS)" IMU_CSV_PATH=$(IMU_CSV_PATH) VELOCITY_CSV_PATH=$(VELOCITY_CSV_PATH) cargo +$(RUSTV) x86 $(OPT)
python3 scripts/embed_debug_info.py $@

x86_64_boot.img: kernel-x86_64.elf
Expand All @@ -157,10 +166,14 @@ $(X86ASM): FORCE

OVMF_PATH := $(shell cat ${HOME}/.ovmfpath)

IMU_CSV_PATH ?= $(CURDIR)/../awkernel_script/sensor_inputs/imu_raw.csv
VELOCITY_CSV_PATH ?= $(CURDIR)/../awkernel_script/sensor_inputs/velocity_status.csv

QEMU_X86_ARGS= -drive if=pflash,format=raw,readonly=on,file=${OVMF_PATH}/code.fd
QEMU_X86_ARGS+= -drive if=pflash,format=raw,file=${OVMF_PATH}/vars_qemu.fd
QEMU_X86_ARGS+= -drive format=raw,file=x86_64_uefi.img
QEMU_X86_ARGS+= -machine q35
QEMU_X86_ARGS+= $(QEMU_KVM_ARGS)
QEMU_X86_ARGS+= -serial stdio -smp 4 -monitor telnet::5556,server,nowait
QEMU_X86_ARGS+= -m 4G -smp cpus=16
QEMU_X86_ARGS+= -object memory-backend-ram,size=1G,id=m0
Expand Down
2 changes: 1 addition & 1 deletion applications/autoware/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +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()
}
}
}
2 changes: 1 addition & 1 deletion applications/autoware/ekf_localizer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl Simple1DFilter {

let kalman_gain = self.var / (self.var + obs_var);
self.x += kalman_gain * (obs - self.x);
self.var = (1.0 - kalman_gain) * self.var;
self.var *= 1.0 - kalman_gain;
}

pub fn set_proc_var(&mut self, proc_var: f64) {
Expand Down
47 changes: 26 additions & 21 deletions applications/autoware/gyro_odometer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const COV_IDX_XYZRPY_PITCH_PITCH: usize = 28;
const COV_IDX_XYZRPY_YAW_YAW: usize = 35;

pub struct GyroOdometerCore {
pub output_frame: String,
pub output_frame: &'static str,
pub message_timeout_sec: f64,
pub vehicle_twist_arrived: bool,
pub imu_arrived: bool,
Expand All @@ -59,7 +59,7 @@ pub struct GyroOdometerCore {
impl GyroOdometerCore {
pub fn new(config: GyroOdometerConfig) -> Result<Self> {
let queue_size = config.queue_size;
let output_frame = config.output_frame.clone();
let output_frame = config.output_frame;
let message_timeout_sec = config.message_timeout_sec;

Ok(Self {
Expand Down Expand Up @@ -118,8 +118,8 @@ impl GyroOdometerCore {
}

let tf = self.get_transform(
&self.gyro_queue.front().unwrap().header.frame_id,
&self.output_frame,
self.gyro_queue.front().unwrap().header.frame_id,
self.output_frame,
)?;

// In the original C++ implementation, angular_velocity_covariance is also transformed
Expand All @@ -137,7 +137,7 @@ impl GyroOdometerCore {

for vehicle_twist in &self.vehicle_twist_queue {
vx_mean += vehicle_twist.twist.twist.linear.x;
vx_covariance_original += vehicle_twist.twist.covariance[0 * 6 + 0];
vx_covariance_original += vehicle_twist.twist.covariance[0];
}
vx_mean /= self.vehicle_twist_queue.len() as f64;
vx_covariance_original /= self.vehicle_twist_queue.len() as f64;
Expand Down Expand Up @@ -168,7 +168,7 @@ impl GyroOdometerCore {

let mut result = TwistWithCovarianceStamped {
header: Header {
frame_id: self.gyro_queue.front().unwrap().header.frame_id,
frame_id: self.output_frame,
timestamp: result_timestamp,
},
twist: TwistWithCovariance {
Expand Down Expand Up @@ -201,15 +201,22 @@ impl GyroOdometerCore {
let dt = (current_timestamp as f64 - last_timestamp as f64) / 1_000_000_000.0;
dt.abs() > timeout_sec
}
pub fn get_transform(&self, from_frame: &str, to_frame: &str) -> Result<Transform> {
pub fn get_transform(&self, _from_frame: &str, _to_frame: &str) -> Result<Transform> {
// This exists to rotate the raw gyro's angular velocity out of the IMU's own mounting
// orientation (`from_frame`, e.g. `imu_link`) and into the vehicle body frame
// (`to_frame`, `output_frame`/"base_link"). If the IMU isn't mounted perfectly aligned
// with the vehicle body, its raw yaw-axis reading is not exactly the vehicle's own yaw
// rate -- some of it leaks in from roll/pitch, and vice versa. `measurement_update_twist`
// downstream assumes `wz` already IS the vehicle's base_link yaw rate, so any
// uncorrected mounting misalignment biases the fused estimate.
//
// In the original implementation, a TF lookup failure should clear the queues and
// terminate processing early. This port currently returns identity because the
// evaluation setup uses a fixed identity transform.
if from_frame == to_frame || from_frame == "" || to_frame == "" {
Ok(Transform::identity())
} else {
Ok(Transform::identity())
}
// terminate processing early. This port currently always returns identity because the
// evaluation setup uses a fixed identity transform (IMU assumed perfectly aligned with
// base_link); there is no real TF lookup yet -- a real one would query calibrated sensor
// extrinsics (typically a fixed static offset for an IMU-to-base_link mount) instead of
// hardcoding identity here.
Ok(Transform::identity())
}

// The original C++ node publishes four topics: raw TwistStamped, raw TwistWithCovarianceStamped,
Expand Down Expand Up @@ -255,10 +262,8 @@ impl GyroOdometerCore {
&mut self,
current_time: u64,
) -> Option<TwistWithCovarianceStamped> {
match self.concat_gyro_and_odometer(current_time) {
Ok(result) => result,
Err(_) => None,
}
self.concat_gyro_and_odometer(current_time)
.unwrap_or_default()
}

pub fn get_queue_sizes(&self) -> (usize, usize) {
Expand Down Expand Up @@ -303,7 +308,7 @@ type Result<T> = core::result::Result<T, GyroOdometerError>;

#[derive(Debug, Clone)]
pub struct GyroOdometerConfig {
pub output_frame: String,
pub output_frame: &'static str,
pub message_timeout_sec: f64,
pub queue_size: usize,
pub transform_timeout: Duration,
Expand All @@ -314,7 +319,7 @@ pub struct GyroOdometerConfig {
impl Default for GyroOdometerConfig {
fn default() -> Self {
Self {
output_frame: String::from("base_link"),
output_frame: "base_link",
message_timeout_sec: 1.0,
queue_size: 100,
transform_timeout: Duration::from_secs(1),
Expand Down Expand Up @@ -358,7 +363,7 @@ mod tests {

fn get_config_with_default_params() -> GyroOdometerConfig {
GyroOdometerConfig {
output_frame: String::from("base_link"),
output_frame: "base_link",
message_timeout_sec: 1e12,
..GyroOdometerConfig::default()
}
Expand Down
4 changes: 2 additions & 2 deletions applications/autoware/imu_corrector/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ impl<T: TransformListener> ImuCorrector<T> {
pub fn correct_imu_with_dynamic_tf(&self, imu_msg: &ImuMsg) -> Option<ImuMsg> {
let transform = self
.transform_listener
.get_latest_transform(&imu_msg.header.frame_id, self.config.output_frame)?;
.get_latest_transform(imu_msg.header.frame_id, self.config.output_frame)?;

let corrected_with_cov = self.correct_imu_with_covariance(imu_msg, Some(&transform));
Some(corrected_with_cov.to_imu_msg())
Expand All @@ -286,7 +286,7 @@ impl<T: TransformListener> ImuCorrector<T> {
) -> Option<ImuWithCovariance> {
let transform = self
.transform_listener
.get_latest_transform(&imu_msg.header.frame_id, self.config.output_frame)?;
.get_latest_transform(imu_msg.header.frame_id, self.config.output_frame)?;

Some(self.correct_imu_with_covariance(imu_msg, Some(&transform)))
}
Expand Down
Loading
Loading