-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtarget.h
More file actions
executable file
·43 lines (35 loc) · 996 Bytes
/
target.h
File metadata and controls
executable file
·43 lines (35 loc) · 996 Bytes
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
#pragma once
#include "pnt_data.h"
#include "observer.h"
#include <iostream>
class Target : public Observer, public Subject
{
public:
Distance _d;
Position _uav_pos;
Track _track;
int _frequency;
int _cycle;
public:
Target(int rate = 1) : _frequency(rate) {
_cycle = static_cast<int> (((1.0 / _frequency) / (sleep_msec / 1000)));
};
~Target() {};
Track getTracking() { return _track; }
void update(Subject* s) override;
void notify() override {
for (auto e : _observers)
e->update(this);
}
void print_track() {
std::cout << "\t\t--- Target TRACK ---" << std::endl
<< "\t\t x=" << _track._pos._x << std::endl
<< "\t\t y=" << _track._pos._y << std::endl
<< "\t\t z=" << _track._pos._z << std::endl << std::endl;
}
protected:
void setDistance(Distance const& d) { _d = d; }
void setUAVLocation(Position const& p) { _uav_pos = p; }
private:
void targetLocation();
};