Accomplished
This week, I implemented the firmware for reading data measurements from the ICM20948 IMU sensor over SPI. At first, I measured only the gyroscope values and not the accelerometer and magnetometer. However, after integrating the angular velocity over time to find absolute heading, we noticed significant drift in the gyroscope. After some research, I decided to implement the Madgwick filter for a better estimate of yaw, pitch, and roll, since it does better against drift by combining data from the gyroscope, accelerometer, and magnetometer. However, after some testing, I realized it would be best to leave out the magnetometer, and base the estimate on just gyroscope and accelerometer data instead.
After getting a more consistent reading of yaw, pitch, and roll, Enrique and I worked together to map roll to servo angle PWM, and integrated the IMU firmware with his bluetooth code to send servo PWM high-times to the STM32. The result was being able to control the servo on the Kar by the rolling angle of the IMU.

Progress / Schedule
I am back on track as Enrique and I have started working together to integrate our individual subsystems on the Kar. Our plan is to finish prototyping the MVP so we can migrate the firmware to the final hardware PCBs and begin testing.
Deliverables / Next Steps
Next week, I will:
- currently we plan on doing very simple linear mapping between IMU roll and pitch and Kar steering and drive, however we will need to look into a more optimal and realistic mapping.
- continue communicating with the haptic controller over I2C and generating different types of feedback.
