#pragma once
#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 "nlohmann/json.hpp"
using json = nlohmann::json;

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

// 检出的交通灯数组
struct TrafficLight
{
    // UNKNOWN = 0; RED = 1; YELLOW = 2; GREEN = 3; BLACK = 4;
    int color;

    // light id
    unsigned int id;

    // STRAIGHT = 0; TURN_LEFT = 1; TURN_RIGHT = 2; STRAIGHT_TURN_LEFT = 3;
    // STRAIGHT_TURN_RIGHT =4; CIRCULAR = 5; PEDESTRIAN = 6; CYCLIST = 7; UNKNOWN = 8;
    int type;

    // 置信度confdence: [0-1]
    double confidence;
};

// struct TrafficLightMsg
// {
//     TrafficLight trafficLight;
//     // 是否包含交通灯
//     bool contain_lights;
//     // true: valid  false: invalid
//     bool is_valid;
// };

#pragma pack(pop)

extern std::vector<TrafficLight> ros_traffic_light;

void mqtt_sub_TrafficLightMsg(void);