| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295 |
- #include "gps_collect.h"
- #include <iomanip>
- #include<QDebug>
- #include <iomanip>
- // General constants.
- #define NOUTPUT_PACKET_LENGTH (72) //!< NCom packet length.
- #define NCOM_SYNC (0xE7) //!< NCom sync byte.
- #define PKT_PERIOD (0.01) //!< 10ms updates.
- #define TIME2SEC (1e-3) //!< Units of 1 ms.
- #define FINETIME2SEC (4e-6) //!< Units of 4 us.
- #define TIMECYCLE (60000) //!< Units of TIME2SEC (i.e. 60 seconds).
- #define WEEK2CYCLES (10080) //!< Time cycles in a week.
- #define ACC2MPS2 (1e-4) //!< Units of 0.1 mm/s^2.
- #define RATE2RPS (1e-5) //!< Units of 0.01 mrad/s.
- #define VEL2MPS (1e-4) //!< Units of 0.1 mm/s.
- #define ANG2RAD (1e-6) //!< Units of 0.001 mrad.
- #define INNFACTOR (0.1) //!< Resolution of 0.1.
- #define POSA2M (1e-3) //!< Units of 1 mm.
- #define VELA2MPS (1e-3) //!< Units of 1 mm/s.
- #define ANGA2RAD (1e-5) //!< Units of 0.01 mrad.
- #define GB2RPS (5e-6) //!< Units of 0.005 mrad/s.
- #define AB2MPS2 (1e-4) //!< Units of 0.1 mm/s^2.
- #define GSFACTOR (1e-6) //!< Units of 1 ppm.
- #define ASFACTOR (1e-6) //!< Units of 1 ppm.
- #define GBA2RPS (1e-6) //!< Units of 0.001 mrad/s.
- #define ABA2MPS2 (1e-5) //!< Units of 0.01 mm/s^2.
- #define GSAFACTOR (1e-6) //!< Units of 1 ppm.
- #define ASAFACTOR (1e-6) //!< Units of 1 ppm.
- #define GPSPOS2M (1e-3) //!< Units of 1 mm.
- #define GPSATT2RAD (1e-4) //!< Units of 0.1 mrad.
- #define GPSPOSA2M (1e-4) //!< Units of 0.1 mm.
- #define GPSATTA2RAD (1e-5) //!< Units of 0.01 mrad.
- #define INNFACTOR (0.1) //!< Resolution of 0.1.
- #define DIFFAGE2SEC (1e-2) //!< Units of 0.01 s.
- #define REFPOS2M (0.0012) //!< Units of 1.2 mm.
- #define REFANG2RAD (1e-4) //!< Units of 0.1 mrad.
- #define OUTPOS2M (1e-3) //!< Units of 1 mm.
- #define ZVPOS2M (1e-3) //!< Units of 1 mm.
- #define ZVPOSA2M (1e-4) //!< Units of 0.1 mm.
- #define NSPOS2M (1e-3) //!< Units of 1 mm.
- #define NSPOSA2M (1e-4) //!< Units of 0.1 mm.
- #define ALIGN2RAD (1e-4) //!< Units of 0.1 mrad.
- #define ALIGNA2RAD (1e-5) //!< Units of 0.01 mrad.
- #define SZVDELAY2S (1.0) //!< Units of 1.0 s.
- #define SZVPERIOD2S (0.1) //!< Units of 0.1 s.
- #define TOPSPEED2MPS (0.5) //!< Units of 0.5 m/s.
- #define NSDELAY2S (0.1) //!< Units of 0.1 s.
- #define NSPERIOD2S (0.02) //!< Units of 0.02 s.
- #define NSACCEL2MPS2 (0.04) //!< Units of 0.04 m/s^2.
- #define NSSPEED2MPS (0.1) //!< Units of 0.1 m/s.
- #define NSRADIUS2M (0.5) //!< Units of 0.5 m.
- #define INITSPEED2MPS (0.1) //!< Units of 0.1 m/s.
- #define HLDELAY2S (1.0) //!< Units of 1.0 s.
- #define HLPERIOD2S (0.1) //!< Units of 0.1 s.
- #define STATDELAY2S (1.0) //!< Units of 1.0 s.
- #define STATSPEED2MPS (0.01) //!< Units of 1.0 cm/s.
- #define WSPOS2M (1e-3) //!< Units of 1 mm.
- #define WSPOSA2M (1e-4) //!< Units of 0.1 mm.
- #define WSSF2PPM (0.1) //!< Units of 0.1 pulse per metre (ppm).
- #define WSSFA2PC (0.002) //!< Units of 0.002% of scale factor.
- #define WSDELAY2S (0.1) //!< Units of 0.1 s.
- #define WSNOISE2CNT (0.1) //!< Units of 0.1 count for wheel speed noise.
- #define UNDUL2M (0.005) //!< Units of 5 mm.
- #define DOPFACTOR (0.1) //!< Resolution of 0.1.
- #define OMNISTAR_MIN_FREQ (1.52e9) //!< (Hz) i.e. 1520.0 MHz.
- #define OMNIFREQ2HZ (1000.0) //!< Resolution of 1 kHz.
- #define SNR2DB (0.2) //!< Resolution of 0.2 dB.
- #define LTIME2SEC (1.0) //!< Resolution of 1.0 s.
- #define TEMPK_OFFSET (203.15) //!< Temperature offset in degrees K.
- #define ABSZERO_TEMPC (-273.15) //!< Absolute zero (i.e. 0 deg K) in deg C.
- // For more accurate and complete local coordinates
- #define FINEANG2RAD (1.74532925199433e-9) //!< Units of 0.1 udeg.
- #define ALT2M (1e-3) //!< Units of 1 mm.
- // For GPS supply voltage
- #define SUPPLYV2V (0.1) //!< Units of 0.1 V.
- // Mathematical constant definitions
- #ifndef M_PI
- #define M_PI (3.1415926535897932384626433832795) //!< Pi.
- #endif
- #define DEG2RAD (M_PI/180.0) //!< Convert degrees to radians.
- #define RAD2DEG (180.0/M_PI) //!< Convert radians to degrees.
- #define POS_INT_24 (8388607) //!< Maximum value of a two's complement 24 bit integer.
- #define NEG_INT_24 (-8388607) //!< Minimum value of a two's complement 24 bit integer.
- #define INV_INT_24 (-8388608) //!< Represents an invalid two's complement 24 bit integer.
- #define NCOM_COUNT_TOO_OLD (150) //!< Cycle counter for data too old.
- #define NCOM_STDCNT_MAX (0xFF) //!< Definition for the RTBNS accuracy counter.
- #define MIN_HORZ_SPEED (0.07) //!< 0.07 m/s hold distance.
- #define MIN_VERT_SPEED (0.07) //!< 0.07 m/s hold distance.
- #define SPEED_HOLD_FACTOR (2.0) //!< Hold distance when speed within 2 sigma of 0.
- #define MINUTES_IN_WEEK (10080) //!< Number of minutes in a week.
- // OmniStar status definitions
- #define NCOM_OMNI_STATUS_UNKNOWN (0xFF)
- #define NCOM_OMNI_STATUS_VBSEXPIRED (0x01)
- #define NCOM_OMNI_STATUS_VBSREGION (0x02)
- #define NCOM_OMNI_STATUS_VBSNOBASE (0x04)
- #define NCOM_OMNI_STATUS_HPEXPIRED (0x08)
- #define NCOM_OMNI_STATUS_HPREGION (0x10)
- #define NCOM_OMNI_STATUS_HPNOBASE (0x20)
- #define NCOM_OMNI_STATUS_HPNOCONVERGE (0x40)
- #define NCOM_OMNI_STATUS_HPKEYINVALID (0x80)
- // GPS hardware status definitions
- #define NCOM_GPS_ANT_STATUS_BITMASK (0x03)
- #define NCOM_GPS_ANT_STATUS_DONTKNOW (0x03)
- #define NCOM_GPS_ANT_STATUS_BITSHIFT (0)
- #define NCOM_GPS_ANT_POWER_BITMASK (0x0C)
- #define NCOM_GPS_ANT_POWER_DONTKNOW (0x0C)
- #define NCOM_GPS_ANT_POWER_BITSHIFT (2)
- // GPS feature set 1 definitions
- #define NCOM_GPS_FEATURE_PSRDIFF (0x01)
- #define NCOM_GPS_FEATURE_SBAS (0x02)
- #define NCOM_GPS_FEATURE_OMNIVBS (0x08)
- #define NCOM_GPS_FEATURE_OMNIHP (0x10)
- #define NCOM_GPS_FEATURE_L1DIFF (0x20)
- #define NCOM_GPS_FEATURE_L1L2DIFF (0x40)
- // GPS feature set 2 definitions
- #define NCOM_GPS_FEATURE_GLONASS (0x01)
- #define NCOM_GPS_FEATURE_GALILEO (0x02)
- #define NCOM_GPS_FEATURE_RAWRNG (0x04)
- #define NCOM_GPS_FEATURE_RAWDOP (0x08)
- #define NCOM_GPS_FEATURE_RAWL1 (0x10)
- #define NCOM_GPS_FEATURE_RAWL2 (0x20)
- #define NCOM_GPS_FEATURE_RAWL5 (0x40)
- // GPS feature valid definition
- #define NCOM_GPS_FEATURE_VALID (0x80)
- // The start of GPS time in a time_t style. In this version it is a constant, but this constant assumes that
- // the local machine uses 00:00:00 01/01/1970 as its Epoch time. If your machine is different then you need to
- // convert 00:00:00 06/01/1980 in to the local machine's time_t time.
- #define GPS_TIME_START_TIME_T (315964800)
- // Second order filter class
- #define INPUT_JITTER_TOLERANCE (0.01) // i.e. 1%
- /*index*/
- #define PI_SYNC 0
- #define PI_TIME 1
- #define PI_ACCEL_X 3
- #define PI_ACCEL_Y 6
- #define PI_ACCEL_Z 9
- #define PI_ANG_RATE_X 12
- #define PI_ANG_RATE_Y 15
- #define PI_ANG_RATE_Z 18
- #define PI_INS_NAV_MODE 21
- #define PI_CHECKSUM_1 22
- #define PI_POS_LAT 23
- #define PI_POS_LON 31
- #define PI_POS_ALT 39
- #define PI_VEL_N 43
- #define PI_VEL_E 46
- #define PI_VEL_D 49
- #define PI_ORIEN_H 52
- #define PI_ORIEN_P 55
- #define PI_ORIEN_R 58
- #define PI_CHECKSUM_2 61
- #define PI_CHANNEL_INDEX 62
- #define PI_CHANNEL_STATUS 63
- #define PI_SAT_NUM 67
- #define PI_RTK_STATUS 68
- #define PI_CHECKSUM_3 71
- /*RTK IMU status check*/
- #define RTK_IMU_OK 0
- #define IMU_STATUS_ERR 1
- #define RTK_STATUS_ERR 2
- #define UNKNOWN 0xFF
- #define map_coefficient 1
- static int coutt=1;
- static double xx;
- static double yy;
- static QVector<QPointF> pointf;
- static QPointF pointf_t;
- static double road_width=3.5;
- struct GPS_INS
- {
- int valid = 0xff;
- int index = 0; //gps点序号
- double gps_lat = 0;//纬度
- double gps_lng = 0;//经度
- double gps_x = 0;
- double gps_y = 0;
- double gps_z = 0;
- double ins_roll_angle = 0; //横滚角 一般定义载体的右、前、上三个方向构成右手系,绕向前的轴旋转就是横滚角,绕向右的轴旋转就是俯仰角,绕向上的轴旋转就是航向角
- double ins_pitch_angle = 0; //俯仰角
- double ins_heading_angle = 0; //航向角
- int ins_status = 0; //惯导状态 4
- int rtk_status = 0; //rtk状态 6 -5 -3
- int gps_satelites_num = 0;
- //-----加速度--------------
- double accel_x = 0;
- double accel_y = 0;
- double accel_z = 0;
- //-------角速度------------
- double ang_rate_x = 0;
- double ang_rate_y = 0;
- double ang_rate_z = 0;
- //-----------方向速度--------------
- double vel_N = 0;
- double vel_E = 0;
- double vel_D = 0;
- int speed_mode = 0;
- int mode2 = 0;
- double speed = 0; //速度 若导航点则为导航预设速度 若为当前点则为当前车速
- };
- typedef boost::shared_ptr<GPS_INS> GPSData;
- class CarStatus : public boost::noncopyable {
- public:
- float speed; //车速
- std::int16_t wheel_angle; //方向盘转角
- std::uint8_t braking_pressure; //刹车压力
- GPSData location; //当前车辆位置
- CarStatus() {
- speed = 0;
- braking_pressure = 0;
- wheel_angle = 0;
- location = boost::shared_ptr<GPS_INS>(new GPS_INS);
- }
- ~CarStatus() {
- }
- };
- typedef boost::serialization::singleton<CarStatus> CarStatusSingleton;
- #define ServiceCarStatus CarStatusSingleton::get_mutable_instance()
- static double cast_8_byte_to_double(const uint8_t *b);
- static int32_t cast_3_byte_to_int32(const uint8_t *b);
- extern char gstr_memname[256];
- GPS_Collect * gw;
- GPSData data(new GPS_INS);
- void ListenRaw(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
- {
- iv::gps::gpsimu xgpsimu;
- if(!xgpsimu.ParseFromArray(strdata,nSize))
- {
- std::cout<<"ListenRaw Parse error."<<std::endl;
- }
- gw->mMutexraw.lock();
- data->gps_lat = xgpsimu.lat();
- data->gps_lng = xgpsimu.lon();
- data->ins_heading_angle = xgpsimu.heading();
- gw->mMutexraw.unlock();
- }
- GPSSensor::GPSSensor() {
- }
- GPSSensor::~GPSSensor() {
- }
- void GPSSensor::start()
- {
- thread_sensor_run_ = new boost::thread(boost::bind(&GPSSensor::processSensor, this));
- }
- void GPSSensor::stop()
- {
- thread_sensor_run_->interrupt();
- thread_sensor_run_->join();
- }
- void GPSSensor::obs_modechange(int rec)
- {
- _mtx.lock();
- obs_modes = rec;
- _mtx.unlock();
- }
- void GPSSensor::speed_modechange(int rec)
- {
- _mtx.lock();
- speed_modes = rec;
- _mtx.unlock();
- }
- void GPSSensor::lane_num_modechange(int rec)
- {
- _mtx.lock();
- lane_num = rec;
- _mtx.unlock();
- }
- void GPSSensor::lane_status_modechange(int rec)
- {
- _mtx.lock();
- lane_status = rec;
- _mtx.unlock();
- }
- void GPSSensor::start_or_end(bool rec)
- {
- _mtx2.lock();
- writegps = rec;
- _mtx2.unlock();
- }
- void GPSSensor::collect_modechange(bool rec)
- {
- _mtx3.lock();
- is_forbidden = rec;
- _mtx3.unlock();
- }
- void GPSSensor::jianju_change(double rec)
- {
- _mtx4.lock();
- jianju = rec;
- _mtx4.unlock();
- }
- bool GPSSensor::isRunning() const
- {
- return (thread_sensor_run_ != NULL && !thread_sensor_run_->timed_join(boost::posix_time::milliseconds(10)));
- }
- #include <QNetworkDatagram>
- #include "gnss_coordinate_convert.h"
- extern char gstr_mappath[256];
- void GPSSensor::processSensor()
- {
- int x;
- ServiceCarStatus.location->gps_x = 0;
- ServiceCarStatus.location->gps_y = 0;
- std::string sk;
- std::stringstream ss;
- while (true)
- {
- if(should_exit == true)
- {
- ready_exit = 1;
- return;
- }
- if(!writegps)
- {
- #ifdef Q_OS_WIN
- Sleep(1);
- #else
- usleep(1000);
- #endif
- continue;
- }
- ss.clear();
- ss.str("");
- sk.clear();
- gps_index = 0;
- std::ofstream fout;
- fout.setf(std::ios::fixed, std::ios::floatfield); // 设定为 fixed 模式,以小数点表示浮点数
- fout.precision(12); // 设置精度 2
- time_t now;
- struct tm *timenow;
- time(&now);
- timenow = localtime(&now);
- ss << "" << timenow->tm_year+1900 << "-" << timenow->tm_mon+1 << "-" << timenow->tm_mday << "-" << timenow->tm_hour << "h-" << timenow->tm_min << "m-" << timenow->tm_sec << "s.txt";
- sk = ss.str();
- QString path = QString("%1/%2-%3-%4-%5-%6-%7%8").arg(gstr_mappath).arg(timenow->tm_year+1900)
- .arg(timenow->tm_mon+1).arg(timenow->tm_mday).arg(timenow->tm_hour)
- .arg(timenow->tm_min).arg(timenow->tm_sec).arg(".txt");
- fout.open(path.toStdString());
- while (writegps)
- {
- if(should_exit == true)
- {
- fout.close();
- ready_exit = 1;
- return;
- }
- // char *buf = new char[100];
- // memset(buf,0,100);
- std::cout<<"run "<<std::endl;
- if (data->ins_heading_angle < 0.0)
- {
- data->ins_heading_angle += 360.0;
- }
- //std::cout<<"x = "<<std::endl;
- GaussProjCal(data->gps_lng, data->gps_lat, &data->gps_x, &data->gps_y);
- ServiceCarStatus.location->gps_lat = data->gps_lat;
- ServiceCarStatus.location->gps_lng = data->gps_lng;
- ServiceCarStatus.location->ins_heading_angle = data->ins_heading_angle;
- double x = (ServiceCarStatus.location->gps_x - data->gps_x)*(ServiceCarStatus.location->gps_x - data->gps_x) + (ServiceCarStatus.location->gps_y - data->gps_y)*(ServiceCarStatus.location->gps_y - data->gps_y);
- if (x > (jianju*jianju))
- {
- fout << gps_index << "\t" << data->gps_lng << "\t" << data->gps_lat << "\t" << ServiceCarStatus.location->speed_mode << "\t" << ServiceCarStatus.location->mode2 << "\t" << data->ins_heading_angle << "\t" << obs_modes << "\t" << speed_modes << "\t" << lane_num << "\t" << lane_status <<std::endl;
- gps_index++;
- ServiceCarStatus.location->gps_x = data->gps_x;
- ServiceCarStatus.location->gps_y = data->gps_y;
- }
- }
- fout.close(); //关闭文件
- }
- }
- void GPSSensor::wait_exit()
- {
- while(true)
- {
- should_exit = true;
- #ifdef linux
- usleep(5000);
- #endif
- #ifdef WIN32
- boost::this_thread::sleep(boost::posix_time::milliseconds(5));
- // Sleep(5);
- #endif
- if(ready_exit == 1)
- {
- return;
- }
- }
- }
- static double cast_8_byte_to_double(const uint8_t *b)
- {
- union { double x; uint8_t c[8]; } u;
- u.c[0] = b[0];
- u.c[1] = b[1];
- u.c[2] = b[2];
- u.c[3] = b[3];
- u.c[4] = b[4];
- u.c[5] = b[5];
- u.c[6] = b[6];
- u.c[7] = b[7];
- return u.x;
- }
- static int32_t cast_3_byte_to_int32(const uint8_t *b)
- {
- union { int32_t x; uint8_t c[4]; } u;
- u.c[1] = b[0];
- u.c[2] = b[1];
- u.c[3] = b[2];
- return u.x >> 8;
- }
- GPS_Collect::GPS_Collect(QWidget *parent):
- QWidget(parent)
- {
- gw = this;
- //gps_collector_close = new boost::signals2::signal<void()>();
- this->setObjectName(QStringLiteral("GPS_Collector"));
- this->resize(1600, 650);
- frame = new QFrame(this);
- frame->setObjectName(QStringLiteral("frame"));
- frame->setGeometry(QRect(440, 390, 120, 80));
- frame->setFrameShape(QFrame::StyledPanel);
- frame->setFrameShadow(QFrame::Raised);
- label = new QLabel(this);
- label->setObjectName(QStringLiteral("label"));
- label->setGeometry(QRect(20, 20, 90, 35));
- comboBox = new QComboBox(this);
- comboBox->setObjectName(QStringLiteral("comboBox"));
- comboBox->setCurrentIndex(0);
- comboBox->setGeometry(QRect(120, 60, 100, 35));
- comboBox_2=new QComboBox(this);
- comboBox_2->setObjectName(QStringLiteral("comboBox_2"));
- comboBox_2->setCurrentIndex(0);
- comboBox_2->setGeometry(QRect(120,95,100,35));
- QFont font;//设置字号
- font.setPointSize(16);
- comboBox->setFont(font);
- comboBox_2->setFont(font);
- label_2 = new QLabel(this);
- label_2->setObjectName(QStringLiteral("label_2"));
- label_2->setGeometry(QRect(20, 60, 90, 35));
- lineEdit = new QLineEdit(this);
- lineEdit->setObjectName(QStringLiteral("lineEdit"));
- lineEdit->setGeometry(QRect(120, 20, 100, 35));
- lineEdit->setFont(font);
- lineEdit->setAlignment(Qt::AlignCenter);
- label_3 = new QLabel(this);
- label_3->setObjectName(QStringLiteral("label_3"));
- label_3->setGeometry(QRect(270, 20, 30, 16));
- label_4 = new QLabel(this);
- label_4->setObjectName(QStringLiteral("label_4"));
- label_4->setGeometry(QRect(270, 40, 30, 16));
- label_5 = new QLabel(this);
- label_5->setObjectName(QStringLiteral("label_5"));
- label_5->setGeometry(QRect(270, 60, 60, 16));
- label_6 = new QLabel(this);
- label_6->setObjectName(QStringLiteral("label_6"));
- label_6->setGeometry(QRect(440, 20, 80, 16));
- label_7 = new QLabel(this);
- label_7->setObjectName(QStringLiteral("label_7"));
- label_7->setGeometry(QRect(440, 80, 80, 16));
- label_8 = new QLabel(this);
- label_8->setObjectName(QStringLiteral("label_8"));
- label_8->setGeometry(QRect(440, 40, 80, 16));
- label_9 = new QLabel(this);
- label_9->setObjectName(QStringLiteral("label_9"));
- label_9->setGeometry(QRect(440, 60, 80, 16));
- label_10=new QLabel(this);
- label_10->setText("路宽附加属性");
- label_10->setAlignment(Qt::AlignCenter);
- label_10->setGeometry((QRect(20, 100, 90, 35)));
- lineEdit_2 = new QLineEdit(this);
- lineEdit_2->setObjectName(QStringLiteral("lineEdit_2"));
- lineEdit_2->setGeometry(QRect(310, 20, 120, 20));
- lineEdit_3 = new QLineEdit(this);
- lineEdit_3->setObjectName(QStringLiteral("lineEdit_3"));
- lineEdit_3->setGeometry(QRect(310, 40, 120, 20));
- lineEdit_4 = new QLineEdit(this);
- lineEdit_4->setObjectName(QStringLiteral("lineEdit_4"));
- lineEdit_4->setGeometry(QRect(340, 60, 90, 20));
- lineEdit_5 = new QLineEdit(this);
- lineEdit_5->setObjectName(QStringLiteral("lineEdit_5"));
- lineEdit_5->setGeometry(QRect(520, 20, 90, 20));
- lineEdit_6 = new QLineEdit(this);
- lineEdit_6->setObjectName(QStringLiteral("lineEdit_6"));
- lineEdit_6->setGeometry(QRect(520, 40, 90, 20));
- lineEdit_7 = new QLineEdit(this);
- lineEdit_7->setObjectName(QStringLiteral("lineEdit_7"));
- lineEdit_7->setGeometry(QRect(520, 60, 90, 20));
- lineEdit_8 = new QLineEdit(this);
- lineEdit_8->setObjectName(QStringLiteral("lineEdit_8"));
- lineEdit_8->setGeometry(QRect(520, 80, 90, 20));
- this->setWindowTitle(QApplication::translate("GPS_Collector", "GPS_Collector", nullptr));
- label->setText(QApplication::translate("GPS_Collector", "\351\207\207\351\233\206\347\202\271\351\227\264\350\267\235(m)", nullptr));
- label_2->setText(QApplication::translate("GPS_Collector", "\347\246\201\347\224\250\351\231\204\345\212\240\345\261\236\346\200\247", nullptr));
- label_3->setText(QApplication::translate("GPS_Collector", "\347\273\217\345\272\246", nullptr));
- label_4->setText(QApplication::translate("GPS_Collector", "\347\272\254\345\272\246", nullptr));
- label_5->setText(QApplication::translate("GPS_Collector", "\345\267\262\351\207\207\351\233\206\347\202\271\346\225\260", nullptr));
- label_6->setText(QApplication::translate("GPS_Collector", "\351\201\277\351\232\234\346\250\241\345\274\217", nullptr));
- label_7->setText(QApplication::translate("GPS_Collector", "\346\211\200\345\234\250\350\275\246\351\201\223", nullptr));
- label_8->setText(QApplication::translate("GPS_Collector", "\351\200\237\345\272\246\346\216\247\345\210\266\346\250\241\345\274\217", nullptr));
- label_9->setText(QApplication::translate("GPS_Collector", "\350\275\246\351\201\223\346\200\273\346\225\260", nullptr));
- // label_10->setText(QApplication::translate("GPS_Collector", "\347\246\201\347\224\250\351\231\204\345\212\240\345\261\236\346\200\247", nullptr));
- pushButtonstart = new QPushButton(this);
- pushButtonstart->setObjectName(QStringLiteral("pushButtonstart"));
- pushButtonstart->setGeometry(QRect(630, 11, 158, 50));
- pushButtonstart->setText("start");
- connect(pushButtonstart, SIGNAL(clicked()), this, SLOT(ClickButton_start()));
- pushButtonend = new QPushButton(this);
- pushButtonend->setObjectName(QStringLiteral("pushButtonend"));
- pushButtonend->setGeometry(QRect(630, 70, 158, 50));
- pushButtonend->setText("end");
- connect(pushButtonend, SIGNAL(clicked()), this, SLOT(ClickButton_end()));
- pushButton0 = new QPushButton(this);
- pushButton0->setObjectName(QStringLiteral("pushButton0"));
- pushButton0->setGeometry(QRect(20, 130, 192, 93));
- pushButton0->setText(QStringLiteral("停障"));
- connect(pushButton0, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_0()));
- pushButton1 = new QPushButton(this);
- pushButton1->setObjectName(QStringLiteral("pushButton1"));
- pushButton1->setGeometry(QRect(20, 223, 192, 93));
- pushButton1->setText(QStringLiteral("避障"));
- connect(pushButton1, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_1()));
- pushButton2 = new QPushButton(this);
- pushButton2->setObjectName(QStringLiteral("pushButton2"));
- pushButton2->setGeometry(QRect(20, 316, 192, 93));
- pushButton2->setText(QStringLiteral("不停不避"));
- connect(pushButton2, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_2()));
- pushButton33 = new QPushButton(this);
- pushButton33->setObjectName(QStringLiteral("保留"));
- pushButton33->setGeometry(QRect(20, 409, 192, 93));
- pushButton33->setText(QStringLiteral("保留"));
- connect(pushButton33, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_33()));
- pushButton34 = new QPushButton(this);
- pushButton34->setObjectName(QStringLiteral("pushButton34"));
- pushButton34->setGeometry(QRect(20, 502, 192, 93));
- pushButton34->setText(QStringLiteral("保留"));
- connect(pushButton34, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_34()));
- pushButton3 = new QPushButton(this);
- pushButton3->setObjectName(QStringLiteral("pushButton3"));
- pushButton3->setGeometry(QRect(212, 130, 96, 46));
- pushButton3->setText(QStringLiteral("常速行驶"));
- connect(pushButton3, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_3()));
- pushButton4 = new QPushButton(this);
- pushButton4->setObjectName(QStringLiteral("pushButton4"));
- pushButton4->setGeometry(QRect(308, 130, 96, 46));
- pushButton4->setText(QStringLiteral("入口"));
- connect(pushButton4, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_4()));
- pushButton5 = new QPushButton(this);
- pushButton5->setObjectName(QStringLiteral("pushButton5"));
- pushButton5->setGeometry(QRect(212, 176, 96, 47));
- pushButton5->setText(QStringLiteral("事故区"));
- connect(pushButton5, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_5()));
- pushButton6 = new QPushButton(this);
- pushButton6->setObjectName(QStringLiteral("pushButton6"));
- pushButton6->setGeometry(QRect(308, 176, 96, 47));
- pushButton6->setText(QStringLiteral("驻车点"));
- connect(pushButton6, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_6()));
- pushButton7 = new QPushButton(this);
- pushButton7->setObjectName(QStringLiteral("pushButton7"));
- pushButton7->setGeometry(QRect(212, 223, 96, 46));
- pushButton7->setText(QStringLiteral("隧道"));
- connect(pushButton7, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_7()));
- pushButton18 = new QPushButton(this);
- pushButton18->setObjectName(QStringLiteral("pushButton18"));
- pushButton18->setGeometry(QRect(308, 223, 96, 46));
- pushButton18->setText(QStringLiteral("低速"));
- connect(pushButton18, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_18()));
- pushButton19 = new QPushButton(this);
- pushButton19->setObjectName(QStringLiteral("pushButton19"));
- pushButton19->setGeometry(QRect(212, 269, 96, 47));
- pushButton19->setText(QStringLiteral("红绿灯"));
- connect(pushButton19, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_19()));
- pushButton20 = new QPushButton(this);
- pushButton20->setObjectName(QStringLiteral("pushButton20"));
- pushButton20->setGeometry(QRect(308, 269, 96, 47));
- pushButton20->setText(QStringLiteral("行人"));
- connect(pushButton20, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_20()));
- pushButton21 = new QPushButton(this);
- pushButton21->setObjectName(QStringLiteral("pushButton21"));
- pushButton21->setGeometry(QRect(212, 316, 96, 46));
- pushButton21->setText(QStringLiteral("雾区"));
- connect(pushButton21, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_21()));
- pushButton22 = new QPushButton(this);
- pushButton22->setObjectName(QStringLiteral("pushButton22"));
- pushButton22->setGeometry(QRect(308, 316, 96, 46));
- pushButton22->setText(QStringLiteral("变道停车"));
- connect(pushButton22, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_22()));
- pushButton23 = new QPushButton(this);
- pushButton23->setObjectName(QStringLiteral("pushButton23"));
- pushButton23->setGeometry(QRect(212, 362, 96, 47));
- pushButton23->setText(QStringLiteral("等人停车"));
- connect(pushButton23, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_23()));
- pushButton24 = new QPushButton(this);
- pushButton24->setObjectName(QStringLiteral("pushButton24"));
- pushButton24->setGeometry(QRect(308, 362, 96, 47));
- pushButton24->setText(QStringLiteral("疯狂加速"));
- connect(pushButton24, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_24()));
- pushButton25 = new QPushButton(this);
- pushButton25->setObjectName(QStringLiteral("pushButton25"));
- pushButton25->setGeometry(QRect(212, 409, 96, 46));
- pushButton25->setText(QStringLiteral("跟随"));
- connect(pushButton25, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_25()));
- pushButton26 = new QPushButton(this);
- pushButton26->setObjectName(QStringLiteral("pushButton26"));
- pushButton26->setGeometry(QRect(308, 409, 96, 46));
- pushButton26->setText(QStringLiteral("倒车"));
- connect(pushButton26, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_26()));
- pushButton27 = new QPushButton(this);
- pushButton27->setObjectName(QStringLiteral("pushButton27"));
- pushButton27->setGeometry(QRect(212, 455, 96, 47));
- pushButton27->setText(QStringLiteral("左转弯"));
- connect(pushButton27, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_27()));
- pushButton28 = new QPushButton(this);
- pushButton28->setObjectName(QStringLiteral("pushButton28"));
- pushButton28->setGeometry(QRect(308, 455, 96, 47));
- pushButton28->setText(QStringLiteral("右转弯"));
- connect(pushButton28, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_28()));
- pushButton29 = new QPushButton(this);
- pushButton29->setObjectName(QStringLiteral("pushButton29"));
- pushButton29->setGeometry(QRect(212, 502, 96, 46));
- pushButton29->setText(QStringLiteral("低速左转"));
- connect(pushButton29, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_29()));
- pushButton30 = new QPushButton(this);
- pushButton30->setObjectName(QStringLiteral("pushButton30"));
- pushButton30->setGeometry(QRect(308, 502, 96, 46));
- pushButton30->setText(QStringLiteral("低速右转"));
- connect(pushButton30, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_30()));
- pushButton31 = new QPushButton(this);
- pushButton31->setObjectName(QStringLiteral("pushButton31"));
- pushButton31->setGeometry(QRect(212, 548, 96, 47));
- pushButton31->setText(QStringLiteral("超低速"));
- connect(pushButton31, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_31()));
- pushButton32 = new QPushButton(this);
- pushButton32->setObjectName(QStringLiteral("pushButton32"));
- pushButton32->setGeometry(QRect(308, 548, 96, 47));
- pushButton32->setText(QStringLiteral("保留"));
- connect(pushButton32, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_32()));
- pushButton8 = new QPushButton(this);
- pushButton8->setObjectName(QStringLiteral("pushButton8"));
- pushButton8->setGeometry(QRect(404, 130, 192, 93));
- pushButton8->setText(QStringLiteral("单车道"));
- connect(pushButton8, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_8()));
- pushButton9 = new QPushButton(this);
- pushButton9->setObjectName(QStringLiteral("pushButton9"));
- pushButton9->setGeometry(QRect(404, 223, 192, 93));
- pushButton9->setText(QStringLiteral("双车道"));
- connect(pushButton9, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_9()));
- pushButton10 = new QPushButton(this);
- pushButton10->setObjectName(QStringLiteral("pushButton10"));
- pushButton10->setGeometry(QRect(404, 316, 192, 93));
- pushButton10->setText(QStringLiteral("三车道"));
- connect(pushButton10, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_10()));
- pushButton11 = new QPushButton(this);
- pushButton11->setObjectName(QStringLiteral("pushButton11"));
- pushButton11->setGeometry(QRect(404, 409, 192, 93));
- pushButton11->setText(QStringLiteral("四车道"));
- connect(pushButton11, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_11()));
- pushButton12 = new QPushButton(this);
- pushButton12->setObjectName(QStringLiteral("pushButton12"));
- pushButton12->setGeometry(QRect(404, 502, 192, 93));
- pushButton12->setText(QStringLiteral("五车道"));
- connect(pushButton12, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_12()));
- pushButton13 = new QPushButton(this);
- pushButton13->setObjectName(QStringLiteral("pushButton13"));
- pushButton13->setGeometry(QRect(596, 130, 192, 93));
- pushButton13->setText(QStringLiteral("在车道0"));
- connect(pushButton13, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_13()));
- pushButton14 = new QPushButton(this);
- pushButton14->setObjectName(QStringLiteral("pushButton0"));
- pushButton14->setGeometry(QRect(596, 223, 192, 93));
- pushButton14->setText(QStringLiteral("在车道1"));
- connect(pushButton14, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_14()));
- pushButton15 = new QPushButton(this);
- pushButton15->setObjectName(QStringLiteral("pushButton0"));
- pushButton15->setGeometry(QRect(596, 316, 192, 93));
- pushButton15->setText(QStringLiteral("在车道2"));
- connect(pushButton15, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_15()));
- pushButton16 = new QPushButton(this);
- pushButton16->setObjectName(QStringLiteral("pushButton0"));
- pushButton16->setGeometry(QRect(596, 409, 192, 93));
- pushButton16->setText(QStringLiteral("在车道3"));
- connect(pushButton16, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_16()));
- pushButton17 = new QPushButton(this);
- pushButton17->setObjectName(QStringLiteral("pushButton0"));
- pushButton17->setGeometry(QRect(596, 502, 192, 93));
- pushButton17->setText(QStringLiteral("在车道4"));
- connect(pushButton17, SIGNAL(clicked()), this, SLOT(ClickButton_nomall_17()));
- lineEdit->setText(QStringLiteral("0.1"));
- connect(lineEdit, SIGNAL(textEdited(const QString &)), this, SLOT(savestabuyEditinfo(const QString &)));
- comboBox->addItem(QStringLiteral(" 禁用"));
- comboBox->addItem(QStringLiteral(" 不禁用"));
- connect(comboBox, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(mycombox(const QString &)));
- comboBox_2->addItem(QStringLiteral("3.5"));
- comboBox_2->addItem(QStringLiteral("1.0"));
- comboBox_2->addItem(QStringLiteral("1.5"));
- comboBox_2->addItem(QStringLiteral("2.0"));
- comboBox_2->addItem(QStringLiteral("2.5"));
- comboBox_2->addItem(QStringLiteral("3.0"));
- comboBox_2->addItem(QStringLiteral("4.0"));
- comboBox_2->addItem(QStringLiteral("4.5"));
- comboBox_2->addItem(QStringLiteral("5.0"));
- comboBox_2->currentText();
- lineEdit_9= new QLineEdit;
- lineEdit_9->setReadOnly(true);
- lineEdit_9->setAlignment(Qt::AlignCenter);
- comboBox_2->setLineEdit(lineEdit_9);
- connect(comboBox_2, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(mycombox_2(const QString &)));
- timer = new QTimer(this);
- connect(timer, SIGNAL(timeout()), this, SLOT(timeoutslot1()));
- connect(timer, SIGNAL(timeout()), this, SLOT(timeoutslot2()));
- connect(timer, SIGNAL(timeout()), this, SLOT(timeoutslot3()));
- timer->start(20);
- myview = new MyView(this);
- myview->setObjectName(QStringLiteral("graphicsView"));
- myview->setGeometry(QRect(820, 10,500, 585));
- image = new QImage(2000, 2000, QImage::Format_RGB32);//画布的初始化大小设为300*300,使用32位颜色
- myview->setCacheMode(myview->CacheBackground);
- painter=new QPainter(this);
- painter->end();
- scene = new QGraphicsScene;
- sensor_gps = new GPSSensor();
- sensor_gps->start();
- void * paraw = iv::modulecomm::RegisterRecv(gstr_memname,ListenRaw);
- }
- GPS_Collect::~GPS_Collect()
- {
- }
- //刷新
- void GPS_Collect::paintEvent(QPaintEvent *)
- {
- if(pointf.isEmpty()){
- return;
- }
- painter->begin(image);
- image->fill(QColor(255, 255, 255));//对画布进行填充
- // std::vector<iv::GPSData> navigation_data = brain->navigation_data;
- painter->setRenderHint(QPainter::Antialiasing, true);//设置反锯齿模式,好看一点
- QPixmap pixmap(":/timerget/timercopy.png");
- painter->drawPixmap(468,465,120,120,pixmap);
- painter->setWindow(-1060,1060,4040,-4000);
- painter->drawLine(-100000,0,100000,0);
- painter->drawLine(0,-100000,0,100000);
- QPen mypen;
- mypen.setColor(Qt::blue);
- mypen.setWidth(2);//5 表示点的大小(形状为方形)
- painter->setPen(mypen);
- QString str;
- for(int i=0;i<pointf.size();i++){
- painter->drawPoint(map_coefficient*(pointf[i].x()-pointf[0].x()),map_coefficient*(pointf[i].y()-pointf[0].y()));
- //qDebug()<<(map_coefficient*(pointf[i].x()-pointf[0].x()));
- // qDebug()<<(map_coefficient*pointf[0].x());
- // qDebug()<<pointf[i];
- }
- painter->end();
- scene->clear();
- scene->addPixmap(QPixmap::fromImage(*image));
- myview->setScene(scene);
- myview->show();
- }
- void GPS_Collect::savestabuyEditinfo(const QString &txt)
- {
- jianju = txt.toDouble();
- if (jianju > 0.01)
- {
- sensor_gps->jianju_change(jianju);
- }
- }
- void GPS_Collect::mycombox(const QString &txt)
- {
- if (txt == QStringLiteral(" 禁用"))
- {
- is_forbidden = true;
- }
- else
- {
- is_forbidden = false;
- }
- sensor_gps->collect_modechange(is_forbidden);
- }
- void GPS_Collect::mycombox_2(const QString &txt){
- //road_width=txt.toInt();
- road_width = txt.toDouble();
- qDebug()<<"road_width"<<road_width<<endl;
- }
- void GPS_Collect::timeoutslot1()
- {
- update();
- }
- void GPS_Collect::timeoutslot2()
- {
- lineEdit_2->setText(QString::number(ServiceCarStatus.location->gps_lng));
- lineEdit_3->setText(QString::number(ServiceCarStatus.location->gps_lat));
- lineEdit_4->setText(QString::number(sensor_gps->gps_index));
- lineEdit_5->setText(QString::number(obs_modes));
- lineEdit_6->setText(QString::number(speed_modes));
- lineEdit_7->setText(QString::number(lane_num));
- lineEdit_8->setText(QString::number(lane_status));
- }
- void GPS_Collect::timeoutslot3(){
- double xxx, yyy;
- coutt++;
- //xxx=205.1234567123456-0;
- //yyy=205.1234567123456-0;
- xxx=ServiceCarStatus.location->gps_x;
- yyy=ServiceCarStatus.location->gps_y;
- if((xxx==0)&&(yyy==0)){return;};
- //qDebug() << xxx;
- //qDebug()<< ServiceCarStatus.location->gps_x;
- pointf_t.setX(xxx);
- pointf_t.setY(yyy);
- // mutex1.lock();
- pointf.push_back(pointf_t);
- // mutex1.unlock();
- // qDebug() << pointf_t.x();
- }
- void GPS_Collect::ClickButton_start()
- {
- starts = true;
- sensor_gps->start_or_end(starts);
- pointf.clear();
- this->paintEvent(NULL);
- /*if(clicked_start==true){
- pushButtonstart->setStyleSheet("background-color: green");
- clicked_start=false;
- }else{
- pushButtonstart->setStyleSheet("background-color: white");
- clicked_start=true;
- }*/
- pushButtonstart->setStyleSheet("background-color: green");
- pushButtonend->setStyleSheet("background-color: white");
- clicked_end=true;
- }
- void GPS_Collect::ClickButton_end()
- {
- starts = false;
- sensor_gps->start_or_end(starts);
- /*if(clicked_end==true){
- pushButtonend->setStyleSheet("background-color: green");
- clicked_end=false;
- }else{
- pushButtonend->setStyleSheet("background-color: white");
- clicked_end=true;
- }*/
- pushButtonend->setStyleSheet("background-color: green");
- pushButton0->setStyleSheet("background-color: white");
- pushButton1->setStyleSheet("background-color: white");
- pushButton2->setStyleSheet("background-color: white");
- pushButton3->setStyleSheet("background-color: white");
- pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- pushButton8->setStyleSheet("background-color: white");
- pushButton9->setStyleSheet("background-color: white");
- pushButton10->setStyleSheet("background-color: white");
- pushButton11->setStyleSheet("background-color: white");
- pushButton12->setStyleSheet("background-color: white");
- pushButton13->setStyleSheet("background-color: white");
- pushButton14->setStyleSheet("background-color: white");
- pushButton15->setStyleSheet("background-color: white");
- pushButton16->setStyleSheet("background-color: white");
- pushButton17->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- pushButton33->setStyleSheet("background-color: white");
- pushButton34->setStyleSheet("background-color: white");
- pushButtonstart->setStyleSheet("background-color: white");
- clicked_0=true;
- clicked_1=true;
- clicked_2=true;
- clicked_3=true;
- clicked_4=true;
- clicked_5=true;
- clicked_6=true;
- clicked_7=true;
- clicked_8=true;
- clicked_9=true;
- clicked_10=true;
- clicked_11=true;
- clicked_12=true;
- clicked_13=true;
- clicked_14=true;
- clicked_15=true;
- clicked_16=true;
- clicked_17=true;
- clicked_18=true;
- clicked_19=true;
- clicked_20=true;
- clicked_21=true;
- clicked_22=true;
- clicked_23=true;
- clicked_24=true;
- clicked_25=true;
- clicked_26=true;
- clicked_27=true;
- clicked_28=true;
- clicked_29=true;
- clicked_30=true;
- clicked_31=true;
- clicked_32=true;
- clicked_33=true;
- clicked_34=true;
- clicked_start=true;
- }
- /////////////////////////////////////////////////////
- void GPS_Collect::ClickButton_nomall_0()
- {
- obs_modes = 0;
- sensor_gps->obs_modechange(obs_modes);
- /*单击自己按钮切换自己按钮颜色
- if(clicked_0==true){
- pushButton0->setStyleSheet("background-color: green");
- clicked_0=false;
- }else{
- pushButton0->setStyleSheet("background-color: white");
- clicked_0=true;
- }*/
- pushButton0->setStyleSheet("background-color: green");//单击自己按钮,自己按钮一直为绿色一直为绿色
- pushButton1->setStyleSheet("background-color: white");//单击自己按钮,改变其他按钮为白色
- pushButton2->setStyleSheet("background-color: white");//单击自己按钮,改变其他按钮为白色
- pushButton33->setStyleSheet("background-color: white");
- pushButton34->setStyleSheet("background-color: white");
- clicked_1=true;//单击自己按钮,改变其他按钮为白色
- clicked_2=true;//单击自己按钮,改变其他按钮为白色
- }
- void GPS_Collect::ClickButton_nomall_1()
- {
- obs_modes = 1;
- sensor_gps->obs_modechange(obs_modes);
- /* if(clicked_1==true){
- pushButton1->setStyleSheet("background-color: green");
- clicked_1=false;
- }else{
- pushButton1->setStyleSheet("background-color: white");
- clicked_1=true;
- }*/
- pushButton1->setStyleSheet("background-color: green");
- pushButton0->setStyleSheet("background-color: white");
- pushButton2->setStyleSheet("background-color: white");
- pushButton33->setStyleSheet("background-color: white");
- pushButton34->setStyleSheet("background-color: white");
- clicked_0=true;
- clicked_2=true;
- }
- void GPS_Collect::ClickButton_nomall_2()
- {
- obs_modes = 2;
- sensor_gps->obs_modechange(obs_modes);
- /*if(clicked_2==true){
- pushButton2->setStyleSheet("background-color: green");
- clicked_2=false;
- }else{
- pushButton2->setStyleSheet("background-color: white");
- clicked_2=true;
- }*/
- pushButton2->setStyleSheet("background-color: green");
- pushButton0->setStyleSheet("background-color: white");
- pushButton1->setStyleSheet("background-color: white");
- pushButton33->setStyleSheet("background-color: white");
- pushButton34->setStyleSheet("background-color: white");
- clicked_0=true;
- clicked_1=true;
- }
- ////////////////////////////////////////////////////////
- void GPS_Collect::ClickButton_nomall_3()
- {
- speed_modes = 0;
- sensor_gps->speed_modechange(speed_modes);
- /*if(clicked_3==true){
- pushButton3->setStyleSheet("background-color: green");
- clicked_3=false;
- }else{
- pushButton3->setStyleSheet("background-color: white");
- clicked_3=true;
- }*/
- pushButton3->setStyleSheet("background-color: green");
- pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- clicked_5=true;
- clicked_7=true;
- clicked_19=true;
- clicked_21=true;
- clicked_23=true;
- clicked_25=true;
- clicked_27=true;
- clicked_18=true;
- clicked_28=true;
- }
- void GPS_Collect::ClickButton_nomall_4()
- {
- speed_modes = 1;
- sensor_gps->speed_modechange(speed_modes);
- /*if(clicked_4==true){
- pushButton4->setStyleSheet("background-color: green");
- clicked_4=false;
- }else{
- pushButton4->setStyleSheet("background-color: white");
- clicked_4=true;
- }*/
- pushButton4->setStyleSheet("background-color: green");
- pushButton3->setStyleSheet("background-color: white");
- // pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- clicked_6=true;
- clicked_18=true;
- clicked_20=true;
- clicked_22=true;
- clicked_24=true;
- clicked_26=true;
- clicked_28=true;
- }
- void GPS_Collect::ClickButton_nomall_5()
- {
- speed_modes = 2;
- sensor_gps->speed_modechange(speed_modes);
- /*if(clicked_5==true){
- pushButton5->setStyleSheet("background-color: green");
- clicked_5=false;
- }else{
- pushButton5->setStyleSheet("background-color: white");
- clicked_5=true;
- }*/
- pushButton5->setStyleSheet("background-color: green");
- pushButton3->setStyleSheet("background-color: white");
- pushButton4->setStyleSheet("background-color: white");
- //pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- clicked_3=true;
- clicked_7=true;
- clicked_19=true;
- clicked_21=true;
- clicked_23=true;
- clicked_25=true;
- clicked_27=true;
- }
- void GPS_Collect::ClickButton_nomall_6()
- {
- speed_modes = 3;
- sensor_gps->speed_modechange(speed_modes);
- /* if(clicked_6==true){
- pushButton6->setStyleSheet("background-color: green");
- clicked_6=false;
- }else{
- pushButton6->setStyleSheet("background-color: white");
- clicked_6=true;
- }*/
- pushButton6->setStyleSheet("background-color: green");
- pushButton3->setStyleSheet("background-color: white");
- pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- //pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- clicked_4=true;
- clicked_18=true;
- clicked_20=true;
- clicked_22=true;
- clicked_24=true;
- clicked_26=true;
- clicked_28=true;
- }
- void GPS_Collect::ClickButton_nomall_7()
- {
- speed_modes = 4;
- sensor_gps->speed_modechange(speed_modes);
- /*if(clicked_7==true){
- pushButton7->setStyleSheet("background-color: green");
- clicked_7=false;
- }else{
- pushButton7->setStyleSheet("background-color: white");
- clicked_7=true;
- }*/
- pushButton7->setStyleSheet("background-color: green");
- pushButton3->setStyleSheet("background-color: white");
- pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- //pushButton7->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- clicked_5=true;
- clicked_3=true;
- clicked_19=true;
- clicked_21=true;
- clicked_23=true;
- clicked_25=true;
- clicked_27=true;
- pushButton18->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- clicked_18=true;
- clicked_28=true;
- }
- /////////////////////////////////////////////////////////
- void GPS_Collect::ClickButton_nomall_8()
- {
- lane_num = 1;
- sensor_gps->lane_num_modechange(lane_num);
- /*if(clicked_8==true){
- pushButton8->setStyleSheet("background-color: green");
- clicked_8=false;
- }else{
- pushButton8->setStyleSheet("background-color: white");
- clicked_8=true;
- }*/
- pushButton8->setStyleSheet("background-color: green");
- pushButton9->setStyleSheet("background-color: white");
- pushButton10->setStyleSheet("background-color: white");
- pushButton11->setStyleSheet("background-color: white");
- pushButton12->setStyleSheet("background-color: white");
- clicked_9=true;
- clicked_10=true;
- clicked_11=true;
- clicked_12=true;
- }
- void GPS_Collect::ClickButton_nomall_9()
- {
- lane_num = 2;
- sensor_gps->lane_num_modechange(lane_num);
- /* if(clicked_9==true){
- pushButton9->setStyleSheet("background-color: green");
- clicked_9=false;
- }else{
- pushButton9->setStyleSheet("background-color: white");
- clicked_9=true;
- }*/
- pushButton9->setStyleSheet("background-color: green");
- pushButton8->setStyleSheet("background-color: white");
- pushButton10->setStyleSheet("background-color: white");
- pushButton11->setStyleSheet("background-color: white");
- pushButton12->setStyleSheet("background-color: white");
- clicked_8=true;
- clicked_10=true;
- clicked_11=true;
- clicked_12=true;
- }
- void GPS_Collect::ClickButton_nomall_10()
- {
- lane_num = 3;
- sensor_gps->lane_num_modechange(lane_num);
- /*if(clicked_10==true){
- pushButton10->setStyleSheet("background-color: green");
- clicked_10=false;
- }else{
- pushButton10->setStyleSheet("background-color: white");
- clicked_10=true;
- }*/
- pushButton10->setStyleSheet("background-color: green");
- pushButton9->setStyleSheet("background-color: white");
- pushButton8->setStyleSheet("background-color: white");
- pushButton11->setStyleSheet("background-color: white");
- pushButton12->setStyleSheet("background-color: white");
- clicked_9=true;
- clicked_8=true;
- clicked_11=true;
- clicked_12=true;
- }
- void GPS_Collect::ClickButton_nomall_11()
- {
- lane_num = 4;
- sensor_gps->lane_num_modechange(lane_num);
- /*if(clicked_11==true){
- pushButton11->setStyleSheet("background-color: green");
- clicked_11=false;
- }else{
- pushButton11->setStyleSheet("background-color: white");
- clicked_11=true;
- }*/
- pushButton11->setStyleSheet("background-color: green");
- pushButton9->setStyleSheet("background-color: white");
- pushButton10->setStyleSheet("background-color: white");
- pushButton8->setStyleSheet("background-color: white");
- pushButton12->setStyleSheet("background-color: white");
- clicked_9=true;
- clicked_10=true;
- clicked_8=true;
- clicked_12=true;
- }
- void GPS_Collect::ClickButton_nomall_12()
- {
- lane_num = 5;
- sensor_gps->lane_num_modechange(lane_num);
- /*if(clicked_12==true){
- pushButton12->setStyleSheet("background-color: green");
- clicked_12=false;
- }else{
- pushButton12->setStyleSheet("background-color: white");
- clicked_12=true;
- }*/
- pushButton12->setStyleSheet("background-color: green");
- pushButton9->setStyleSheet("background-color: white");
- pushButton10->setStyleSheet("background-color: white");
- pushButton11->setStyleSheet("background-color: white");
- pushButton8->setStyleSheet("background-color: white");
- clicked_9=true;
- clicked_10=true;
- clicked_11=true;
- clicked_8=true;
- }
- //////////////////////////////////////////////////////////
- void GPS_Collect::ClickButton_nomall_13()
- {
- lane_status = 0;
- sensor_gps->lane_status_modechange(lane_status);
- /*if(clicked_13==true){
- pushButton13->setStyleSheet("background-color: green");
- clicked_13=false;
- }else{
- pushButton13->setStyleSheet("background-color: white");
- clicked_13=true;
- }*/
- pushButton13->setStyleSheet("background-color: green");
- pushButton14->setStyleSheet("background-color: white");
- pushButton15->setStyleSheet("background-color: white");
- pushButton16->setStyleSheet("background-color: white");
- pushButton17->setStyleSheet("background-color: white");
- clicked_14=true;
- clicked_15=true;
- clicked_16=true;
- clicked_17=true;
- }
- void GPS_Collect::ClickButton_nomall_14()
- {
- lane_status = 1;
- sensor_gps->lane_status_modechange(lane_status);
- /*if(clicked_14==true){
- pushButton14->setStyleSheet("background-color: green");
- clicked_14=false;
- }else{
- pushButton14->setStyleSheet("background-color: white");
- clicked_14=true;
- }*/
- pushButton14->setStyleSheet("background-color: green");
- pushButton13->setStyleSheet("background-color: white");
- pushButton15->setStyleSheet("background-color: white");
- pushButton16->setStyleSheet("background-color: white");
- pushButton17->setStyleSheet("background-color: white");
- clicked_13=true;
- clicked_15=true;
- clicked_16=true;
- clicked_17=true;
- }
- void GPS_Collect::ClickButton_nomall_15()
- {
- lane_status = 2;
- sensor_gps->lane_status_modechange(lane_status);
- /*if(clicked_15==true){
- pushButton15->setStyleSheet("background-color: green");
- clicked_15=false;
- }else{
- pushButton15->setStyleSheet("background-color: white");
- clicked_15=true;
- }*/
- pushButton15->setStyleSheet("background-color: green");
- pushButton14->setStyleSheet("background-color: white");
- pushButton13->setStyleSheet("background-color: white");
- pushButton16->setStyleSheet("background-color: white");
- pushButton17->setStyleSheet("background-color: white");
- clicked_14=true;
- clicked_13=true;
- clicked_16=true;
- clicked_17=true;
- }
- void GPS_Collect::ClickButton_nomall_16()
- {
- lane_status = 3;
- sensor_gps->lane_status_modechange(lane_status);
- /*if(clicked_16==true){
- pushButton16->setStyleSheet("background-color: green");
- clicked_16=false;
- }else{
- pushButton16->setStyleSheet("background-color: white");
- clicked_16=true;
- }*/
- pushButton16->setStyleSheet("background-color: green");
- pushButton14->setStyleSheet("background-color: white");
- pushButton15->setStyleSheet("background-color: white");
- pushButton13->setStyleSheet("background-color: white");
- pushButton17->setStyleSheet("background-color: white");
- clicked_14=true;
- clicked_15=true;
- clicked_13=true;
- clicked_17=true;
- }
- void GPS_Collect::ClickButton_nomall_17()
- {
- lane_status = 4;
- sensor_gps->lane_status_modechange(lane_status);
- /*if(clicked_17==true){
- pushButton17->setStyleSheet("background-color: green");
- clicked_17=false;
- }else{
- pushButton17->setStyleSheet("background-color: white");
- clicked_17=true;
- }*/
- pushButton17->setStyleSheet("background-color: green");
- pushButton14->setStyleSheet("background-color: white");
- pushButton15->setStyleSheet("background-color: white");
- pushButton16->setStyleSheet("background-color: white");
- pushButton13->setStyleSheet("background-color: white");
- clicked_14=true;
- clicked_15=true;
- clicked_16=true;
- clicked_13=true;
- }
- /////////////////////////////////////////////////////////
- void GPS_Collect::ClickButton_nomall_18()
- {
- speed_modes = 5;
- sensor_gps->speed_modechange(speed_modes);
- /*if(clicked_18==true){
- pushButton18->setStyleSheet("background-color: green");
- clicked_18=false;
- }else{
- pushButton18->setStyleSheet("background-color: white");
- clicked_18=true;
- }*/
- pushButton18->setStyleSheet("background-color: green");
- pushButton3->setStyleSheet("background-color: white");
- pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- //pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- clicked_5=true;
- clicked_7=true;
- clicked_19=true;
- clicked_21=true;
- clicked_23=true;
- clicked_25=true;
- clicked_3=true;
- clicked_27=true;
- }
- void GPS_Collect::ClickButton_nomall_19()
- {
- speed_modes = 6;
- sensor_gps->speed_modechange(speed_modes);
- /*if(clicked_19==true){
- pushButton19->setStyleSheet("background-color: green");
- clicked_19=false;
- }else{
- pushButton19->setStyleSheet("background-color: white");
- clicked_19=true;
- }*/
- pushButton19->setStyleSheet("background-color: green");
- pushButton3->setStyleSheet("background-color: white");
- pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- //pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- }
- void GPS_Collect::ClickButton_nomall_20()
- {
- speed_modes = 7;
- sensor_gps->speed_modechange(speed_modes);
- /*if(clicked_20==true){
- pushButton20->setStyleSheet("background-color: green");
- clicked_20=false;
- }else{
- pushButton20->setStyleSheet("background-color: white");
- clicked_20=true;
- }*/
- pushButton20->setStyleSheet("background-color: green");
- pushButton3->setStyleSheet("background-color: white");
- pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- //pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- }
- void GPS_Collect::ClickButton_nomall_21()
- {
- speed_modes = 8;
- sensor_gps->speed_modechange(speed_modes);
- /*if(clicked_21==true){
- pushButton21->setStyleSheet("background-color: green");
- clicked_21=false;
- }else{
- pushButton21->setStyleSheet("background-color: white");
- clicked_21=true;
- }*/
- pushButton21->setStyleSheet("background-color: green");
- pushButton3->setStyleSheet("background-color: white");
- pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- //pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- }
- void GPS_Collect::ClickButton_nomall_22()
- {
- speed_modes = 9;
- sensor_gps->speed_modechange(speed_modes);
- /*if(clicked_22==true){
- pushButton22->setStyleSheet("background-color: green");
- clicked_22=false;
- }else{
- pushButton22->setStyleSheet("background-color: white");
- clicked_22=true;
- }*/
- pushButton22->setStyleSheet("background-color: green");
- pushButton3->setStyleSheet("background-color: white");
- pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- //pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- }
- void GPS_Collect::ClickButton_nomall_23()
- {
- speed_modes = 10;
- sensor_gps->speed_modechange(speed_modes);
- /*if(clicked_23==true){
- pushButton23->setStyleSheet("background-color: green");
- clicked_23=false;
- }else{
- pushButton23->setStyleSheet("background-color: white");
- clicked_23=true;
- }*/
- pushButton23->setStyleSheet("background-color: green");
- pushButton3->setStyleSheet("background-color: white");
- pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- //pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- }
- void GPS_Collect::ClickButton_nomall_24()
- {
- speed_modes = 11;
- sensor_gps->speed_modechange(speed_modes);
- /*if(clicked_24==true){
- pushButton24->setStyleSheet("background-color: green");
- clicked_24=false;
- }else{
- pushButton24->setStyleSheet("background-color: white");
- clicked_24=true;
- }*/
- pushButton24->setStyleSheet("background-color: green");
- pushButton3->setStyleSheet("background-color: white");
- pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- //pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- }
- void GPS_Collect::ClickButton_nomall_25()
- {
- speed_modes = 12;
- sensor_gps->speed_modechange(speed_modes);
- /* if(clicked_25==true){
- pushButton25->setStyleSheet("background-color: green");
- clicked_25=false;
- }else{
- pushButton25->setStyleSheet("background-color: white");
- clicked_25=true;
- }*/
- pushButton25->setStyleSheet("background-color: green");
- pushButton3->setStyleSheet("background-color: white");
- pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- //pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- }
- void GPS_Collect::ClickButton_nomall_26()
- {
- speed_modes = 13;
- sensor_gps->speed_modechange(speed_modes);
- /*if(clicked_26==true){
- pushButton26->setStyleSheet("background-color: green");
- clicked_26=false;
- }else{
- pushButton26->setStyleSheet("background-color: white");
- clicked_26=true;
- }*/
- pushButton26->setStyleSheet("background-color: green");
- pushButton3->setStyleSheet("background-color: white");
- pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- //pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- }
- void GPS_Collect::ClickButton_nomall_27()
- {
- speed_modes = 14;
- sensor_gps->speed_modechange(speed_modes);
- /*if(clicked_27==true){
- pushButton27->setStyleSheet("background-color: green");
- clicked_27=false;
- }else{
- pushButton27->setStyleSheet("background-color: white");
- clicked_27=true;
- }*/
- pushButton27->setStyleSheet("background-color: green");
- pushButton3->setStyleSheet("background-color: white");
- pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- //pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- }
- void GPS_Collect::ClickButton_nomall_28()
- {
- speed_modes = 15;
- sensor_gps->speed_modechange(speed_modes);
- /*if(clicked_28==true){
- pushButton28->setStyleSheet("background-color: green");
- clicked_28=false;
- }else{
- pushButton28->setStyleSheet("background-color: white");
- clicked_28=true;
- }*/
- pushButton28->setStyleSheet("background-color: green");
- pushButton3->setStyleSheet("background-color: white");
- pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- //pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- }
- void GPS_Collect::ClickButton_nomall_29()
- {
- speed_modes = 16;
- sensor_gps->speed_modechange(speed_modes);
- /*if(clicked_29==true){
- pushButton29->setStyleSheet("background-color: green");
- clicked_29=false;
- }else{
- pushButton29->setStyleSheet("background-color: white");
- clicked_29=true;
- }*/
- pushButton29->setStyleSheet("background-color: green");
- pushButton3->setStyleSheet("background-color: white");
- pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- //pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- }
- void GPS_Collect::ClickButton_nomall_30()
- {
- speed_modes = 17;
- sensor_gps->speed_modechange(speed_modes);
- /*if(clicked_30==true){
- pushButton30->setStyleSheet("background-color: green");
- clicked_30=false;
- }else{
- pushButton30->setStyleSheet("background-color: white");
- clicked_30=true;
- }*/
- pushButton30->setStyleSheet("background-color: green");
- pushButton3->setStyleSheet("background-color: white");
- pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- //pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- }
- void GPS_Collect::ClickButton_nomall_31()
- {
- speed_modes = 18;
- sensor_gps->speed_modechange(speed_modes);
- /*if(clicked_31==true){
- pushButton31->setStyleSheet("background-color: green");
- clicked_31=false;
- }else{
- pushButton31->setStyleSheet("background-color: white");
- clicked_31=true;
- }*/
- pushButton31->setStyleSheet("background-color: green");
- pushButton3->setStyleSheet("background-color: white");
- pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- //pushButton31->setStyleSheet("background-color: white");
- pushButton32->setStyleSheet("background-color: white");
- }
- void GPS_Collect::ClickButton_nomall_32()
- {
- speed_modes = 19;
- sensor_gps->speed_modechange(speed_modes);
- /* if(clicked_32==true){
- pushButton32->setStyleSheet("background-color: green");
- clicked_32=false;
- }else{
- pushButton32->setStyleSheet("background-color: white");
- clicked_32=true;
- }*/
- pushButton32->setStyleSheet("background-color: green");
- pushButton3->setStyleSheet("background-color: white");
- pushButton4->setStyleSheet("background-color: white");
- pushButton5->setStyleSheet("background-color: white");
- pushButton6->setStyleSheet("background-color: white");
- pushButton7->setStyleSheet("background-color: white");
- pushButton18->setStyleSheet("background-color: white");
- pushButton19->setStyleSheet("background-color: white");
- pushButton20->setStyleSheet("background-color: white");
- pushButton21->setStyleSheet("background-color: white");
- pushButton22->setStyleSheet("background-color: white");
- pushButton23->setStyleSheet("background-color: white");
- pushButton24->setStyleSheet("background-color: white");
- pushButton25->setStyleSheet("background-color: white");
- pushButton26->setStyleSheet("background-color: white");
- pushButton27->setStyleSheet("background-color: white");
- pushButton28->setStyleSheet("background-color: white");
- pushButton29->setStyleSheet("background-color: white");
- pushButton30->setStyleSheet("background-color: white");
- pushButton31->setStyleSheet("background-color: white");
- //pushButton32->setStyleSheet("background-color: white");
- }
- void GPS_Collect::ClickButton_nomall_33()
- {
- obs_modes = 3;
- sensor_gps->obs_modechange(obs_modes);
- /*if(clicked_33==true){
- pushButton33->setStyleSheet("background-color: green");
- clicked_33=false;
- }else{
- pushButton33->setStyleSheet("background-color: white");
- clicked_33=true;
- }*/
- pushButton33->setStyleSheet("background-color: green");
- pushButton0->setStyleSheet("background-color: white");//单击自己按钮,自己按钮一直为绿色一直为绿色
- pushButton1->setStyleSheet("background-color: white");//单击自己按钮,改变其他按钮为白色
- pushButton2->setStyleSheet("background-color: white");//单击自己按钮,改变其他按钮为白色
- pushButton34->setStyleSheet("background-color: white");//单击自己按钮,改变其他按钮为白色
- }
- void GPS_Collect::ClickButton_nomall_34()
- {
- obs_modes = 4;
- sensor_gps->obs_modechange(obs_modes);
- /*if(clicked_34==true){
- pushButton34->setStyleSheet("background-color: green");
- clicked_34=false;
- }else{
- pushButton34->setStyleSheet("background-color: white");
- clicked_34=true;
- }*/
- pushButton34->setStyleSheet("background-color: green");
- pushButton0->setStyleSheet("background-color: white");//单击自己按钮,自己按钮一直为绿色一直为绿色
- pushButton1->setStyleSheet("background-color: white");//单击自己按钮,改变其他按钮为白色
- pushButton2->setStyleSheet("background-color: white");//单击自己按钮,改变其他按钮为白色
- pushButton33->setStyleSheet("background-color: white");//单击自己按钮,改变其他按钮为白色
- }
- void GPS_Collect::ClickButton_nomall_35()
- {
- }
- void GPS_Collect::closeEvent(QCloseEvent *event)
- {
- if(should_close == false)
- {
- QMessageBox::StandardButton button;
- button=QMessageBox::question(this,QStringLiteral("退出程序"),QStringLiteral("确认退出程序"),QMessageBox::Yes|QMessageBox::No);
- if(button==QMessageBox::No)
- {
- event->ignore(); // 忽略退出信号,程序继续进行
- }
- else if(button==QMessageBox::Yes)
- {
- sensor_gps->wait_exit();
- event->accept(); // 接受退出信号,程序退出
- gps_collector_close();
- }
- }
- else
- {
- event->accept(); // 接受退出信号,程序退出
- }
- }
- void GPSSensor::convertStrToUnChar(char* str, unsigned char* UnChar)
- {
- int i = strlen(str), j = 0, counter = 0;
- char c[2];
- unsigned int bytes[2];
- for (j = 0; j < i; j += 2)
- {
- if(0 == j % 2)
- {
- c[0] = str[j];
- c[1] = str[j + 1];
- sscanf(c, "%02x" , &bytes[0]);
- UnChar[counter] = bytes[0];
- counter++;
- }
- }
- }
|