-
Notifications
You must be signed in to change notification settings - Fork 274
/
Scenario.h
92 lines (74 loc) · 1.67 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
85
86
87
88
89
90
91
92
#pragma once
#include <stdlib.h>
#include <ctime>
#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"
using namespace rapidjson;
//#define DEBUG 1
class Scenario {
private:
static char* weatherList[14];
static char* vehicleList[3];
Vehicle vehicle = NULL;
Player player = NULL;
Ped ped = NULL;
Cam camera = NULL;
Vector3 dir;
float x, y;
int hour, minute;
const char* _weather;
const char* _vehicle;
int width, height;
bool vehicles;
bool peds;
bool trafficSigns; //TODO
bool direction;
bool reward;
bool throttle;
bool brake;
bool steering;
bool speed;
bool yawRate;
bool drivingMode; //TODO
bool location;
bool time;
float currentThrottle = 0.0;
float currentBrake = 0.0;
float currentSteering = 0.0;
Rewarder* rewarder;
std::clock_t lastSafetyCheck;
int _drivingMode;
float _setSpeed;
bool running = false;
Document d;
public:
int rate;
void start(const Value& sc, const Value& dc);
void stop();
void config(const Value& sc, const Value& dc);
void setCommands(float throttle, float brake, float steering);
void run();
ScreenCapturer* screenCapturer;
StringBuffer generateMessage();
private:
void parseScenarioConfig(const Value& sc, bool setDefaults);
void parseDatasetConfig(const Value& dc, bool setDefaults);
void buildScenario();
void setVehiclesList();
void setPedsList();
void setTrafficSignsList();
void setDirection();
void setReward();
void setThrottle();
void setBrake();
void setSteering();
void setSpeed();
void setYawRate();
void setDrivingMode();
void setLocation();
void setTime();
};