#pragma once
/*
*GPS 惯导数据
*/
#ifndef _IV_COMMON_GPS_TYPE_
#define _IV_COMMON_GPS_TYPE_

#include "boost.h"
namespace iv {
    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 = -1;			//速度  若导航点则为导航预设速度  若为当前点则为当前车速

        int roadMode;
        int runMode;
        int roadSum;
        int roadOri;

    double mfLaneWidth = 3.5; // Current Lane Width

    double mfDisToLaneLeft = 1.8; //Distance to Lane Left
    int mnLaneChangeMark = 0; //1 to Left 0 not change   -1 to right
    double mfDisToRoadLeft = 1.8; //Distance to Road Left
    double mfRoadWidth = 3.5; // Road Width

        bool mbInLaneAvoid = false; //if true suport In Lane Avoid
        double gps_lat_avoidleft;
        double gps_lng_avoidleft;
        double gps_lat_avoidright;
        double gps_lng_avoidright;
        double gps_x_avoidleft = 0;
        double gps_y_avoidleft = 0;
        double gps_x_avoidright = 0;
        double gps_y_avoidright = 0;



    };

//    typedef std::shared_ptr<iv::GPS_INS> GPSData;
    typedef boost::shared_ptr<iv::GPS_INS> GPSData;

   struct Station
   {
       int index;
       GPS_INS station_location;
       int map_index;
   };



     class Point2D
    {
      public:
         double x = 0, y = 0, speed=0,obs_speed_x=0,obs_speed_y=0;
         int v1 = 0, v2 = 0;
         int roadMode = 0;
         int obs_type=0;


         Point2D()
        {
            x = y = v1 = 0;
        }

         Point2D(double _x, double _y)
        {
            x = _x; y = _y;
        }


     };

     class TracePoint
         {
       public:
               double x = 0, y = 0, speed=0;
              int v1 = 0, v2 = 0;
              int roadMode = 0;

              TracePoint()
             {
                 x = y = v1 = 0;
             }

              TracePoint(double _x, double _y)
             {
                 x = _x; y = _y;
             }

     };


     class TrafficLight
    {
      public:
         int leftColor = 0, rightColor = 0, straightColor=0, uturnColor=0;
         int leftTime=0, rightTime=0 ,straightTime=0, uturnTime=0;

         TrafficLight()
        {
            leftColor = 0, rightColor = 0, straightColor=0, uturnColor=0;
            leftTime=0, rightTime=0 ,straightTime=0, uturnTime=0;
        }

     };

     class StationCmd
     {
     public:
         bool received;
         uint32_t carID,carMode,emergencyStop,stationStop;
         bool has_carID,has_carMode,has_emergencyStop,has_stationStop,mode_manual_drive;
         uint32_t stationID[20];
         GPS_INS  stationGps[20];
         uint32_t stationTotalNum;
         StationCmd()
         {
             received=false;
             has_carID=false;
             has_carMode=false;
             has_emergencyStop=false;
             has_stationStop=false;
             mode_manual_drive=false;
             carID=0;
             carMode=0;
             emergencyStop=0;
             stationStop=0;
             stationTotalNum=0;
         }
     };




}
#endif // !_IV_COMMON_GPS_TYPE_