P I D AND GY80 10 DOF
I am sorry, but I may not have understood your post, but I think the problem is your code doesn't work and you don't know why.  I think the problem is with this line:

if(val.m_y,2 &gt;2 ||val.m_y,2&lt;0){


It is because it is not valid code, I suspect its a cut and paste error and should be 

if(val.m_y &gt; 2.0 || val.m_y &lt; 0.0){


the ,2 you use in the print statements specifies the number of digits to print after the decimal point (I think).