|
|
|
|
@ -361,15 +361,15 @@ void FollowerClass::calculate_position(float k,float theta,int plane){
|
|
|
|
|
Pf[0]=(transfer[0][0]*Q[0]+transfer[0][1]*Q[1])*T[0]+Pl[0]/100;
|
|
|
|
|
Pf[1]=(transfer[1][0]*Q[0]+transfer[1][1]*Q[1])*T[1]+Pl[1]/100;
|
|
|
|
|
|
|
|
|
|
// error_lon = PID_x.update(follower_location.lon*1e5 , Pf[0] ,follower_pid); //caculate error (PID)
|
|
|
|
|
// error_lat = PID_y.update(follower_location.lat*1e5 , Pf[1] ,follower_pid);
|
|
|
|
|
error_lon = PID_x.update(follower_location.lon*1e5 , Pf[0] ,follower_pid); //caculate error (PID)
|
|
|
|
|
error_lat = PID_y.update(follower_location.lat*1e5 , Pf[1] ,follower_pid);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// float error_x = PID_x.update1(follower_location.lon*1e5 , Pf[0] ); //caculate error
|
|
|
|
|
// float error_y = PID_y.update1(follower_location.lat*1e5 , Pf[1] );
|
|
|
|
|
|
|
|
|
|
error_lon = Pf[0] - (follower_location.lon*1e+5); //caculate error
|
|
|
|
|
error_lat = Pf[1] - (follower_location.lat*1e+5);
|
|
|
|
|
// error_lon = Pf[0] - (follower_location.lon*1e+5); //caculate error
|
|
|
|
|
// error_lat = Pf[1] - (follower_location.lat*1e+5);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float error_degree = deg_phi - heading;
|
|
|
|
|
@ -396,17 +396,17 @@ void FollowerClass::calculate_position(float k,float theta,int plane){
|
|
|
|
|
error_yaw = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (error_lon < -2){
|
|
|
|
|
error_lon = -2;
|
|
|
|
|
if (error_lon < -limit_speed){
|
|
|
|
|
error_lon = -limit_speed;
|
|
|
|
|
}
|
|
|
|
|
if (error_lon > 2){
|
|
|
|
|
error_lon = 2;
|
|
|
|
|
if (error_lon > limit_speed){
|
|
|
|
|
error_lon = limit_speed;
|
|
|
|
|
}
|
|
|
|
|
if (error_lat < -2){
|
|
|
|
|
error_lat = -2;
|
|
|
|
|
if (error_lat < -limit_speed){
|
|
|
|
|
error_lat = -limit_speed;
|
|
|
|
|
}
|
|
|
|
|
if (error_lat > 2){
|
|
|
|
|
error_lat = 2;
|
|
|
|
|
if (error_lat > limit_speed){
|
|
|
|
|
error_lat = limit_speed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ROS_INFO("%d,%f,%f",refpos.ID,refpos.lon ,refpos.lat );
|
|
|
|
|
|