|
|
|
@ -109,10 +109,11 @@ void FormationClass::leader1(float x,float y){
|
|
|
|
|
|
|
|
|
|
|
|
void FormationClass::follower1(int type){
|
|
|
|
void FormationClass::follower1(int type){
|
|
|
|
|
|
|
|
|
|
|
|
std::string command,pre_command = "";
|
|
|
|
std::string command = "";
|
|
|
|
|
|
|
|
std::string pre_command = receiver_object.check_command();
|
|
|
|
int message;
|
|
|
|
int message;
|
|
|
|
while(true){
|
|
|
|
while(true){
|
|
|
|
|
|
|
|
|
|
|
|
if(type == 0){
|
|
|
|
if(type == 0){
|
|
|
|
calculate_position(4,30);
|
|
|
|
calculate_position(4,30);
|
|
|
|
}else if(type == 1){
|
|
|
|
}else if(type == 1){
|
|
|
|
@ -130,12 +131,13 @@ void FormationClass::follower1(int type){
|
|
|
|
command = receiver_object.check_command();
|
|
|
|
command = receiver_object.check_command();
|
|
|
|
// message = request_object.get_formation_message();
|
|
|
|
// message = request_object.get_formation_message();
|
|
|
|
// ROS_INFO("%d",message);
|
|
|
|
// ROS_INFO("%d",message);
|
|
|
|
|
|
|
|
// std::cout<<command<<std::endl;
|
|
|
|
|
|
|
|
// std::cout<<"/"<<pre_command<<std::endl;
|
|
|
|
|
|
|
|
|
|
|
|
if(command != pre_command ){
|
|
|
|
if(command != pre_command ){
|
|
|
|
// ROS_INFO("change formation");
|
|
|
|
ROS_INFO("change formation");
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pre_command = command;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -464,11 +466,11 @@ void FormationClass::calculate_position(float k,float theta,int direction){
|
|
|
|
error_yaw = 0;
|
|
|
|
error_yaw = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ROS_INFO("%f,%f",leader_location.lon/100 ,leader_location.lat/100);
|
|
|
|
// ROS_INFO("%f,%f",leader_location.lon/100 ,leader_location.lat/100);
|
|
|
|
ROS_INFO("%f,%f",follower_location.lon*1e+5 ,follower_location.lat*1e+5);
|
|
|
|
// ROS_INFO("%f,%f",follower_location.lon*1e+5 ,follower_location.lat*1e+5);
|
|
|
|
ROS_INFO("%f,%f",Pf[0],Pf[1]);
|
|
|
|
// ROS_INFO("%f,%f",Pf[0],Pf[1]);
|
|
|
|
ROS_INFO("%f,%f",error_x,error_y);
|
|
|
|
// ROS_INFO("%f,%f",error_x,error_y);
|
|
|
|
ROS_INFO("%f,%f",error_lon,error_lat);
|
|
|
|
// ROS_INFO("%f,%f",error_lon,error_lat);
|
|
|
|
// ROS_INFO("deg:%f",deg_phi);
|
|
|
|
// ROS_INFO("deg:%f",deg_phi);
|
|
|
|
// ROS_INFO("heading:%f",heading);
|
|
|
|
// ROS_INFO("heading:%f",heading);
|
|
|
|
// ROS_INFO("error_degree:%f",error_degree);
|
|
|
|
// ROS_INFO("error_degree:%f",error_degree);
|
|
|
|
|