| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- #ifndef FSMUNIT_H
- #define FSMUNIT_H
- #include <QObject>
- #include <QTimer>
- #include <QDateTime>
- #include <QMutex>
- #include <iostream>
- #include <yaml-cpp/yaml.h>
- #include "modulecomm.h"
- #include "FSMSkipCMD.pb.h"
- #include "brainstate.pb.h"
- #ifndef IV_MSGUNIT
- #define IV_MSGUNIT
- namespace iv {
- struct msgunit
- {
- char mstrmsgname[256];
- int mnBufferSize = 10000;
- int mnBufferCount = 1;
- void * mpa = nullptr;
- std::shared_ptr<char> mpstrmsgdata;
- int mndatasize = 0;
- bool mbRefresh = false;
- bool mbImportant = false;
- int mnkeeptime = 100;
- };
- }
- #endif
- #ifndef GLOBAL_GPS_POINT
- #define GLOBAL_GPS_POINT
- struct gGPSPoint
- {
- double latitude = 0.0;
- double longitude = 0.0;
- double height = 0.0;
- };
- #endif
- #ifndef IV_XODROBJ
- #define IV_XODROBJ
- class xodrobj
- {
- public:
- double flatsrc;
- double flonsrc;
- double fhgdsrc;
- double flat;
- double flon;
- int lane;
- };
- #endif
- class FSMUnit : public QObject
- {
- Q_OBJECT
- public:
- FSMUnit(void);
- ~FSMUnit(void);
- void dec_yaml(const char * stryamlpath);
- void ListenGPSIMUMsg(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
- void ListenBrainStateMsg(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
- private:
- unsigned int skipCMDSendInterval = 100;
- gGPSPoint waitingStation;
- gGPSPoint maintainStation;
- iv::msgunit shmGPSIMU;
- iv::msgunit shmFSMSkipCMD;
- iv::msgunit shmBrainState;
- iv::msgunit shmXodrRequest;
- QMutex mutex_GPSIMU;
- gGPSPoint currentPosition;
- double currentSpeed;
- gGPSPoint currentDestination;
- QTimer arriveCheckLoopTimer;
- QTimer skipCMDSendTimer;
- uint32_t FSMState = 0;
- iv::brain::MissionCMD missionCMD = iv::brain::MissionCMD::MISSION_RESERVED; // 任务开始 完成 取消
- iv::brain::WorkCMD workCMD = iv::brain::WorkCMD::WORK_RESERVED; // 开工 停工
- iv::brain::RemoteCtrlCMD remoteCtrlCMD = iv::brain::RemoteCtrlCMD::REMOTE_CTRL_RESERVED; // 人工接管进入 退出
- bool waitingStationArrived = false; // 到达等待站点
- bool maintainStationArrived = false; // 到达维护站点
- signals:
- void refreshFSMStatus(void);
- void useStatusChanged(int status);
- void setAllowPlan(bool isAllow);
- void sendPathPlanRequest(double latitude,double longitude);
- public slots:
- void navagationSwitchChanged_Slot(bool status);
- void useStatusCMDChanged_Slot(bool status);
- void remoteCtrlModeChanged_Slot(bool status);
- void setFSMDestination_Slot(double latitude,double longitude);
- void setMissionFinished_Slot(void);
- private slots:
- void skipCMDSend_Timeout(void);
- void refreshFSMStatus_Slot(void);
- void arriveCheckLoop_Timeout(void);
- void sendPathPlanRequest_Slot(double latitude,double longitude);
- };
- #endif // FSMUNIT_H
|