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
|
#include <iostream>
#include "GPS.hpp"
//Default constructor
GPS::GPS(){
// enter default values
xAnchor = 0;
yAnchor = 0;
zAnchor = 0;
xTarget = 0;
yTarget = 0;
zTarget = 0;
xFirst = 0;
yFirst = 0;
zFirst = 0;
xLast = 0;
yLast = 0;
zLast = 0;
edge = 0;
facet = 0;
scanDirection = 0;
intensity = 0;
}
void GPS::setGPSInformation(){
gpsTime = pReader->pulse.get_t();
// Compute anchor, target and direction
pReader->pulse.compute_anchor_and_target_and_dir();
xAnchor = pReader->pulse.get_anchor_x();
yAnchor = pReader->pulse.get_anchor_y();
zAnchor = pReader->pulse.get_anchor_z();
xTarget = pReader->pulse.get_target_x();
yTarget = pReader->pulse.get_target_y();
zTarget = pReader->pulse.get_target_z();
// Compute first and last returning Values
pReader->pulse.compute_first_and_last();
xFirst = pReader->pulse.get_first_x();
yFirst = pReader->pulse.get_first_y();
zFirst = pReader->pulse.get_first_z();
xLast = pReader->pulse.get_last_x();
yLast = pReader->pulse.get_last_y();
zLast = pReader->pulse.get_last_z();
edge = pReader->pulse.edge_of_scan_line;
scanDirection = pReader->pulse.scan_direction;
facet = pReader->pulse.mirror_facet,
intensity = pReader->pulse.intensity;
}
/*
* Writes all GPS information to a csv file
*/
void GPS::writeToFileGPSInformation(std::string fileName){
long long pulseIndex = 0;
FILE *scanout;
scanout = fopen("gps.csv", "w");
fprintf(scanout, "Pulse Index, GPS Time, X Anchor, Y Anchor, Z Anchor, \
X Target, Y Target, Z Target, X First, \
Y First, Z First, X Last, Y Last, Z Last, \
edge, Scan Direction, facet, intensity\n");
pOpener.set_file_name(fileName.c_str());
pReader = pOpener.open();
pReader->seek(0);
while(pReader->read_pulse()) {
gpsTime = pReader->pulse.get_t();
pReader->pulse.compute_anchor_and_target_and_dir();
xAnchor = pReader->pulse.get_anchor_x();
yAnchor = pReader->pulse.get_anchor_y();
zAnchor = pReader->pulse.get_anchor_z();
xTarget = pReader->pulse.get_target_x();
yTarget = pReader->pulse.get_target_y();
zTarget = pReader->pulse.get_target_z();
pReader->pulse.compute_first_and_last();
xFirst = pReader->pulse.get_first_x();
yFirst = pReader->pulse.get_first_y();
zFirst = pReader->pulse.get_first_z();
xLast = pReader->pulse.get_last_x();
yLast = pReader->pulse.get_last_y();
zLast = pReader->pulse.get_last_z();
edge = pReader->pulse.edge_of_scan_line;
scanDirection = pReader->pulse.scan_direction;
facet = pReader->pulse.mirror_facet,
intensity = pReader->pulse.intensity;
fprintf(scanout, "%lld,%.8lf, \
%lf,%lf,%lf, \
%lf,%lf,%lf, \
%lf,%lf,%lf, \
%lf,%lf, %lf, \
%d,%d,%d,%d,\n",
pulseIndex, gpsTime,
xAnchor, yAnchor, zAnchor,
xTarget, yTarget, zTarget,
xFirst, yFirst, zFirst,
xLast, yLast, zLast,
edge, scanDirection, facet, intensity) ;
pulseIndex++;
}
}
|