bionic (unfinished)

This commit is contained in:
2023-02-09 23:56:07 +08:00
parent 9701eb22d0
commit 66581e37d2
5 changed files with 26 additions and 4 deletions
@@ -1,7 +1,10 @@
#include <std_msgs/String.h> #include <std_msgs/String.h>
#include "class_model/gps_location.h"
typedef struct DroneStatus typedef struct DroneStatus
{ {
/* data */ /* data */
global_location init_location;
int plane; int plane;
std::string leader; std::string leader;
std::string DroneName;
} DroneStatus; } DroneStatus;
@@ -27,6 +27,9 @@ public:
void follower(); void follower();
float lon[3],lat[3];
private: private:
// ROS NodeHandle // ROS NodeHandle
ros::NodeHandle node_handle_; ros::NodeHandle node_handle_;
@@ -39,6 +42,7 @@ private:
void plane(global_location target_location,global_location leader_location,global_location follower_location); void plane(global_location target_location,global_location leader_location,global_location follower_location);
void choose_leader(); void choose_leader();
void follow(); void follow();
void get_location();
}; };
+17 -2
View File
@@ -22,13 +22,28 @@ void FollowerClass::plane(global_location target_location,global_location leader
c = target_location.lat - slope*target_location.lon; c = target_location.lat - slope*target_location.lon;
y = slope * follower_location.lon + c; y = slope * follower_location.lon + c;
// if() if(follower_location.lat >= y){
drone1.plane = 1; //right plane
}else if(follower_location.lat < y){
drone1.plane = 0; //left plane
}
//choose_leader() choose_leader();
} }
void FollowerClass::choose_leader(){ void FollowerClass::choose_leader(){
}
void FollowerClass::get_location(){
// lon[0]
} }
void FollowerClass::calculate_position(float k,float theta){ void FollowerClass::calculate_position(float k,float theta){
+1 -1
View File
@@ -1,5 +1,5 @@
MQTT: MQTT:
msg_format: Proto msg_format: Json
MQTTClientNamePub: Drone550Pub MQTTClientNamePub: Drone550Pub
host: 140.120.31.133 host: 140.120.31.133
port: 1883 port: 1883
+1 -1
View File
@@ -1,5 +1,5 @@
MQTT: MQTT:
msg_format: Proto msg_format: Json
MQTTClientNameSub: Drone550Sub MQTTClientNameSub: Drone550Sub
host: 140.120.31.133 host: 140.120.31.133
port: 1883 port: 1883