-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcam_pose.h
63 lines (53 loc) · 1.81 KB
/
cam_pose.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
#pragma once
#include <imu.h>
#include <cam_constants.h>
#include <cam_offset.h>
class CamPose {
public:
CamPose(float leg_height, YPR body_angles, YawPitch head_angles, CamID cam_id,
PitchRoll body_offset = PitchRoll(CamOffset::bodyPitch, CamOffset::bodyRoll),
PitchRoll head_offset = PitchRoll(CamOffset::headPitch, CamOffset::headRoll))
: cam_id(cam_id),
head_angles(head_angles),
leg_height(leg_height),
body_angles(body_angles),
body_offset(body_offset),
head_offset(head_offset) {
calcCamTranslation();
}
// Create a CamPose from the data we have in V5 images. Don't use on V6!
// Roll in the old pf_angles was inverted compared to our current coordinate system.
// This also ignores any head yaw, implement if needed.
static CamPose fromV5(PitchRoll pf_angles) {
CamPose cam_pose;
cam_pose.v5_angles = PitchRoll(pf_angles.pitch, -pf_angles.roll);
return cam_pose;
}
CamPose() = default;
CamPose(const CamPose& other) = default;
CamPose(CamPose&& other) = default;
CamPose& operator=(const CamPose&) = default;
CamPose& operator=(CamPose&&) = default;
void setEllipseAngles(PitchRoll angles) {
ellipse_angles = angles;
}
void removeEllipseAngles() {
ellipse_angles = std::nullopt;
}
const point_3d& get_translation() const {
return translation;
}
CamID cam_id = CamID::UPPER;
YawPitch head_angles;
private:
void calcCamTranslation();
float leg_height = 0;
YPR body_angles;
PitchRoll body_offset;
PitchRoll head_offset;
std::optional<PitchRoll> ellipse_angles;
point_3d translation;
std::optional<PitchRoll> v5_angles;
friend class LocalizationUtils;
friend class VisionLogger;
};