-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTag.h
70 lines (53 loc) · 1.71 KB
/
Tag.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
#ifndef TAG_H
#define TAG_H
#include "stdafx.h"
#include <boost/math/quaternion.hpp> // For quaternion
#include <tuple> // For packaging position and orientation values
#include <iostream> // For output streams
// Stores AprilTag data
class Tag {
public:
// Contructors
Tag();
Tag(const Tag &that);
Tag(float, float, float);
// Getters and setters
int getID() const;
void setID(int);
// Get and set positions as <x,y,z> tuples
std::tuple<float, float, float> getPosition() const;;
void setPosition(std::tuple<float, float, float>);
// Get and set orientation as a <x,y,z,w> quaternion
::boost::math::quaternion<float> getOrientation() const;
void setOrientation(::boost::math::quaternion<float>);
// convenience accessor functions. The const keyword promises that we will not modify
// class data as a side-effect of getting data.
float getPositionX() const;
float getPositionY() const;
float getPositionZ() const;
float getOrientationX() const;
float getOrientationY() const;
float getOrientationZ() const;
float getOrientationW() const;
void setPositionX(float);
void setPositionY(float);
void setPositionZ(float);
void setOrientationX(float);
void setOrientationY(float);
void setOrientationZ(float);
void setOrientationW(float);
std::tuple<float, float, float> calcRollPitchYaw() const;;
float calcRoll() const;
float calcPitch() const;
float calcYaw() const;
// Allow writing of tag data to an output stream by extending ostream.
friend std::ostream& operator<<(std::ostream&, const Tag&);
private:
// Tag ID
int id = 0;
// Position in 3D coords
std::tuple<float, float, float> position;
// Orientation as a quaternion
::boost::math::quaternion<float> orientation;
};
#endif // TAG_H