# How can I incrementally count the angle in yaw from IMU data?

I have already a program which subscribes to the information of the yaw angle provided by the IMU, in advance it is known that the angle is given from -pi to pi, for this reason, I have already normalized the angle so that the angle is in the range from 0 to 2 * pi. However, my goal is to make the program incrementally calculate the rotation in yaw. I mean, if the robot rotates 3 turns in CCW the angle must be 6 * pi, and inversely if the robot rotates 3 turns in CW the angle must be the same as the initial position.