97 lines
2.0 KiB
C++
Executable File
97 lines
2.0 KiB
C++
Executable File
/*
|
|
* @Author: zjk 1553836110@qq.com
|
|
* @Date: 2023-10-12 15:57:27
|
|
* @LastEditors: zjk 1553836110@qq.com
|
|
* @LastEditTime: 2023-11-10 08:34:14
|
|
* @FilePath: /moos-ivp-pi/src/pEmulator/Emulator.hpp
|
|
* @Description:
|
|
*
|
|
* Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
|
|
*/
|
|
#ifndef __EMULATOR_H
|
|
#define __EMULATOR_H
|
|
#define UNIX
|
|
#include"MOOS/libMOOS/Thirdparty/AppCasting/AppCastingMOOSApp.h"
|
|
#include"MOOS/libMOOS/Comms/MulticastNode.h"
|
|
#include <iostream>
|
|
#include<vector>
|
|
#include "VarDataPair.h"
|
|
#include "MBUtils.h"
|
|
#include "AngleUtils.h"
|
|
#include <list>
|
|
#include"MOOS/libMOOS/Comms/XPCUdpSocket.h"
|
|
#include "NodeRecord.h"
|
|
#include "MOOS/libMOOS/Utils/MOOSThread.h"
|
|
#include "_150server.hpp"
|
|
|
|
using namespace std;
|
|
typedef struct uuv
|
|
{
|
|
double u;
|
|
double v;
|
|
double w;
|
|
double p;
|
|
double q;
|
|
double r;
|
|
double x;
|
|
double y;
|
|
double z;
|
|
double roll;
|
|
double pitch;
|
|
double yaw;
|
|
double thrust;
|
|
double rudder;
|
|
double elevator;
|
|
double lon;
|
|
double lat;
|
|
double alt;
|
|
};
|
|
|
|
class Emulator : public AppCastingMOOSApp
|
|
{
|
|
public:
|
|
Emulator(){};
|
|
~Emulator(){delete receiveBuf;delete sendBuf;};
|
|
bool OnNewMail(MOOSMSG_LIST &NewMail);
|
|
bool Iterate();
|
|
bool OnConnectToServer();
|
|
bool OnStartUp();
|
|
void registerVariables();
|
|
bool buildReport();
|
|
void postNodeRecordUpdate(std::string, const NodeRecord&);
|
|
bool receiveUdpDate();
|
|
void set150Info();
|
|
bool _150Connect();
|
|
|
|
private:
|
|
long int local_port = 8080;
|
|
long int matalb_port = 8085;
|
|
string matlab_host = "127.0.0.1";
|
|
XPCUdpSocket* udp;
|
|
unsigned int receiveDateSize = 15;
|
|
unsigned int sendDataSize = 6;
|
|
unsigned int receiveBufSize;
|
|
unsigned int sendBufSize;
|
|
char *receiveBuf;
|
|
double *sendBuf;
|
|
NodeRecord record;
|
|
string prefix="NAV";
|
|
bool geoOk = false;
|
|
|
|
|
|
//UUV init state
|
|
double start_x = 0;
|
|
double start_y = 0;
|
|
double start_z = 0;
|
|
double start_heading = 0;
|
|
uuv remus100;
|
|
string isConnect = "";
|
|
//
|
|
CMOOSThread receiveThread;
|
|
CMOOSThread _150ServerThread;
|
|
CMOOSThread _150ConnectThread;
|
|
//150 Server
|
|
_150server p_150server_1;
|
|
};
|
|
|
|
#endif |