implement imu algorithm