-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCarControl.h
100 lines (63 loc) · 2.46 KB
/
CarControl.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
93
94
95
96
97
98
99
100
/***************************************************************************
file : CarControl.h
copyright : (C) 2007 Daniele Loiacono
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef CARCONTROL_H_
#define CARCONTROL_H_
#include <iostream>
#include <sstream>
#include <cstring>
#include <cassert>
#include "SimpleParser.h"
using namespace std;
class CarControl
{
private:
// Accelerate command [0,1]
float accel;
// Brake command [
float brake;
// Gear command
int gear;
// Steering command [-1,1]
float steer;
// Clutch command [0,1]
float clutch;
// meta-command
int meta;
// focus command [-90,90], i.e. angle of track sensor focus desired by client
int focus;
public:
CarControl(){};
CarControl(string sensors);
CarControl(float accel, float brake, int gear, float steer, float clutch, int focus, int meta=0);
CarControl(float accel, float brake, int gear, float steer, float clutch, int focus=0);
string toString();
void fromString(string sensors);
/* Getter and setter methods */
float getAccel() const;
void setAccel (float accel);
float getBrake() const;
void setBrake (float brake);
int getGear() const;
void setGear(int gear);
float getSteer() const;
void setSteer(float steer);
int getMeta() const;
void setMeta(int gear);
float getClutch() const;
void setClutch(float clutch);
int getFocus();
void setFocus(int focus);
// meta-command value for race restart
static int META_RESTART;
};
#endif /*CARCONTROL_H_*/