how to measure an angle?
Dear,
I want to measure yaw angle (radian). What command should I use ? In my c++ file, I used like this;
double q0 = odom->pose.pose.orientation.w;
double q1 = odom->pose.pose.orientation.x;
double q2 = odom->pose.pose.orientation.y;
double q3 = odom->pose.pose.orientation.z;
double omega = odom->twist.twist.angular.z;
double psi = atan2(2*(q0*q3+q1*q2),1-2*(q2*q2+q3*q3));
This yaw angle produce only between -pi and pi. But I want to measure directly the yaw angle in radian without the limitation of -pi and +pi, that is, measure the counter-clockwise one and half circling as +3 pi and the clockwise two circling as -4*pi.
One alternative can be coded this way:
double omega = odom->twist.twist.angular.z;
double delta_psi = omega*dt;
psi += delta_psi;
But the heading angle psi might accumulate some integration error. Do I have to implement more accurate integration method ?