|
@@ -0,0 +1,117 @@
|
|
|
|
+#include "brain_localplan_gpstype.h"
|
|
|
|
+
|
|
|
|
+#include "ivstdcolorout.h"
|
|
|
|
+
|
|
|
|
+brain_localplan_gpstype::brain_localplan_gpstype()
|
|
|
|
+{
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ ModuleFun funmap =std::bind(&brain_localplan_gpstype::UpadateMap,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
|
|
+ mpa_map = iv::modulecomm::RegisterRecvPlus("tracemap",funmap);
|
|
|
|
+
|
|
|
|
+ ModuleFun funfusion =std::bind(&brain_localplan_gpstype::UpadateFusion,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
|
|
+ mpa_fusion = iv::modulecomm::RegisterRecvPlus("li_ra_fusion",funfusion);
|
|
|
|
+
|
|
|
|
+ ModuleFun fungps =std::bind(&brain_localplan_gpstype::UpadateGPS,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
|
|
+ mpa_gps = iv::modulecomm::RegisterRecvPlus("hcp2_gpsimu",fungps);
|
|
|
|
+
|
|
|
|
+ ModuleFun funhmi =std::bind(&brain_localplan_gpstype::UpadateHMI,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
|
|
+ mpa_hmi = iv::modulecomm::RegisterRecvPlus("tracemap",funhmi);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ mbRun = true;
|
|
|
|
+ mpthreadplan = new std::thread(&brain_localplan_gpstype::threadplan,this);
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+brain_localplan_gpstype::~brain_localplan_gpstype()
|
|
|
|
+{
|
|
|
|
+
|
|
|
|
+ iv::modulecomm::Unregister(mpa_hmi);
|
|
|
|
+ iv::modulecomm::Unregister(mpa_gps);
|
|
|
|
+ iv::modulecomm::Unregister(mpa_fusion);
|
|
|
|
+ iv::modulecomm::Unregister(mpa_map);
|
|
|
|
+
|
|
|
|
+ mbRun = false;
|
|
|
|
+ mpthreadplan->join();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+void brain_localplan_gpstype::threadplan()
|
|
|
|
+{
|
|
|
|
+ int nnogps = 0;
|
|
|
|
+ while(mbRun)
|
|
|
|
+ {
|
|
|
|
+ if(mbHaveMap == false)
|
|
|
|
+ {
|
|
|
|
+ static int nnotice = 0;
|
|
|
|
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
|
|
+ if(nnotice == 0)ivstdcolorout("No Map",iv::STDCOLOR_BOLDYELLOW);
|
|
|
|
+ nnotice++;
|
|
|
|
+ if(nnotice>=10)
|
|
|
|
+ {
|
|
|
|
+ nnotice = 0;
|
|
|
|
+ }
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ static int nnogpsprint = 0;
|
|
|
|
+ if(mbGPSUpdate == false)
|
|
|
|
+ {
|
|
|
|
+ nnogps++;
|
|
|
|
+
|
|
|
|
+ if(nnogps > 10)
|
|
|
|
+ {
|
|
|
|
+ if(nnogpsprint == 0)
|
|
|
|
+ {
|
|
|
|
+ ivstdcolorout("No GPS",iv::STDCOLOR_BOLDYELLOW);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ nnogpsprint++;
|
|
|
|
+ if(nnogpsprint >= 50)
|
|
|
|
+ {
|
|
|
|
+ nnogpsprint =0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ nnogpsprint = 0;
|
|
|
|
+ nnogps = 0;
|
|
|
|
+
|
|
|
|
+ std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void brain_localplan_gpstype::UpadateMap(const char *strdata, const unsigned int nSize, const unsigned int index, const QDateTime *dt, const char *strmemname)
|
|
|
|
+{
|
|
|
|
+
|
|
|
|
+ (void)index;
|
|
|
|
+ (void)dt;
|
|
|
|
+ (void)strmemname;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void brain_localplan_gpstype::UpadateFusion(const char *strdata, const unsigned int nSize, const unsigned int index, const QDateTime *dt, const char *strmemname)
|
|
|
|
+{
|
|
|
|
+
|
|
|
|
+ (void)index;
|
|
|
|
+ (void)dt;
|
|
|
|
+ (void)strmemname;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void brain_localplan_gpstype::UpadateGPS(const char *strdata, const unsigned int nSize, const unsigned int index, const QDateTime *dt, const char *strmemname)
|
|
|
|
+{
|
|
|
|
+
|
|
|
|
+ (void)index;
|
|
|
|
+ (void)dt;
|
|
|
|
+ (void)strmemname;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void brain_localplan_gpstype::UpadateHMI(const char *strdata, const unsigned int nSize, const unsigned int index, const QDateTime *dt, const char *strmemname)
|
|
|
|
+{
|
|
|
|
+
|
|
|
|
+ (void)index;
|
|
|
|
+ (void)dt;
|
|
|
|
+ (void)strmemname;
|
|
|
|
+}
|
|
|
|
+
|