Paparazzi UAS  v4.2.2_stable-4-gcc32f65
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
photogrammetry_calculator.c
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Copyright (C) 2009 Christophe De Wagter
5  *
6  * This file is part of paparazzi.
7  *
8  * paparazzi is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * paparazzi is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with paparazzi; see the file COPYING. If not, write to
20  * the Free Software Foundation, 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  *
23  */
24 
26 
27 #include "generated/airframe.h"
28 #include "generated/flight_plan.h"
29 
30 // Flightplan Variables
31 #ifndef PHOTOGRAMMETRY_SWEEP_ANGLE
32 #define PHOTOGRAMMETRY_SWEEP_ANGLE 0
33 #endif
34 
35 #ifndef PHOTOGRAMMETRY_OVERLAP
36 #define PHOTOGRAMMETRY_OVERLAP 50
37 #endif
38 
39 #ifndef PHOTOGRAMMETRY_SIDELAP
40 #define PHOTOGRAMMETRY_SIDELAP 50
41 #endif
42 
43 #ifndef PHOTOGRAMMETRY_RESOLUTION
44 #define PHOTOGRAMMETRY_RESOLUTION 50
45 #endif
46 
47 
48 // Flightplan Paramters
49 float photogrammetry_sweep_angle = 0; // in rad
50 
54 
55 // Photogrammetry Goals
56 int photogrammetry_sidelap; // Percent 0 - 100
57 int photogrammetry_overlap; // Percent 0 - 100
58 int photogrammetry_resolution; // Millimeter per pixel
59 
60 // Safety Aspects
64 
65 
67 {
69 
73 
74  photogrammetry_height_min = PHOTOGRAMMETRY_HEIGHT_MIN;
75  photogrammetry_height_max = PHOTOGRAMMETRY_HEIGHT_MAX;
76  photogrammetry_radius_min = PHOTOGRAMMETRY_RADIUS_MIN;
77 
79 }
80 
82 {
83 
84  // Photogrammetry Goals
85  float photogrammetry_sidelap_f = ((float) photogrammetry_sidelap) / 100.0f;
86  float photogrammetry_overlap_f = ((float) photogrammetry_overlap) / 100.0f;
87 
88  // Linear Projection Camera Model
89  float viewing_ratio_height = ((float) PHOTOGRAMMETRY_SENSOR_HEIGHT) / ((float)PHOTOGRAMMETRY_FOCAL_LENGTH);
90  float viewing_ratio_width = ((float) PHOTOGRAMMETRY_SENSOR_WIDTH) / ((float)PHOTOGRAMMETRY_FOCAL_LENGTH);
91  float pixel_projection_width = viewing_ratio_width / ((float)PHOTOGRAMMETRY_PIXELS_WIDTH);
92 
93  // Flightplan Variables
94  photogrammetry_height = ((float) photogrammetry_resolution) / pixel_projection_width / 1000.0f;
95 
100 
101  photogrammetry_sidestep = viewing_ratio_width * photogrammetry_height * (1.0f - photogrammetry_sidelap_f);
102  photogrammetry_triggerstep = viewing_ratio_height * photogrammetry_height * (1.0f - photogrammetry_overlap_f);
103 }
104 
106 {
107  // Linear Projection Camera Model
108  float viewing_ratio_height = ((float) PHOTOGRAMMETRY_SENSOR_HEIGHT) / ((float)PHOTOGRAMMETRY_FOCAL_LENGTH);
109  float viewing_ratio_width = ((float) PHOTOGRAMMETRY_SENSOR_WIDTH) / ((float)PHOTOGRAMMETRY_FOCAL_LENGTH);
110  float pixel_projection_width = viewing_ratio_width / ((float)PHOTOGRAMMETRY_PIXELS_WIDTH);
111 
112  // Resolution <-> Height
113  photogrammetry_resolution = photogrammetry_height * 1000.0f * pixel_projection_width;
114 
115  // Overlap <-> track width
116  photogrammetry_sidelap = 100.0f - photogrammetry_sidestep / viewing_ratio_width / photogrammetry_height * 100.0f;
117  photogrammetry_overlap = 100.0f - photogrammetry_triggerstep / viewing_ratio_height / photogrammetry_height * 100.0f;
118 }
119 
120 
int photogrammetry_radius_min
#define PHOTOGRAMMETRY_SIDELAP
int photogrammetry_height_max
#define PHOTOGRAMMETRY_OVERLAP
int photogrammetry_height_min
int photogrammetry_resolution
#define PHOTOGRAMMETRY_SWEEP_ANGLE
void init_photogrammetry_calculator(void)
int photogrammetry_sidestep
int photogrammetry_overlap
#define PHOTOGRAMMETRY_RESOLUTION
void photogrammetry_calculator_update_flightplan2camera(void)
void photogrammetry_calculator_update_camera2flightplan(void)
float photogrammetry_sweep_angle
int photogrammetry_height
int photogrammetry_triggerstep
Add to airframe file:
int photogrammetry_sidelap