#ifndef __PL_H__
#define __PL_H__

#include <string>
#include <iostream>
#include <unistd.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <cstring>
#include <functional>
#include <cmath>
#include <iostream>
#include <thread>
#include <chrono>

#define ZXWL

enum Direction
{
    STRAIGHT_D,
    LEFT_TURN,
    RIGHT_TURN
};

enum LightType
{
    STRAIGHT_L = 0,
    TURN_LEFT = 1,
    TURN_RIGHT = 2,
    STRAIGHT_TURN_LEFT = 3,
    STRAIGHT_TURN_RIGHT = 4,
    CIRCULAR = 5,
    PEDESTRIAN = 6,
    CYCLIST = 7,
    UNKNOWN
};

#pragma pack(push)
#pragma pack(1)

/* 存储寻迹路线的GPS点信息 */
typedef struct tagWRC_GPS_Point
{
    double LatitudeInfo;  // 纬度信息
    double LongitudeInfo; // 经度信息
    double Heading;       // 航向角
    int idealSpeed;       // 建议车速
} WRC_GPS_Point;

/* 存储目标位置GPS点信息 */
typedef struct tagWRC_MC_NAV_INFO
{
    double Latitude_degree;  // 单位:度
    double Longitude_degree; // 单位:度

    float Yaw_rad; // 单位:弧度
} WRC_MC_NAV_INFO;

/* 存储接收RTK的GPS点信息 */
struct struct_rtk
{
    double lon;
    double lat;
    double direction;
    double speed;
    int reliability;
};

// 定义停止线信息的结构体
struct StopInfo
{
    int slowdown_pos; // 开始减速位置
    int stop_pos;     // 停车位置
    int resume_pos;   // 恢复正常速度位置
};

#pragma pack(pop)

extern WRC_MC_NAV_INFO g_NavInfo;
extern struct_rtk g_rtk;

void *pl_thread(void *args);

extern double x;
extern double y;
extern int pl_speed;
extern int station_num;

extern int mode;
extern int last_mode;
extern std::string filename;
extern int d_file;
extern Direction drive_mode;
extern int slowdown_flag;

// extern double aim_x[19];
// extern double aim_y[19];
extern int command_door;

extern int id_route;
extern int id_station;
extern std::string routeId;
#endif