-
Notifications
You must be signed in to change notification settings - Fork 1
/
pose.cpp
102 lines (79 loc) · 1.95 KB
/
pose.cpp
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
#include "pose.h"
#include <cmath>
//debug
#include <iostream>
Pose::Pose(long aX,long aY, int orientation, int range, double FOV)
{
Pose::aX = aX;
Pose::aY = aY;
Pose::orientation = orientation;
Pose::range = range;
Pose::FOV = FOV;
}
Pose::Pose()
{
}
Pose::~Pose()
{
}
double Pose::getDistance( Pose& pose)
{
return std::sqrt((aX - pose.getX())*(aX - pose.getX()) + (aY - pose.getY())*(aY - pose.getY()));
}
long Pose::getX()
{
return aX;
}
long int Pose::getY()
{
return aY;
}
int Pose::getOrientation()
{
return orientation;
}
int Pose::getRange()
{
return range;
}
double Pose::getFOV()
{
return FOV;
}
bool Pose::isEqual(Pose& p)
{
if(aX == p.getX() & aY == p.getY() & orientation == p.getOrientation() & FOV == p.getFOV() & range == p.getRange()){
return true;
} else return false;
}
int Pose::getInformationGain()
{
return informationGain;
}
void Pose::setInformationGain(int value)
{
Pose::informationGain = value;
}
bool Pose::operator==(const Pose& p)
{
Pose p2 = p;
//std::cout <<aX<<" "<<aY<<" "<<orientation<<" "<<FOV<<" "<<range<<std::endl;
//std::cout<<p2.getX()<<" "<<p2.getY()<<" "<<p2.getOrientation()<<" "<<p2.getFOV()<<" "<<p2.getRange()<<std::endl;
//std::cout<< "compare " << (aX == p2.getX()) <<" "<< (aY == p2.getY()) <<" "<< (orientation == p2.getOrientation()) <<" "<< (FOV == p2.getFOV()) <<" "<< (range == p2.getRange() )<<std::endl;
return (aX == p2.getX()) && (aY == p2.getY()) && (orientation == p2.getOrientation()) && ((int)FOV == (int)(p2.getFOV())) && (range == p2.getRange());
}
void Pose::setScanAngles(std::pair< double, double > angles)
{
scanAngles = angles;
}
std::pair<double, double> Pose::getScanAngles()
{
return scanAngles;
}
void Pose::updateFromData(std::pair<long, long> position, float orientation, int range, double FOV) {
this->aX = position.first;
this->aY = position.second;
this->orientation = orientation;
this->range = range;
this->FOV = FOV;
}