Unverified Commit 11346f15 authored by kledmundson's avatar kledmundson Committed by GitHub
Browse files

Merge pull request #112 from dcookastro/LroLidar_Infrastructure

Lro lidar infrastructure
parents 02be8255 d3759e84
Loading
Loading
Loading
Loading
+125 −8
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include "SerialNumberList.h"
#include "SurfacePoint.h"

using namespace boost::numeric::ublas;

namespace Isis {

@@ -210,9 +211,72 @@ namespace Isis {
        lcp->setTime(iTime(time));
        lcp->setRange(range);
        lcp->setSigmaRange(sigmaRange);

        if (pointObject.contains("aprioriMatrix") &&
                                 pointObject["aprioriMatrix"].isArray()) {
          QJsonArray  aprioriMatrixArray = pointObject["aprioriMatrix"].toArray();
          boost::numeric::ublas::symmetric_matrix<double, upper> aprioriMatrix(3);
          aprioriMatrix.clear();
          aprioriMatrix(0, 0) = aprioriMatrixArray[0].toDouble();
          aprioriMatrix(0, 1) = aprioriMatrix(1, 0) = aprioriMatrixArray[1].toDouble();
          aprioriMatrix(0, 2) = aprioriMatrix(2, 0) = aprioriMatrixArray[2].toDouble();
          aprioriMatrix(1, 1) = aprioriMatrixArray[3].toDouble();
          aprioriMatrix(1, 2) = aprioriMatrix(2, 1) = aprioriMatrixArray[4].toDouble();
          aprioriMatrix(2, 2) = aprioriMatrixArray[5].toDouble();
          
          lcp->SetAprioriSurfacePoint(SurfacePoint(Latitude(latitude, Angle::Units::Degrees),
                                                 Longitude(longitude, Angle::Units::Degrees),
                                                 Distance(radius, Distance::Units::Kilometers),
                                                   aprioriMatrix));
          lcp->SetType(ControlPoint::Constrained);
        }
        else {
          lcp->SetAprioriSurfacePoint(SurfacePoint(Latitude(latitude, Angle::Units::Degrees),
                                                 Longitude(longitude, Angle::Units::Degrees),
                                                   Distance(radius, Distance::Units::Kilometers)));
        }

        // Set the adjusted surface point if it exists 
        if (pointObject.contains("adjustedLatitude") &&
             pointObject["adjustedLatitude"].isDouble() &&
             pointObject.contains("adjustedLongitude") &&
             pointObject["adjustedLongitude"].isDouble() &&
             pointObject.contains("adjustedRadius") &&
             pointObject["adjustedRadius"].isDouble()) {

          double adjustedLatitude = 0.0;
          adjustedLatitude = pointObject["adjustedLatitude"].toDouble();

          double adjustedLongitude = 0.0;
          adjustedLongitude = pointObject["adjustedLongitude"].toDouble();

          double adjustedRadius = 0.0;
          adjustedRadius = pointObject["radius"].toDouble();
        
          if (pointObject.contains("adjustedMatrix") &&
              pointObject["adjustedMatrix"].isArray()) {
            QJsonArray  adjustedMatrixArray = pointObject["adjustedMatrix"].toArray();
            boost::numeric::ublas::symmetric_matrix<double, upper> adjustedMatrix(3);
            adjustedMatrix.clear();
            adjustedMatrix(0, 0) = adjustedMatrixArray[0].toDouble();
            adjustedMatrix(0, 1) = adjustedMatrix(1, 0) = adjustedMatrixArray[1].toDouble();
            adjustedMatrix(0, 2) = adjustedMatrix(2, 0) = adjustedMatrixArray[2].toDouble();
            adjustedMatrix(1, 1) = adjustedMatrixArray[3].toDouble();
            adjustedMatrix(1, 2) = adjustedMatrix(2, 1) = adjustedMatrixArray[4].toDouble();
            adjustedMatrix(2, 2) = adjustedMatrixArray[5].toDouble();
          
            lcp->SetAdjustedSurfacePoint(SurfacePoint(Latitude(adjustedLatitude, Angle::Units::Degrees),
                                                     Longitude(adjustedLongitude, Angle::Units::Degrees),
                                                     Distance(adjustedRadius, Distance::Units::Kilometers),
                                                     adjustedMatrix));
            lcp->SetType(ControlPoint::Constrained);
          }
          else {
            lcp->SetAdjustedSurfacePoint(SurfacePoint(Latitude(adjustedLatitude, Angle::Units::Degrees),
                                                     Longitude(adjustedLongitude, Angle::Units::Degrees),
                                                     Distance(adjustedRadius, Distance::Units::Kilometers)));
          }
        }
 
        if (pointObject.contains("simultaneousImages") &&
                                 pointObject["simultaneousImages"].isArray()) {
@@ -305,12 +369,65 @@ namespace Isis {
      pointObject["range"] = lcp->range();
      pointObject["sigmaRange"] = lcp->sigmaRange();
      pointObject["time"] = lcp->time().Et();
      // Serialize the lat/lon/radius (AprioriSurfacePoint)
      
      // Serialize the AprioriSurfacePoint
      SurfacePoint aprioriSurfacePoint = lcp->GetAprioriSurfacePoint();
      if (aprioriSurfacePoint.Valid()) {
        pointObject["latitude"] = aprioriSurfacePoint.GetLatitude().planetocentric(Angle::Units::Degrees);
        pointObject["longitude"] = aprioriSurfacePoint.GetLongitude().positiveEast(Angle::Units::Degrees);
        pointObject["radius"] = aprioriSurfacePoint.GetLocalRadius().kilometers();
      
        // Serialize the apriori matrix
        symmetric_matrix<double, upper> aprioriMatrix = aprioriSurfacePoint.GetSphericalMatrix();
        QJsonArray aprioriMatrixArray;
        aprioriMatrixArray += aprioriMatrix(0, 0);
        aprioriMatrixArray += aprioriMatrix(0, 1);
        aprioriMatrixArray += aprioriMatrix(0, 2);
        aprioriMatrixArray += aprioriMatrix(1, 1);
        aprioriMatrixArray += aprioriMatrix(1, 2);
        aprioriMatrixArray += aprioriMatrix(2, 2);

        // If the covariance matrix has a value, add it to the PVL point.
        if ( aprioriMatrix(0, 0) != 0.0
             || aprioriMatrix(0, 1) != 0.0
             || aprioriMatrix(0, 2) != 0.0
             || aprioriMatrix(1, 1) != 0.0
             || aprioriMatrix(1, 2) != 0.0
             || aprioriMatrix(2, 2) != 0.0 ) {
          pointObject["aprioriMatrix"] = aprioriMatrixArray;
        }
      }
      
      // Serialize the AdjustedSurfacePoint
      SurfacePoint adjustedSurfacePoint = lcp->GetAdjustedSurfacePoint();
      if (adjustedSurfacePoint.Valid()) {
        pointObject["adjustedLatitude"] =
          adjustedSurfacePoint.GetLatitude().planetocentric(Angle::Units::Degrees);
        pointObject["adjustedLongitude"] =
          adjustedSurfacePoint.GetLongitude().positiveEast(Angle::Units::Degrees);
        pointObject["adjustedRadius"] = adjustedSurfacePoint.GetLocalRadius().kilometers();
      
        // Serialize the adjusted matrix
        symmetric_matrix<double, upper> adjustedMatrix = adjustedSurfacePoint.GetSphericalMatrix();
        QJsonArray adjustedMatrixArray;
        adjustedMatrixArray += adjustedMatrix(0, 0);
        adjustedMatrixArray += adjustedMatrix(0, 1);
        adjustedMatrixArray += adjustedMatrix(0, 2);
        adjustedMatrixArray += adjustedMatrix(1, 1);
        adjustedMatrixArray += adjustedMatrix(1, 2);
        adjustedMatrixArray += adjustedMatrix(2, 2);

        // If the covariance matrix has a value, add it to the PVL point.
        if ( adjustedMatrix(0, 0) != 0.0
             || adjustedMatrix(0, 1) != 0.0
             || adjustedMatrix(0, 2) != 0.0
             || adjustedMatrix(1, 1) != 0.0
             || adjustedMatrix(1, 2) != 0.0
             || adjustedMatrix(2, 2) != 0.0 ) {
          pointObject["adjustedMatrix"] = adjustedMatrixArray;
        }
      }

      // Serialize the list of simultaneous images
      QJsonArray simultaneousArray;
      foreach (QString sn, lcp->snSimultaneous()) {
+8 −0
Original line number Diff line number Diff line
@@ -8,6 +8,9 @@
#include <QString>
#include <QVector>

#include "boost/numeric/ublas/symmetric.hpp"
#include "boost/numeric/ublas/io.hpp"

class QJsonObject;

namespace Isis {
@@ -31,6 +34,11 @@ namespace Isis {
   *   @history 2018-02-03 Ian Humphrey - Renamed read to readCsv. read() and write()
   *                           methods support JSON or binary serialization. Added
   *                           documentation to new Format enumeration.
   *   @history 2018-03-19 Debbie A. Cook - Added simultaneousImages, 
   *                           apriori variance/covariance matrix, adjusted point coordinates,
   *                           and adjusted variance/covariance matrix to the read and
   *                           write methods. Ref #5343.
   *  
   */
  class LidarData {

+442 −0
Original line number Diff line number Diff line
Testing default constructor... 
	number of points: 0

Testing insert(QSharedPointer<LidarControlPoint>)... 
	number of points: 1
	name of point:    testLidarControlPoint
	time of point:    2018-01-31T14:05:00.1233999

Testing write(FileName)... 
json

json
dat
./test.dat
Testing read(FileName) from binary data... 
LidarData:
	LidarControlPoint:
		id: testLidarControlPoint3
		latitude:  53
		longitude: 103
		radius:    1000
		range:     85
		sigmaRange:0.1
		time:      2018-01-31T14:08:00.1233999
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 3
			SN:     SN_3-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 3
			SN:     SN_3-1
		#END_ControlMeasure.
	#END_LidarControlPoint.

	LidarControlPoint:
		id: testLidarControlPoint4
		latitude:  54
		longitude: 104
		radius:    1000
		range:     95
		sigmaRange:0.1
		time:      2018-01-31T14:09:00.1233999
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 4
			SN:     SN_4-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 4
			SN:     SN_4-1
		#END_ControlMeasure.
	#END_LidarControlPoint.

	LidarControlPoint:
		id: testLidarControlPoint5
		latitude:  55
		longitude: 105
		radius:    1000
		range:     105
		sigmaRange:0.1
		time:      2018-01-31T14:10:00.1233999
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 5
			SN:     SN_5-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 5
			SN:     SN_5-1
		#END_ControlMeasure.
	#END_LidarControlPoint.

	LidarControlPoint:
		id: testLidarControlPoint1
		latitude:  51
		longitude: 101
		radius:    1000
		range:     65
		sigmaRange:0.1
		time:      2018-01-31T14:06:00.1233999
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 1
			SN:     SN_1-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 1
			SN:     SN_1-1
		#END_ControlMeasure.
	#END_LidarControlPoint.

	LidarControlPoint:
		id: testLidarControlPoint7
		latitude:  57
		longitude: 107
		radius:    1000
		range:     125
		sigmaRange:0.1
		time:      2018-01-31T14:12:00.1233998
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 7
			SN:     SN_7-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 7
			SN:     SN_7-1
		#END_ControlMeasure.
	#END_LidarControlPoint.

	LidarControlPoint:
		id: testLidarControlPoint9
		latitude:  59
		longitude: 109
		radius:    1000
		range:     145
		sigmaRange:0.1
		time:      2018-01-31T14:14:00.1233998
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 9
			SN:     SN_9-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 9
			SN:     SN_9-1
		#END_ControlMeasure.
	#END_LidarControlPoint.

	LidarControlPoint:
		id: testLidarControlPoint8
		latitude:  58
		longitude: 108
		radius:    1000
		range:     135
		sigmaRange:0.1
		time:      2018-01-31T14:13:00.1233998
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 8
			SN:     SN_8-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 8
			SN:     SN_8-1
		#END_ControlMeasure.
	#END_LidarControlPoint.

	LidarControlPoint:
		id: testLidarControlPoint10
		latitude:  60
		longitude: 110
		radius:    1000
		range:     155
		sigmaRange:0.1
		time:      2018-01-31T14:15:00.1233998
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 10
			SN:     SN_10-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 10
			SN:     SN_10-1
		#END_ControlMeasure.
	#END_LidarControlPoint.

	LidarControlPoint:
		id: testLidarControlPoint2
		latitude:  52
		longitude: 102
		radius:    1000
		range:     75
		sigmaRange:0.1
		time:      2018-01-31T14:07:00.1233999
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 2
			SN:     SN_2-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 2
			SN:     SN_2-1
		#END_ControlMeasure.
	#END_LidarControlPoint.

	LidarControlPoint:
		id: testLidarControlPoint6
		latitude:  56
		longitude: 106
		radius:    1000
		range:     115
		sigmaRange:0.1
		time:      2018-01-31T14:11:00.1233999
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 6
			SN:     SN_6-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 6
			SN:     SN_6-1
		#END_ControlMeasure.
	#END_LidarControlPoint.



Testing read(FileName) from JSON data... 
LidarData:
	LidarControlPoint:
		id: testLidarControlPoint3
		latitude:  53
		longitude: 103
		radius:    1000
		range:     85
		sigmaRange:0.1
		time:      2018-01-31T14:08:00.1233999
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 3
			SN:     SN_3-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 3
			SN:     SN_3-1
		#END_ControlMeasure.
	#END_LidarControlPoint.

	LidarControlPoint:
		id: testLidarControlPoint4
		latitude:  54
		longitude: 104
		radius:    1000
		range:     95
		sigmaRange:0.1
		time:      2018-01-31T14:09:00.1233999
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 4
			SN:     SN_4-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 4
			SN:     SN_4-1
		#END_ControlMeasure.
	#END_LidarControlPoint.

	LidarControlPoint:
		id: testLidarControlPoint5
		latitude:  55
		longitude: 105
		radius:    1000
		range:     105
		sigmaRange:0.1
		time:      2018-01-31T14:10:00.1233999
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 5
			SN:     SN_5-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 5
			SN:     SN_5-1
		#END_ControlMeasure.
	#END_LidarControlPoint.

	LidarControlPoint:
		id: testLidarControlPoint1
		latitude:  51
		longitude: 101
		radius:    1000
		range:     65
		sigmaRange:0.1
		time:      2018-01-31T14:06:00.1233999
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 1
			SN:     SN_1-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 1
			SN:     SN_1-1
		#END_ControlMeasure.
	#END_LidarControlPoint.

	LidarControlPoint:
		id: testLidarControlPoint7
		latitude:  57
		longitude: 107
		radius:    1000
		range:     125
		sigmaRange:0.1
		time:      2018-01-31T14:12:00.1233998
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 7
			SN:     SN_7-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 7
			SN:     SN_7-1
		#END_ControlMeasure.
	#END_LidarControlPoint.

	LidarControlPoint:
		id: testLidarControlPoint9
		latitude:  59
		longitude: 109
		radius:    1000
		range:     145
		sigmaRange:0.1
		time:      2018-01-31T14:14:00.1233998
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 9
			SN:     SN_9-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 9
			SN:     SN_9-1
		#END_ControlMeasure.
	#END_LidarControlPoint.

	LidarControlPoint:
		id: testLidarControlPoint8
		latitude:  58
		longitude: 108
		radius:    1000
		range:     135
		sigmaRange:0.1
		time:      2018-01-31T14:13:00.1233998
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 8
			SN:     SN_8-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 8
			SN:     SN_8-1
		#END_ControlMeasure.
	#END_LidarControlPoint.

	LidarControlPoint:
		id: testLidarControlPoint10
		latitude:  60
		longitude: 110
		radius:    1000
		range:     155
		sigmaRange:0.1
		time:      2018-01-31T14:15:00.1233998
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 10
			SN:     SN_10-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 10
			SN:     SN_10-1
		#END_ControlMeasure.
	#END_LidarControlPoint.

	LidarControlPoint:
		id: testLidarControlPoint2
		latitude:  52
		longitude: 102
		radius:    1000
		range:     75
		sigmaRange:0.1
		time:      2018-01-31T14:07:00.1233999
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 2
			SN:     SN_2-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 2
			SN:     SN_2-1
		#END_ControlMeasure.
	#END_LidarControlPoint.

	LidarControlPoint:
		id: testLidarControlPoint6
		latitude:  56
		longitude: 106
		radius:    1000
		range:     115
		sigmaRange:0.1
		time:      2018-01-31T14:11:00.1233999
		matrix:      [3,3]((0.028657,0,0),(0,0.0311981,0),(0,0,38.4549))
		ControlMeasure: 
			line:   0
			sample: 6
			SN:     SN_6-0
		#END_ControlMeasure.
		ControlMeasure: 
			line:   1
			sample: 6
			SN:     SN_6-1
		#END_ControlMeasure.
	#END_LidarControlPoint.


+37 −11
Original line number Diff line number Diff line
@@ -14,8 +14,11 @@
#include "Preference.h"
#include "SurfacePoint.h"

#include "boost/numeric/ublas/symmetric.hpp"

using namespace std;
using namespace Isis;
using namespace boost::numeric::ublas;

void print(const LidarData &lidarData);

@@ -30,9 +33,9 @@ int main(int argc, char *argv[]) {
  // Set up our unit test preferences
  Preference::Preferences(true);

  LidarData data;
  FileName csvFile("RDR_98E100E_60N62NPointPerRow_csv_table-original.csv");
  data.readCsv(csvFile);
  // LidarData data;
  // FileName csvFile("RDR_98E100E_60N62NPointPerRow_csv_table-original.csv");
  // data.readCsv(csvFile);

  // Test LidarData()
  cout << "Testing default constructor... " << endl;
@@ -40,9 +43,9 @@ int main(int argc, char *argv[]) {
  cout << "\tnumber of points: " << defaultData.points().size() << endl;
  cout << endl;

  // Test LidarData(FileName)
  cout << "Testing LidarData(FileName)... " << endl;
  cout << endl;
  // // Test LidarData(FileName)
  // cout << "Testing LidarData(FileName)... " << endl;
  // cout << endl;

  // Test insert(QSharedPointer<LidarControlPoint>)
  cout << "Testing insert(QSharedPointer<LidarControlPoint>)... " << endl;
@@ -50,30 +53,50 @@ int main(int argc, char *argv[]) {
  double range = 55.0;
  double sigmaRange = 0.1;
  QSharedPointer<LidarControlPoint> lcp =
      QSharedPointer<LidarControlPoint>(new LidarControlPoint(time, range, sigmaRange));
      QSharedPointer<LidarControlPoint>(new LidarControlPoint());
  lcp->setTime(time);
  iTime check = lcp->time();
  lcp->setRange(range);
  lcp->setSigmaRange(sigmaRange);
  lcp->SetId("testLidarControlPoint");
  defaultData.insert(lcp);
  cout << "\tnumber of points: " << defaultData.points().size() << endl;
  cout << "\tname of point:    " << defaultData.points().first()->GetId() << endl;
  cout << "\ttime of point:    " << defaultData.points().first()->time().UTC() << endl;
  cout << endl;

  // Test write() JSON format
  cout << "Testing write(FileName)... " << endl;
  LidarData mockData;
  double lat, lon, rad;
  lat = 100.0;
  lon = 50.0;
  lat = 50.0;
  lon = 100.0;
  rad = 1000.0;
  boost::numeric::ublas::symmetric_matrix<double, upper> aprioriMatrix(3);
  aprioriMatrix.clear();
  aprioriMatrix(0, 0) = 0.028656965032217;
  aprioriMatrix(1, 1) = 0.031198128120272;
  aprioriMatrix(2, 2) = 38.454887335682053718134171237789;
                                // Angle(1.64192315,Angle::Degrees),
                                // Angle(1.78752107, Angle::Degrees),
                                // Distance(38.454887335682053718134171237789, Distance::Meters));
  
  for (int i = 1; i < 11; i++) {
    time += 60.0;
    range += 10.0;
    lcp = QSharedPointer<LidarControlPoint>(new LidarControlPoint(time, range, sigmaRange));
    lcp = QSharedPointer<LidarControlPoint>(new LidarControlPoint());
    lcp->setTime(time);
    lcp->setRange(range);
    lcp->setSigmaRange(sigmaRange);
    lcp->SetId("testLidarControlPoint" + QString::number(i));
    lat += 1.0;
    lon += 1.0;
    SurfacePoint sp(Latitude(lat, Angle::Units::Degrees),
                    Longitude(lon, Angle::Units::Degrees),
                    Distance(rad, Distance::Units::Kilometers));
    sp.SetRadii(Distance(1000.0, Distance::Meters), Distance(1000.0, Distance::Meters),
                Distance(1000.0, Distance::Meters));
    sp.SetSphericalMatrix(aprioriMatrix);
    lcp->SetAprioriSurfacePoint(sp);
    for (int j = 0; j < 2; j++) {
      ControlMeasure *measure = new ControlMeasure();
@@ -128,12 +151,15 @@ void print(const LidarData &lidarData) {
    lat = sp.GetLatitude().planetocentric(Angle::Units::Degrees);
    lon = sp.GetLongitude().positiveEast(Angle::Units::Degrees);
    rad = sp.GetLocalRadius().kilometers();
    symmetric_matrix<double, upper> aprioriMatrix = sp.GetSphericalMatrix();
    std::cout << "\t\tlatitude:  " << lat << std::endl;
    std::cout << "\t\tlongitude: " << lon << std::endl;
    std::cout << "\t\tradius:    " << rad << std::endl;
    std::cout << "\t\trange:     " << point->range() << std::endl;
    std::cout << "\t\tsigmaRange:" << point->sigmaRange() << std::endl;
    std::cout << "\t\ttime:      " << point->time().Et() << std::endl;
    // std::cout << "\t\ttime:      " << point->time().Et() << std::endl;
    std::cout << "\t\ttime:      " << point->time().UTC() << std::endl;
    std::cout << "\t\tmatrix:      " << aprioriMatrix << std::endl;
    QList<ControlMeasure *> measures = point->getMeasures();
    foreach (ControlMeasure *measure, measures) {
      std::cout << "\t\tControlMeasure: " << std::endl;
+31 −7
Original line number Diff line number Diff line
@@ -65,6 +65,21 @@ namespace Isis {

    PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
    m_name = new QString;

    // *** TODO ***
    // Is TargetName a required keyword in the Isis labels? If so then if this call fails, the class
    // should throw an error.  If not then what are the alternatives? Each alternative should be
    // attempted and an error thrown in the case all options fail.  Basically this value should be
    // loaded when the objected is created, or the object should not be created.  How can we
    // tell if the request for the TargetName keyword fails to return anything? Should the
    // NaifSpkCode, if it exists, override the code associated with the target name in all cases
    // and not just he Sky case? The trykey settings below will not work for getting m_bodyCode.
    // The frame code is totally different from the body code usually. SpkCode may work, because
    // the spk will contail information describing the bode and not its frame.
    //
    // Basically, this constructor should load the specified values, including body code and radii,
    // or throw an error.
    
    *m_name = inst["TargetName"][0];
    QString trykey = "NaifIkCode";

@@ -197,14 +212,23 @@ namespace Isis {
    catch (IException &e) {
      try {
        if (m_spice) {
          code = m_spice->getInteger("BODY_FRAME_CODE", 0);
          code = m_spice->getInteger("NAIF_BODY_CODE", 0);  // Changed from BODY_FRAME_CODE
          //                   which is wrong.  It is a totally different code and not used to label the radii.
          //                   Stuart says some missions use the frame code to label radii.  Do we need
          //                   to code for both? Discuss this with Stuart when he returns.  03-19-2018 DAC
          return code;
        }
        else if (lab.hasObject("NaifKeywords") 
                 && lab.findObject("NaifKeywords").hasKeyword("BODY_FRAME_CODE") ) {
          code = int(lab.findObject("NaifKeywords").findKeyword("BODY_FRAME_CODE"));
          return code;
        }
        // Add this check for NAIF_SPK_CODE if NAIF_BODY_CODE fails.  Why not just call NaifBodyCode()
        // or NaifSpkCode()?
        }
        // else if (lab.hasObject("NaifKeywords") 
        //          && lab.findObject("NaifKeywords").hasKeyword("NAIF_BODY_CODE") ) {
        //   //  *** TODO ***
        //   // Change from BODY_FRAME_CODE which is not the same as body code.  DAC 3-7-18
        //   // I don't think this keyword is used in naifkeywords.  Maybe this should search the kernels group.
        //   // For now comment this section out, because it isn't doing anything.
        //   code = int(lab.findObject("NaifKeywords").findKeyword("NAIF_BODY_CODE"));
        //   return code;
        // }
        else {
          throw IException(e, 
                           IException::Unknown, 
Loading