-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpnt_example.cpp
More file actions
executable file
·49 lines (40 loc) · 1.02 KB
/
pnt_example.cpp
File metadata and controls
executable file
·49 lines (40 loc) · 1.02 KB
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
// pnt_example.cpp : Defines the entry point for the console application.
//
#include <iostream>
#ifdef _WIN32
# include <Windows.h>
#else
# include <unistd.h>
#endif
#include "pnt_data.h"
#include "sensors.h"
#include "ownship.h"
#include "target.h"
int main()
{
Position p(.0, .0, .0); // initial position
Distance d(1062, 7800, 9000); // initial target distance
Velocity v(50, 25, 12);
Velocity vtgt(35, 625, 18);
GpsSensor* gps = new GpsSensor(p, v);
RfSensor* rfs = new RfSensor(d, vtgt);
OwnShip* uav = new OwnShip(100); // updates at 100 Hz frequency
Target* tgt = new Target (10); // updates at 10 Hz frequency
// setup the dataflow relationships
gps->attach(uav);
gps->attach(tgt);
uav->attach(tgt);
rfs->attach(tgt);
while (true)
{
// here we simulate sensor data streams
gps->read();
rfs->read();
#ifdef _WIN32
Sleep(sleep_msec); // 100 Hz
#else
usleep(sleep_msec * 1000);
#endif
}
return 0;
}