Reading a compass

Hi,
I made a sensor fusion to make my yaw axis a bit better.
I read my compass with this code. Unfortunately I don't know exactly what this code is doing, because the source code of the library (ardu mega pilot) is not so well documented. My questions are:

  • Do I have to use degrees or rad measures when creating the dcm matrix?
  • What are these roll/pitch attributes doing and how are they influencing the heading?

I.e. when I set the current roll/pitch then the heading measurement seems not to work around the yaw axis! But this is exactly what I do not want. Can someone help me? I have a "AP_COMPASS_TYPE_HMC5883L" compass.

Greetings

    Matrix3f dcm_matrix;
    dcm_matrix.from_euler(ToRad(roll), ToRad(pitch), 0);
    heading = compass.calculate_heading(dcm_matrix);