tested class PubInfo complete.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "class_model/mission.h"
|
||||
#include "class_model/choose_leader.h"
|
||||
#include "class_model/PubData.h"
|
||||
#include "class_model/PubInfo.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
@@ -17,7 +17,7 @@ int main(int argc, char **argv) {
|
||||
MissionClass mission_object;
|
||||
CommandClass command_object;
|
||||
SelectClass select_formation;
|
||||
PubDataClass PubData_object;
|
||||
PubInfoClass PubInfo_object;
|
||||
|
||||
// SelectionClass selection_object;
|
||||
|
||||
@@ -30,11 +30,16 @@ int main(int argc, char **argv) {
|
||||
// selection_object.choose_leader();
|
||||
// mission_object.start(); //default hover in goose formation
|
||||
|
||||
INFO msg;
|
||||
msg.type = "V_formation";
|
||||
msg.mission = "fly2target";
|
||||
|
||||
while(ros::ok()){
|
||||
|
||||
|
||||
//json_object.get_command(); //for follower
|
||||
select_formation.goose_formation();
|
||||
//select_formation.goose_formation();
|
||||
PubInfo_object.pub_info(msg);
|
||||
}
|
||||
|
||||
ros::waitForShutdown();
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
#coding:utf-8
|
||||
import rospy
|
||||
from mavros_msgs.msg import Waypoint
|
||||
# from mavros_msgs.msg import Waypoint
|
||||
from diagnostic_msgs.msg import KeyValue
|
||||
|
||||
def callBack(data):
|
||||
print (data.param1)
|
||||
print (data)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
nodeName = 'subscriber_py'
|
||||
rospy.init_node(nodeName)
|
||||
topicName = '/DroneStatus'
|
||||
subscriber = rospy.Subscriber(topicName,Waypoint,callBack) #從topic獲取string再呼叫callback
|
||||
topicName = '/Flight_Information_reciver'
|
||||
subscriber = rospy.Subscriber(topicName,KeyValue,callBack) #從topic獲取string再呼叫callback
|
||||
rospy.spin()
|
||||
Reference in New Issue
Block a user