← Back to Portfolio

RaspberryPi GNC and Navigation

Inertial State Estimation & 9-DOF Sensor Fusion

Tools: RaspberryPi, Python Category: School Project Term: Fall 2025

Overview

ROLE: Team Lead (Team 3) | INSTITUTION: USC Astronautical Engineering (ASTE-101)


As part of ASTE101's final project, students were given a RaspberryPi Zero module with a BerryIMU attached to it. The project involved the development of a real-time inertial navigation system (INS) designed to estimate the orientation and position of a 9-DOF flight controller. I oversaw the process and designed the software architecture as well as the implementation of noise-mitigation protocols.

The Navigation Stack

  • Orientation Filter: Deployed a Complementary Filter to fuse high-frequency Angular Velocity ($\omega$) with low-frequency Accelerometer/Magnetometer references.
  • Dynamic Rotation: Calculated a Direction Cosine Matrix (DCM) to rotate body-fixed acceleration vectors into the North-East-Down (NED) world frame.
  • Drift Mitigation: Engineered a computational failsafe using an acceleration deadzone ($0.15 \, m/s^2$) and velocity decay constant ($0.98$) to stabilize the integration loop.

Logic Module

COMPLEMENTARY_FILTER_LOGIC
        
        # [V&V] Fusing high-freq gyro with low-freq acc references
        # Alpha = 0.75 for coordinate finder, 0.98 for navigation

        roll  = ALPHA * (roll + gx * dt) + (1 - ALPHA) * roll_acc
        pitch = ALPHA * (pitch + gy * dt) + (1 - ALPHA) * pitch_acc
        yaw   = ALPHA * (yaw + gz * dt) + (1 - ALPHA) * yaw_mag
        
            
COORDINATE_TRANSFORMATION (DCM)
        
        # [V&V] BODY-TO-WORLD FRAME ROTATION
        # Translating IMU orientation into North-East-Down (NED) world frame

        # Constructing Rotation Matrix (R) using Yaw, Pitch, Roll
        R = Rz(yaw) @ Ry(pitch) @ Rx(roll)

        # Transforming body acceleration to world frame and subtracting gravity
        acc_world = R @ np.array([ax_m, ay_m, az_m]) - gravity
        
            

INTENT: Resolves the orientation of the vehicle relative to Earth's gravity vector, allowing for accurate trajectory mapping in three dimensions.

DRIFT_MITIGATION_PROTOCOLS
            
            # [V&V] NOISE_MITIGATION & POSITION_STABILIZATION

            # 01: ACCEL_DEADZONE - Filter low-level vibrational noise
            if np.linalg.norm(acc_world) < 0.15:
            acc_world = np.zeros(3)

            # 02: VELOCITY_DECAY - Bleed off integration errors to prevent divergence
            vel_world = (vel_world + acc_world * dt) * 0.98
            pos_world = pos_world + vel_world * dt
        
            

INTENT: Implements a noise-floor threshold and a decay constant to counteract the "random walk" inherent in double-integration of IMU data.

Post-Mission Analysis

By applying a customized alpha coefficient ($\alpha=0.75$), the system successfully resolved attitude within a 2.5% error margin during dynamic testing. This project served as a foundational proof-of-concept for autonomous guidance logic in amateur rocketry.

🚀