PI control problem

protobuf
Xuan0319 3 years ago
parent 414c01a502
commit 3597e3d901

@ -40,6 +40,7 @@ public:
int find_ref_drone(global_location** data, size_t index, int leaderID); int find_ref_drone(global_location** data, size_t index, int leaderID);
float lon[3],lat[3]; float lon[3],lat[3];
global_location vector_LT,vector_SM;
private: private:

@ -127,11 +127,13 @@ void FollowerClass::plane(global_location* target, global_location* leader, glob
int FollowerClass::direct(global_location* target, global_location* leader, DroneStatus self, DroneStatus member){ int FollowerClass::direct(global_location* target, global_location* leader, DroneStatus self, DroneStatus member){
global_location vector_LT,vector_SM;
float m,n,k,cosTheta; float m,n,k,cosTheta;
if(flag == 0){
vector_LT.lon = target->lon - leader->lon; //vector_LT (leader->target) vector_LT.lon = target->lon - leader->lon; //vector_LT (leader->target)
vector_LT.lat = target->lat - leader->lat; vector_LT.lat = target->lat - leader->lat;
flag = 1;
}
vector_SM.lon = member.init_location.lon - self.init_location.lon; //vector_SM (self->member) vector_SM.lon = member.init_location.lon - self.init_location.lon; //vector_SM (self->member)
vector_SM.lat = member.init_location.lat - self.init_location.lat; vector_SM.lat = member.init_location.lat - self.init_location.lat;
k = (vector_LT.lon*vector_SM.lon)+(vector_LT.lat*vector_SM.lat); //k = vector_LT dot vector_SM k = (vector_LT.lon*vector_SM.lon)+(vector_LT.lat*vector_SM.lat); //k = vector_LT dot vector_SM

Loading…
Cancel
Save