-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCustomAppLayer.h
executable file
·91 lines (69 loc) · 2.18 KB
/
CustomAppLayer.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
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
#ifndef CUSTOMAPPLAYER_H_
#define CUSTOMAPPLAYER_H_
#include "NodeInfo.h"
#include <Vector>
#include <iostream>
using namespace std;
class CustomAppLayer
{
private:
//Sent packages
long numSent;
//Received packages
long numReceived;
//Package ID
int packageID;
//Distance
double totalDistance;
//Leader's information
double localLeaderAcceleration;
double localLeaderSpeed;
//Array with info from neighbours
std::vector<NodeInfo*> nodeInfoVector;
//Last acceleration calculated with Platoon
double lastAccelerationPlatoon;
//Alpha constants to CACC
double alpha1;
double alpha2;
double alpha3;
double alpha4;
double alpha5;
//Lag alpha constant to CACC
double alphaLag;
//Parameters to calculate spacing error
double length_vehicle_front;
double desiredSpacing;
//Beacon rate
double beaconInterval;
//Platoon rate
double platoonInterval;
//Beaconing flag
bool beaconingEnabled;
//Speed of current node
double mySpeed;
//Address of current node
double myAddress;
public:
CustomAppLayer();
void handleLowerMsg(NodeInfo* nodeInfo);
double getAccelerationPlatoon();
void setMyAddress(double s);
double getMyAddress();
void setMySpeed(double s);
double getMySpeed();
};
#endif /* CUSTOMAPPLAYER_H_ */