Are the quaternions being used anywhere?  From what I can see they are not, which makes sense since only pitch matters.  Same applies to the quat values in  `state0`.