Commit 529dafb7 authored by Jeannie Backer's avatar Jeannie Backer
Browse files

Updated OSIRIS-REx camera model to handle latest IK codes. Fixes #5127.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@8079 41f8697f-d340-4b68-9986-7bafba869bb8
parent f20abd94
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ void IsisMain() {
  insXlater.Auto(outLabel);
  output->putGroup(outLabel.findGroup("Instrument", Pvl::Traverse));


  // Create a Band Bin group
  FileName bandTransFile(transDir + "ocamsBandBin_fit.trn");
  PvlToPvlTranslationManager bandBinXlater(fitsLabel, bandTransFile.expanded());
@@ -55,15 +56,7 @@ void IsisMain() {
  output->putGroup(outLabel.findGroup("BandBin", Pvl::Traverse));

  // Create a Kernels group
  QString kernelsTransFileName = "";
  QString instrument = outLabel.findGroup("Instrument", Pvl::Traverse)["InstrumentId"];
  if (QString::compare(instrument, "PolyCam", Qt::CaseInsensitive) == 0) {
    kernelsTransFileName = transDir + "ocamsPolyCamKernels_fit.trn";
  }
  else {
    kernelsTransFileName = transDir + "ocamsKernels_fit.trn";
  }
  FileName kernelsTransFile(kernelsTransFileName);
  FileName kernelsTransFile(transDir + "ocamsKernels_fit.trn");
  PvlToPvlTranslationManager kernelsXlater(fitsLabel, kernelsTransFile.expanded());
  kernelsXlater.Auto(outLabel);
  output->putGroup(outLabel.findGroup("Kernels", Pvl::Traverse));
+4 −0
Original line number Diff line number Diff line
@@ -28,6 +28,10 @@
    <change name="Jeannie Backer" date="2017-08-23">
      Updated to translate PolyCam kernels separately from other cameras. Fixes #5128
    </change>
    <change name="Jeannie Backer" date="2017-08-25">
      Reverted code to only deal with a single kernels translation file for all instruments. Added 
      PolyCamFocusPositionNaifId keyoword to kernels translation file. References #5127
    </change>
  </history>

  <seeAlso>
+30 −14
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@

#include "OsirisRexOcamsCamera.h"

#include <QDebug>
#include <QString>

#include "CameraDetectorMap.h"
@@ -48,32 +49,46 @@ namespace Isis {
    m_spacecraftNameLong = "OSIRIS-REx";
    m_spacecraftNameShort = "OSIRIS-REx";

    int ikCode = naifIkCode();
    // The general IK code will be used to retrieve the transx,
    // transy, transs and transl from the iak. The focus position specific
    // IK code will be used to find pixel pitch and ccd center in the ik.
    int frameCode = naifIkCode();

    if (ikCode == -64361) {
    if (frameCode == -64361) {
      m_instrumentNameLong = "Mapping Camera";
      m_instrumentNameShort = "MapCam";
    }
    else if (ikCode <= -64362) {
    else if (frameCode == -64362) {
      m_instrumentNameLong = "Sampling Camera";
      m_instrumentNameShort = "SamCam";
    }
    else if (ikCode <= -64360) {
    } // IK values for polycam: -64360 (general) and -64616 to -64500 (focus specific)
    else if (frameCode == -64360) {
      m_instrumentNameLong = "PolyMath Camera";
      m_instrumentNameShort = "PolyCam";
    }
    else {
      QString msg = "Unable to construct OSIRIS-REx camera model. "
                    "Unrecognized NaifFrameCode [" + toString(frameCode) + "].";
      throw IException(IException::User, msg, _FILEINFO_);
    }

    Pvl &lab = *cube.label();
    PvlGroup inst = lab.findGroup("Instrument", Pvl::Traverse);
    QString ikCode = toString(frameCode);
    if (inst.hasKeyword("PolyCamFocusPositionNaifId")) {
      if (QString::compare("NONE", inst["PolyCamFocusPositionNaifId"], Qt::CaseInsensitive) != 0) {
        ikCode = inst["PolyCamFocusPositionNaifId"][0];
      }
    }

    SetFocalLength();
    QString focalLength = "INS" + ikCode + "_FOCAL_LENGTH";
    SetFocalLength(getDouble(focalLength));

    // The instrument kernel contains pixel pitch in microns, so convert it to mm.
    QString pitch = "INS" + toString(naifIkCode()) + "_PIXEL_SIZE";
    QString pitch = "INS" + ikCode + "_PIXEL_SIZE";
    SetPixelPitch(getDouble(pitch) / 1000.0);

    // Get the start time in et
    Pvl &lab = *cube.label();
    PvlGroup inst = lab.findGroup("Instrument", Pvl::Traverse);

    // Set the observation time and exposure duration
    QString clockCount = inst["SpacecraftClockStartCount"];
    double startTime = getClockTime(clockCount).Et();
@@ -86,14 +101,15 @@ namespace Isis {
    // Setup detector map
    new CameraDetectorMap(this);

    // Setup focal plane map
    CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
    // Setup focal plane map using the general IK code for the given camera
    // Note that this is not the specific naifIkCode() value for PolyCam
    CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, frameCode);

    // The instrument kernel contains a CCD_CENTER keyword instead of BORESIGHT_LINE
    // and BORESIGHT_SAMPLE keywords.
    focalMap->SetDetectorOrigin(
        Spice::getDouble("INS" + toString(naifIkCode()) + "_CCD_CENTER", 0) + 1.0,
        Spice::getDouble("INS" + toString(naifIkCode()) + "_CCD_CENTER", 1) + 1.0);
        Spice::getDouble("INS" + ikCode + "_CCD_CENTER", 0) + 1.0,
        Spice::getDouble("INS" + ikCode + "_CCD_CENTER", 1) + 1.0);

    // Setup distortion map
    new CameraDistortionMap(this);
+5 −0
Original line number Diff line number Diff line
@@ -44,6 +44,11 @@ namespace Isis {
   *   @history 2016-12-27 Jeannie Backer - Fixed coding standards. Improved docuementation.
   *                           Fixed CKFrameId() to return the spacecraft ID rather than the MapCam
   *                           ID. Added tests. Moved from branch into trunk. Fixes #4570.
   *   @history 2017-08-25 Jeannie Backer - Updated to handle multiple focus postition IK
   *                           codes for PolyCam frames. We read PolyCamFocusPositionNaifId from
   *                           the Instrument group for focus position specific values (such ase
   *                           focal length) and we read NaifFrameId from the Kernels group the
   *                           instrument frame code. Fixes #5127
   *
   */
  class OsirisRexOcamsCamera : public FramingCamera {
+84 −8
Original line number Diff line number Diff line
Unit Test for OsirisRexOcamsCamera...

Testing PolyCam...
Testing PolyCam (backwards compatibility)...
FileName: 2019-01-13T23_36_05.000_PCAM_L2b_V001.cub
CK Frame: -64360
NAIF Frame ID: -64360

Kernel IDs: 
CK Frame ID = -64000
@@ -34,14 +34,52 @@ For lower right corner ...
DeltaSample = 0.000000000
DeltaLine = 0.000000000

For known pixel position ...
Latitude OK
Longitude OK

Testing PolyCam (with PolyCamFocusPositionNaifId keyword)...
FileName: 20190113T191852S740_pol_iofL2pan_V001.cub
NAIF Frame ID: -64360

Kernel IDs: 
CK Frame ID = -64000
CK Reference ID = 1
SPK Target ID = -64
SPK Reference ID = 1

Spacecraft Name Long: OSIRIS-REx
Spacecraft Name Short: OSIRIS-REx
Instrument Name Long: PolyMath Camera
Instrument Name Short: PolyCam

Shutter open = 600679201.924284339
Shutter close = 600679201.944284320

For upper left corner ...
DeltaSample = 0.000000000
DeltaLine = 0.000000000

For upper right corner ...
DeltaSample = 0.000000000
DeltaLine = 0.000000000

For lower left corner ...
DeltaSample = 0.000000000
DeltaLine = 0.000000000

For lower right corner ...
DeltaSample = 0.000000000
DeltaLine = 0.000000000

For known pixel position ...
Latitude OK
Longitude OK
============================================================================

Testing MapCam...
Testing MapCam (backwards compatibility)...
FileName: D19030320000.cub
CK Frame: -64361
NAIF Frame ID: -64361

Kernel IDs: 
CK Frame ID = -64000
@@ -58,12 +96,12 @@ Shutter open = 604879475.185411930
Shutter close = 604879475.205411911

For upper left corner ...
DeltaSample = ERROR
DeltaLine = ERROR
DeltaSample = NO INTERSECTION
DeltaLine = NO INTERSECTION

For upper right corner ...
DeltaSample = ERROR
DeltaLine = ERROR
DeltaSample = NO INTERSECTION
DeltaLine = NO INTERSECTION

For lower left corner ...
DeltaSample = 0.000000000
@@ -73,6 +111,44 @@ For lower right corner ...
DeltaSample = 0.000000000
DeltaLine = 0.000000000

For known pixel position ...
Latitude OK
Longitude OK

Testing MapCam (with PolyCamFocusPositionNaifId keyword)...
FileName: 20190303T100344S990_map_iofL2pan_V001.cub
NAIF Frame ID: -64361

Kernel IDs: 
CK Frame ID = -64000
CK Reference ID = 1
SPK Target ID = -64
SPK Reference ID = 1

Spacecraft Name Long: OSIRIS-REx
Spacecraft Name Short: OSIRIS-REx
Instrument Name Long: Mapping Camera
Instrument Name Short: MapCam

Shutter open = 604879494.175411940
Shutter close = 604879494.195411921

For upper left corner ...
DeltaSample = NO INTERSECTION
DeltaLine = NO INTERSECTION

For upper right corner ...
DeltaSample = 0.000000000
DeltaLine = 0.000000000

For lower left corner ...
DeltaSample = NO INTERSECTION
DeltaLine = NO INTERSECTION

For lower right corner ...
DeltaSample = 0.000000000
DeltaLine = 0.000000000

For known pixel position ...
Latitude OK
Longitude OK
Loading