Commit 073c65b6 authored by jay's avatar jay
Browse files

Updates for parametercov and ref point

parent 87cacc1c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -370,6 +370,8 @@ protected:
    int m_nSamples;
    int m_nParameters;

    csm::EcefCoord m_referencePointXyz; 

    json _state;
    static const int         _NUM_STATE_KEYWORDS;
    static const int         NUM_PARAMETERS;
+15 −13
Original line number Diff line number Diff line
@@ -66,6 +66,9 @@ void UsgsAstroFrameSensorModel::reset() {
    m_iTransL = std::vector<double>(3, 0.0);
    m_boresight = std::vector<double>(3, 0.0);
    m_parameterType = std::vector<csm::param::Type>(NUM_PARAMETERS, csm::param::REAL);
    m_referencePointXyz.x = 0;
    m_referencePointXyz.y = 0;
    m_referencePointXyz.z = 0;
}


@@ -655,7 +658,10 @@ std::string UsgsAstroFrameSensorModel::getModelState() const {
      {"m_currentParameterCovariance", m_currentParameterCovariance},
      {"m_imageIdentifier", m_imageIdentifier}
    };

    state["m_referencePointXyz"] = json();
    state["m_referencePointXyz"]["x"] = m_referencePointXyz.x;
    state["m_referencePointXyz"]["y"] = m_referencePointXyz.y;
    state["m_referencePointXyz"]["z"] = m_referencePointXyz.z;
    return state.dump();
}

@@ -950,6 +956,8 @@ std::string UsgsAstroFrameSensorModel::constructStateFromIsd(const std::string&

      std::cerr << "Focal To Pixel Transformation Parsed!" << std::endl;

      state["m_referencePointXyz"] = std::vector<double>(3, 0.0);

    }
    catch(std::out_of_range& e) {
      throw csm::Error(csm::Error::SENSOR_MODEL_NOT_CONSTRUCTIBLE,
@@ -968,16 +976,12 @@ std::string UsgsAstroFrameSensorModel::constructStateFromIsd(const std::string&


csm::EcefCoord UsgsAstroFrameSensorModel::getReferencePoint() const {
  throw csm::Error(csm::Error::UNSUPPORTED_FUNCTION,
                   "Unsupported function",
                   "UsgsAstroFrameSensorModel::getReferencePoint");
  return m_referencePointXyz;
}


void UsgsAstroFrameSensorModel::setReferencePoint(const csm::EcefCoord &groundPt) {
  throw csm::Error(csm::Error::UNSUPPORTED_FUNCTION,
                   "Unsupported function",
                   "UsgsAstroFrameSensorModel::setReferencePoint");
  m_referencePointXyz = groundPt;
}


@@ -1046,16 +1050,14 @@ void UsgsAstroFrameSensorModel::setParameterType(int index, csm::param::Type pTy


double UsgsAstroFrameSensorModel::getParameterCovariance(int index1, int index2) const {
  throw csm::Error(csm::Error::UNSUPPORTED_FUNCTION,
                   "Unsupported function",
                   "UsgsAstroFrameSensorModel::getParameterCovariance");
   int index = UsgsAstroFrameSensorModel::NUM_PARAMETERS * index1 + index2;
   return m_currentParameterCovariance[index];
}


void UsgsAstroFrameSensorModel::setParameterCovariance(int index1, int index2, double covariance) {
  throw csm::Error(csm::Error::UNSUPPORTED_FUNCTION,
                   "Unsupported function",
                   "UsgsAstroFrameSensorModel::setParameterCovariance");
   int index = UsgsAstroFrameSensorModel::NUM_PARAMETERS * index1 + index2;
   m_currentParameterCovariance[index] = covariance;
}


+1 −1
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ std::string UsgsAstroPlugin::loadImageSupportData(const csm::Isd &imageSupportDa
  std::string imageFilename = imageSupportDataOriginal.filename();
  size_t lastIndex = imageFilename.find_last_of(".");
  std::string baseName = imageFilename.substr(0, lastIndex);
  lastIndex = baseName.find_last_of("/");
  lastIndex = baseName.find_last_of(DIR_DELIMITER_STR);
  std::string filename = baseName.substr(lastIndex + 1);
  std::string isdFilename = baseName.append(".json");

+7 −0
Original line number Diff line number Diff line
@@ -78,6 +78,13 @@ TEST_F(FrameSensorModel, OffBody3) {
   EXPECT_NEAR(groundPt.z, 14.99325304, 1e-8);
}

TEST_F(FrameSensorModel, getReferencePoint) {
  csm::EcefCoord groundPt = sensorModel->getReferencePoint();
  EXPECT_EQ(groundPt.x, 0.0);
  EXPECT_EQ(groundPt.y, 0.0);   
  EXPECT_EQ(groundPt.z, 0.0);
}

TEST_F(FrameSensorModel, OffBody4) {
   csm::ImageCoord imagePt(15.0, 15.0);
   csm::EcefCoord groundPt = sensorModel->imageToGround(imagePt, 0.0);