combine compass and velocity into topic DroneStatus
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
/*Publish Compass & velocity data to topic "DroneStatus"*/
|
||||
#ifndef PUBDATA_H
|
||||
#define PUBDATA_H
|
||||
|
||||
#include <ros/ros.h>
|
||||
#include <sensor_msgs/NavSatFix.h>
|
||||
#include <std_msgs/Float64.h>
|
||||
#include <mavros_msgs/Waypoint.h>
|
||||
#include "class_model/velocity.h"
|
||||
|
||||
class PubDataClass {
|
||||
public:
|
||||
PubDataClass();
|
||||
virtual ~PubDataClass();
|
||||
void publishData(velocity v);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
// ROS NodeHandle
|
||||
ros::NodeHandle node_handle_;
|
||||
|
||||
//SUBSCRIBE
|
||||
ros::Subscriber Compass;
|
||||
|
||||
//PUBLISH
|
||||
ros::Publisher PubData;
|
||||
|
||||
mavros_msgs::Waypoint msg;
|
||||
float heading;
|
||||
void Compass_callback(const std_msgs::Float64::ConstPtr °ree);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // PUBDATA_H
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "class_model/command.h"
|
||||
#include "class_model/requestData.h"
|
||||
#include "class_model/PID.h"
|
||||
#include "class_model/PubData.h"
|
||||
#include <std_msgs/String.h>
|
||||
|
||||
|
||||
@@ -25,6 +26,7 @@ public:
|
||||
ControlClass control_object;
|
||||
CommandClass command_object;
|
||||
RequestClass request_object;
|
||||
PubDataClass PubData_object;
|
||||
PIDClass PID_x;
|
||||
PIDClass PID_y;
|
||||
|
||||
@@ -48,6 +50,7 @@ private:
|
||||
global_location follower_location;
|
||||
global_location leader_location;
|
||||
global_location current_location;
|
||||
velocity drone_speed;
|
||||
int flag = 0,heading_status = 0;
|
||||
float pre_alt,cur_alt;
|
||||
float leader_pid[3] = {0.5 , 0.000000000001 ,0.5};
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef VELOCITY_H
|
||||
#define VELOCITY_H
|
||||
|
||||
typedef struct velocity{
|
||||
float x,y;
|
||||
}velocity;
|
||||
|
||||
#endif // VELOCITY_H
|
||||
Reference in New Issue
Block a user