-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathV2xApps.h
51 lines (32 loc) · 1.29 KB
/
V2xApps.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
#pragma once
#include <string>
#include "MriTypeSupportImpl.h"
const int BRAKE_BOOST_UNAVAILABLE = 0;
const int BRAKE_BOOST_OFF = 1;
const int BRAKE_BOOST_ON = 2;
struct BSMCoreData
{
long vehicle_id;
double position_x;
double position_y;
double position_z;
double orient_heading;
double speed;
long brake_boost; // 0 - unavailable, 1 - off, 2 - on;
};
struct Point2D
{
double x;
double y;
};
BSMCoreData readVehDatafromString(std::string message);
Point2D RotatePoint(Point2D point, double angle);
float sign(Point2D p1, Point2D p2, Point2D p3);
bool PointInTriangle(Point2D pt, Point2D v1, Point2D v2, Point2D v3);
float doNotPassWarning(double h_x, double h_y, double h_h, double t_x, double t_y, double t_h);
float emergencyBrakeWarning(double h_x, double h_y, double h_h, double t_x, double t_y, double t_h);
float intersectionWarning(double h_x, double h_y, double h_h, double h_speed, double t_x, double t_y, double t_h, double t_speed);
void sendV2X(long sender_id, long sender_timestamp, std::string message);
std::string createBSMcoreData(Mri::VehData veh, float brakeForce);
//void sendDNPWMessage(float distance_meters, long receiverAppId);
const float BRAKE_BOOST_THRESHOLD = 0.9f; //if brake force is greater than threshold -> send brake_boost = 2 in BSM . If not greater -> send 1