Skip to content

Commit 2d63173

Browse files
committed
Fixing the error term
1 parent 31535cf commit 2d63173

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

precision_steering_algorithms/src/phase_space_steering.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ PLUGINLIB_DECLARE_CLASS(precision_steering_algorithms, PhaseSpaceSteering, phase
6666
ROS_DEBUG("d was %f", d);
6767
if (des_state.seg_type == precision_navigation_msgs::PathSegment::SPIN_IN_PLACE) {
6868
double deltaPsi = psi_des - tf::getYaw(current_odom.pose.pose.orientation);
69+
while (deltaPsi>pi) {
70+
deltaPsi-=2*pi;
71+
}
72+
while (deltaPsi< -pi) {
73+
deltaPsi+=2*pi;
74+
}
6975
ROS_DEBUG("DeltaPSI for spin in place was %f", deltaPsi);
7076
double omega_cmd = k_psi*deltaPsi + des_state.des_speed;
7177
command_vel.linear.x = 0.0;
@@ -101,4 +107,4 @@ PLUGINLIB_DECLARE_CLASS(precision_steering_algorithms, PhaseSpaceSteering, phase
101107
command_vel.angular.z = omega;
102108
}
103109
}
104-
};
110+
};

0 commit comments

Comments
 (0)