136 lines
4.4 KiB
C++
136 lines
4.4 KiB
C++
/*
|
|
* @Author: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
|
|
* @Date: 2023-09-21 11:04:00
|
|
* @LastEditors: zjk 1553836110@qq.com
|
|
* @LastEditTime: 2023-10-07 09:09:54
|
|
* @FilePath: /moos-ivp-extend/src/pTaskSend/TaskSend.h
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
*/
|
|
/************************************************************/
|
|
/* NAME: zjk */
|
|
/* ORGN: MIT */
|
|
/* FILE: TaskSend.h */
|
|
/* DATE: */
|
|
/************************************************************/
|
|
|
|
#ifndef TaskSend_HEADER
|
|
#define TaskSend_HEADER
|
|
|
|
#include "MOOS/libMOOS/MOOSLib.h"
|
|
#include <DUNE/DUNE.hpp>
|
|
|
|
#include <FL/Fl.H>
|
|
#include <FL/Fl_Double_Window.H>
|
|
#include <FL/Fl_Button.H>
|
|
#include <FL/Fl_Check_Button.H>
|
|
#include <FL/Fl_Return_Button.H>
|
|
#include <FL/Fl_Group.H>
|
|
#include <FL/Fl_Text_Editor.H>
|
|
#include <FL/Fl_Radio_Round_Button.H>
|
|
#include <Fl/Fl_Output.H>
|
|
#include <Fl/Fl_Input.H>
|
|
#include <Fl/Fl_Menu_Button.H>
|
|
#include <Fl/Fl_Multiline_Input.H>
|
|
|
|
struct Landmark {
|
|
float lon;
|
|
float lat;
|
|
float depth;
|
|
float speed;
|
|
};
|
|
|
|
struct WayPointBehavior
|
|
{
|
|
std::string name;
|
|
std::string source;
|
|
int priority;
|
|
std::vector<Landmark> points;
|
|
float duration;
|
|
bool closedLoop;
|
|
float constSpeed;
|
|
int repeate;
|
|
bool perpetual;
|
|
float minDepth;
|
|
float maxDepth;
|
|
};
|
|
|
|
class TaskSend : public CMOOSApp
|
|
{
|
|
public:
|
|
TaskSend();
|
|
virtual ~TaskSend();
|
|
|
|
bool OnNewMail(MOOSMSG_LIST &NewMail);
|
|
bool Iterate();
|
|
bool OnConnectToServer();
|
|
bool OnStartUp();
|
|
void RegisterVariables();
|
|
|
|
protected:
|
|
// insert local vars here
|
|
Fl_Window * taskEditView();
|
|
inline int sendTaskCallback(Fl_Widget *w);
|
|
inline int sendTask1Callback(Fl_Widget *w);
|
|
inline int sendTask2Callback(Fl_Widget *w);
|
|
inline int ModifyTask1Callback(Fl_Widget *w);
|
|
inline int FeedbackTaskCallback(Fl_Widget *w);
|
|
static void st_sendTask1Callback(Fl_Widget *w, void *f) { ((TaskSend *)f)->sendTask1Callback(w);}
|
|
static void st_sendTask2Callback(Fl_Widget *w, void *f) { ((TaskSend *)f)->sendTask2Callback(w);}
|
|
static void st_ModifyTask1Callback(Fl_Widget *w, void *f) { ((TaskSend *)f)->ModifyTask1Callback(w);}
|
|
static void st_FeedbackTaskCallback(Fl_Widget *w, void *f) { ((TaskSend *)f)->FeedbackTaskCallback(w);}
|
|
|
|
int SecurityZoneEdit();
|
|
|
|
// static void st_taskTypeCallback(Fl_Widget *w, void *f) { ((TaskSend *)f)->sendTaskCallback(w);}
|
|
// int SecurityZoneEdit();
|
|
|
|
protected:
|
|
typedef struct task
|
|
{
|
|
std::string type;
|
|
std::string duration;//时间设置 no-time-limit / 10/20/300...
|
|
std::string pwt;
|
|
} task;
|
|
|
|
typedef struct waypointTask
|
|
{
|
|
task taskParam;
|
|
std::string capture_radius;//捕获半径
|
|
std::string capture_line;//捕获线
|
|
std::string slip_radius; //滑移半径
|
|
std::string lead; //number 引导点距离
|
|
std::string lead_damper; //与轨迹的距离
|
|
std::string lead_to_start="true";
|
|
std::string speed="12";
|
|
std::string repeat;
|
|
std::string polygon;
|
|
} waypointTask;
|
|
|
|
private:
|
|
CMOOSMsg current_msg;
|
|
bool error=false;
|
|
bool editView=false;
|
|
Fl_Output* disp1=nullptr;
|
|
Fl_Window* view=nullptr;
|
|
|
|
Fl_Input* capture_radius = new Fl_Input(280,175+30,100,30,"capture radius");
|
|
Fl_Input* capture_line = new Fl_Input(80,175+30,100,30,"capture line");
|
|
Fl_Input* slip_radius = new Fl_Input(280,175+30*2,100,30,"slip radius");
|
|
Fl_Input* lead = new Fl_Input(80,175+30*2,100,30,"lead");
|
|
Fl_Input* lead_damper = new Fl_Input(280,175+30*3,100,30,"lead damper");
|
|
Fl_Input* speed = new Fl_Input(80,175+30*3,100,30,"speed");
|
|
Fl_Input* repeat = new Fl_Input(80,175+30*4,100,30,"repeat");
|
|
Fl_Multiline_Input* polygon = new Fl_Multiline_Input(80,175+30*5,300,100,"polygon");
|
|
|
|
std::string SetPlan1(std::string sourceName, double stamp);
|
|
std::string SetPlan2(std::string sourceName, double stamp);
|
|
std::string ModifyPlan1(std::string sourceName, double stamp);
|
|
|
|
DUNE::Network::TCPSocket sock_tcp_send;
|
|
DUNE::Network::UDPSocket sock_udp_receive;
|
|
bool tcpSendToServer(DUNE::IMC::Message * msg, std::string addr, int port);
|
|
double getTimeStamp();
|
|
};
|
|
|
|
#endif
|