You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Angle & angle_prev from 0 ~ 360°. Angles will not become large.
// TODO sensor precision: the shaft_angle actually stores the complete position, including full rotations, as a float
// For this reason it is NOT precise when the angles become large.
// Additionally, the way LPF works on angle is a precision issue, and the angle-LPF is a problem
// when switching to a 2-component representation.
step 1:
if(mechanic_angle > mechanic_angle_prev + 180){
mechanic_angle -= 360;
}else if(mechanic_angle < mechanic_angle_prev - 180){
mechanic_angle += 360;
}
step 2:
LPF_angle(mechanic_angle);
step 3:
if(mechanic_angle >= 360.0f){
mechanic_angle -= 360.0f;
}else if(mechanic_angle < 0.0f){
mechanic_angle += 360.0f;
}
step 4:
if(LPF_angle.y_prev >= 360){
LPF_angle.y_prev -=360;
rotation_cnt += 1;
}
if(LPF_angle.y_prev < 0){
LPF_angle.y_prev +=360;
rotation_cnt -= 1;
}
The text was updated successfully, but these errors were encountered: