summaryrefslogtreecommitdiff
path: root/src/opticaldesign.h
blob: c1ff63438e06f449a41d8ff4d6d8f57d855ca071 (plain)
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
117
118
119
120
121
122
123
#pragma once

// goodies
#include <g_object.h>
#include <g_property.h>

namespace orphex
{
Q_NAMESPACE
// multiplied by 10
enum class LenseAperture
{
    F0_5 = 05,
    F0_7 = 07,
    F1_0 = 10,
    F1_2 = 12,
    F1_4 = 14,
    F2_0 = 20,
    F2_5 = 25,
    F2_8 = 28,
    F4_0 = 40,
    F5_6 = 56,
    F8_0 = 80,
    F11_0 = 110,
    F16_0 = 160,
    F22_0 = 220,
    F32_0 = 320,
    F45_0 = 450,
    F64_0 = 640,
    F90_0 = 900,
    F128_0 = 1280,
    F180_0 = 1800,
    F256_0 = 2560
};
Q_ENUM_NS(LenseAperture)
}  // namespace orphex

class OpticalDesign : public goodies::G_Object
{
    Q_OBJECT

    DEFAULT_DESTRUCTOR(OpticalDesign);
    G_OBJECT(goodies::G_Object, OpticalDesign)

protected:
    Q_PROPERTY(
        QString actualZBaseText READ actualZBaseText NOTIFY
            actualZBaseTextChanged FINAL
    )

public:
    explicit OpticalDesign(QObject* parent = nullptr);

public:
    void calculate() const;

public:
    /*!
     * \brief fullBodyOffset - negative offset of body border from lense center
     */
    // double fullBodyOffset() const;

private:
    INI_PROPERTY(double, opticalAxisAngleDegrees, 45.);
    // the Y axis is directed from the laser to the lens
    INI_PROPERTY(double, lenseYPosMm, 50.);
    // default values for CS2006ZM06 lense
    INI_PROPERTY(double, focalDistanceMm, 6.);
    INI_PROPERTY(double, backFocalDistanceMm, 7.3);
    // FIXME: loading doesn't work
    INI_PROPERTY_VAR(
        orphex::LenseAperture,
        lenseAperture,
        orphex::LenseAperture::F1_2
    );

    INI_PROPERTY(double, lenseBodyMaxDiameterMm, 14.);
    INI_PROPERTY(double, lenseBodyLengthMm, 17.);

    // default values for IMX287 sensor
    INI_PROPERTY(double, sensorWidthMm, 4.98);
    INI_PROPERTY(double, sensorHeightMm, 3.74);

    INI_PROPERTY(double, sensorCellWidthUm, 6.9);
    INI_PROPERTY(double, sensorCellHeightUm, 6.9);

    // sensor vertical offset along the image plane
    INI_PROPERTY(double, sensorVerticalOffsetMm, 0.);

    INI_PROPERTY(uint16_t, sensorPixelsHeight, 720);
    INI_PROPERTY(uint16_t, sensorPixelsWidth, 544);

    INI_PROPERTY(double, zBaseMm, 90);
    INI_PROPERTY(double, zRangeMm, 250);

    INI_PROPERTY(double, laserBodyDiameterMm, 14.);
    INI_PROPERTY(double, laserBodyLengthMm, 45.);
    INI_PROPERTY(double, laserAngleDegrees, 45.);
    INI_PROPERTY(double, laserZOffsetMm, 0.);

    INI_PROPERTY(double, scannerBodyWallThicknessMm, 3.);

    INI_PROPERTY(double, scannerBodyFrontWallOffsetMm, -20.);

    G_PROPERTY_DEFAULT(double, sensorLenseAngleDegrees, 0.);
    G_PROPERTY_DEFAULT(double, vFoVDegrees, 0.);
    // takes scanner body into account
    G_PROPERTY_DEFAULT(double, actualZBaseMm, 0.);
    G_PROPERTY_DEFAULT(double, actualZRangeMm, 0.);
    G_PROPERTY_DEFAULT(double, lenseSensorDistanceMm, 0.);
    G_PROPERTY_DEFAULT(double, frontSharpDistanceMm, 0.);
    G_PROPERTY_DEFAULT(double, backSharpDistanceMm, 0.);
    G_PROPERTY_DEFAULT(double, depthOfFieldMm, 0.);

    // manual properties
signals:
    void actualZBaseTextChanged(QString value);

public:
    QString actualZBaseText() const;
};

Q_DECLARE_METATYPE(orphex::LenseAperture)