forked from gdpinchina/DeeperGTAV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Scenario.h
84 lines (66 loc) · 1.87 KB
/
Scenario.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#pragma once
#include <stdlib.h>
#include <ctime>
#include <vector>
#include "lib/script.h"
#include "lib/utils.h"
#include "lib/rapidjson/document.h"
#include "lib/rapidjson/stringbuffer.h"
#include "ScreenCapturer.h"
#include "Rewarders\Rewarder.h"
#include "VisionNative.h"
#include "LiDAR.h"
#include "DrivingMode.h"
#include "ScenarioMsg.h"
#include "defaults.h"
using namespace rapidjson;
class Scenario {
private:
//mix
static char* weatherList[14];
static char* vehicleList[3];
Vehicle _vehicle = NULL;
Player _player = NULL;
Ped _ped = NULL;
Cam _camera = NULL;
int _hour, _minute;
const char* _weatherStr;
const char* _vehicleStr;
//manual control params
float currentThrottle = 0.0;
float currentBrake = 0.0;
float currentSteering = 0.0;
//running flag
bool running = false;
DrivingMode dm;
ScenarioMsg npMsg;
//lane and velo rewarder
Rewarder* rewarder;
float rewardSpeed, rewardAggressive;
bool reward; //msg flag
//rapjson object for msg
Document d;
StringBuffer buffer;
public:
Scenario();
~Scenario();
int rate;
int scenarioIntv; //ms
void start(const Value& sc, const Value& dc); //Apply configs to start scenario, if configs aren't defined, apply defaults instead.
void stop();
void config(const Value& sc, const Value& dc); //Apply configs to start scenario, if configs aren't defined, deprecate instead.
void setCommands(float throttle, float brake, float steering);
void run(); //Update the camera's direction. If the ego vehicle gets in trouble, help it.
void generateMessage();
ScreenCapturer screenCapturer;
LiDAR liDARDevice;
const char *chmessage;
unsigned int messageSize;
private:
//core
void parseScenarioConfig(const Value& sc);
void parseDatasetConfig(const Value& dc);
void buildScenario();
//for msg
void setReward();
};