|
|
|
@ -2,7 +2,8 @@
|
|
|
|
|
#include "../include/Air_Ground_CEC/mainwindow.hpp"
|
|
|
|
|
#include <QtConcurrent/QtConcurrent>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
#include "../include/Djitellowhite.h"
|
|
|
|
|
#include "../include/Hardwarelistener.h"
|
|
|
|
|
MainWindow::MainWindow(int argc, char **argv, QWidget *parent) :
|
|
|
|
|
QMainWindow(parent), qnode(argc, argv),
|
|
|
|
|
ui(new Ui::MainWindow)
|
|
|
|
@ -399,8 +400,8 @@ void MainWindow::importFrame()
|
|
|
|
|
|
|
|
|
|
void MainWindow::on_Open_receive_clicked()
|
|
|
|
|
{
|
|
|
|
|
capture.open(0);
|
|
|
|
|
//capture.open("udp://@0.0.0.0:11111");
|
|
|
|
|
//capture.open(0);//video test
|
|
|
|
|
capture.open("udp://@0.0.0.0:11111");
|
|
|
|
|
timer->start(30);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -410,6 +411,53 @@ void MainWindow::on_Stop_receive_clicked()
|
|
|
|
|
capture.release();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void* Telloconnect(void *pt){
|
|
|
|
|
Tello T("192.168.10.1");
|
|
|
|
|
int socket_fd, err;
|
|
|
|
|
|
|
|
|
|
if((socket_fd = socket(PF_INET,SOCK_DGRAM,IPPROTO_UDP))==-1)
|
|
|
|
|
{
|
|
|
|
|
cout << "initialized error" << endl;
|
|
|
|
|
cout << 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//cout << 1 << socket_fd;
|
|
|
|
|
T.set_conf(socket_fd);
|
|
|
|
|
|
|
|
|
|
pthread_t thread_receive;
|
|
|
|
|
|
|
|
|
|
err = pthread_create(&thread_receive,nullptr,T.udp_response_receiver,&socket_fd);
|
|
|
|
|
|
|
|
|
|
sleep(3);
|
|
|
|
|
struct sockaddr_in serveraddr;
|
|
|
|
|
memset(&serveraddr,0,sizeof(serveraddr));
|
|
|
|
|
serveraddr.sin_family=AF_INET;
|
|
|
|
|
serveraddr.sin_addr.s_addr=T.gethost();
|
|
|
|
|
serveraddr.sin_port=htons(CONTROL_UDP_PORT);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(err!=0)
|
|
|
|
|
{
|
|
|
|
|
cout << err << " " << "can't create thread";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
T.get_connect(serveraddr);
|
|
|
|
|
//sleep(1);
|
|
|
|
|
//T.takeoff(serveraddr);
|
|
|
|
|
T.get_video(serveraddr);
|
|
|
|
|
sleep(5);
|
|
|
|
|
//T.land(serveraddr);
|
|
|
|
|
|
|
|
|
|
pthread_join(thread_receive,NULL);
|
|
|
|
|
listenkeyboard(T,serveraddr);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
\
|
|
|
|
|
void MainWindow::on_ConnectTello_clicked()
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
@ -421,8 +469,14 @@ void MainWindow::on_ConnectTello_clicked()
|
|
|
|
|
cout << "initialized error" << endl;
|
|
|
|
|
cout << 0;
|
|
|
|
|
exit(TELLODISCONNECTION);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
pthread_t thread_connect;
|
|
|
|
|
int con = pthread_create(&thread_connect,NULL,Telloconnect,NULL);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|