|
|
|
|
@ -37,8 +37,8 @@ int main(int argc, char **argv) {
|
|
|
|
|
|
|
|
|
|
// global_location pos[] = {target,self,M1,M2};
|
|
|
|
|
// global_location member[] = {M1,M2};
|
|
|
|
|
global_location pos[] = {target,self,M1,M2,M3,M4};
|
|
|
|
|
global_location member[] = {M1,M2,M3,M4};
|
|
|
|
|
global_location* pos[] = {&target,&self,&M1,&M2,&M3,&M4};
|
|
|
|
|
global_location* member[] = {&M1,&M2,&M3,&M4};
|
|
|
|
|
size_t index = sizeof(pos)/sizeof(pos[0]);
|
|
|
|
|
size_t m_index = sizeof(member)/sizeof(member[0]);
|
|
|
|
|
|
|
|
|
|
@ -46,17 +46,26 @@ int main(int argc, char **argv) {
|
|
|
|
|
control_object.arm();
|
|
|
|
|
control_object.takeoff(2);
|
|
|
|
|
|
|
|
|
|
checkLeader = check_leader(pos,index).is_leader;
|
|
|
|
|
checkLeader = check_leader(*pos,index).is_leader;
|
|
|
|
|
if(checkLeader != 1){
|
|
|
|
|
ref_ID = follower_object.find_ref_drone(pos,index,check_leader(pos,index).leader_ID); //find_ref_drone(pos,index,leader_ID);
|
|
|
|
|
ref_ID = follower_object.find_ref_drone(*pos,index,check_leader(*pos,index).leader_ID); //find_ref_drone(pos,index,leader_ID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while(true){
|
|
|
|
|
|
|
|
|
|
// self = request_object.get_self_GPS();
|
|
|
|
|
// M1 = request_object.get_M1_GPS();
|
|
|
|
|
// M2 = request_object.get_M2_GPS();
|
|
|
|
|
// M3 = request_object.get_M3_GPS();
|
|
|
|
|
// M4 = request_object.get_M4_GPS();
|
|
|
|
|
// pos[] = {target,self,M1,M2,M3,M4};
|
|
|
|
|
// member[] = {M1,M2,M3,M4};
|
|
|
|
|
|
|
|
|
|
if(checkLeader == 1){
|
|
|
|
|
// leader_object.leader(target);
|
|
|
|
|
}else{
|
|
|
|
|
follower_object.follower(member,m_index,ref_ID); //follow reference drone position
|
|
|
|
|
ref_ID = follower_object.find_ref_drone(*pos,index,check_leader(*pos,index).leader_ID);
|
|
|
|
|
follower_object.follower(*member,m_index,ref_ID); //follow reference drone position
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ros::waitForShutdown();
|
|
|
|
|
|