-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathstate.h
116 lines (87 loc) · 2.1 KB
/
state.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
* state.h
*
* Created on: Jan 9, 2014
* Author: baj
*/
#ifndef STATE_H_
#define STATE_H_
#include "geometry.h"
#include "logger.h"
#include "common.h"
#include "intention.h"
#include "observation.h"
class IdentifiedHuman;
class HumanState
{
private:
const HumanState &operator=(const HumanState &o);
public:
typedef shared_ptr<HumanState> Ptr;
public:
explicit HumanState(Detection::Ptr det = Detection::Ptr());
explicit HumanState(const HumanState &o);
virtual ~HumanState();
void CopyFrom(const HumanState &o);
void IntentionAwarePredict(double duration, bool transition = true);
void AddNoise();
void SetIntention(HumanIntention *intention);
int Age();
vector2d &Position() {
return mPosition;
}
const vector2d &Position() const {
return mPosition;
}
void SetPosition(const vector2d &pos) {
mPosition = pos;
}
vector2d &Velocity() {
return mVelocity;
}
const vector2d &Velocity() const {
return mVelocity;
}
void SetVelocity(const vector2d &vel) {
mVelocity = vel;
}
void SetDetection(Detection::Ptr &det);
double & Orientation() {
return mOrientation;
}
const double & Orientation() const {
return mOrientation;
}
void SetOrientation(double orient) {
mOrientation = orient;
if (isinf(mOrientation) || isnan(mOrientation)) {
mOrientation = DBL_MAX;
}
}
HumanIntention *Intention() const {
return mIntentionDistri.Sampling();
}
// RCGLogger::Color IntentionColor() const;
QColor Color() const;
void Log(
RCGLogger::Ptr &logger,
bool velocity = true,
const char *label = 0);
public:
const uint mID; //unique id
uint mBornTime;
vector2d mPosition;
vector2d mVelocity;
double mOrientation;
IdentifiedHuman *mIdentity;
shared_ptr<TimedDetection> mDetection;
IntentionDistribution mIntentionDistri;
public:
friend std::ostream& operator<<(std::ostream &os, const HumanState &o) {
return os << "(id=" << o.mID
<< ", born=" << o.mBornTime
<< " pos=" << o.Position().x
<< "," << o.Position().y << ")";
}
};
#endif /* STATE_H_ */