Skip to content

Commit 332ec10

Browse files
committed
Fixed bug in the method BundleSolutionInfo::outputPointsCSV() where, when performing a rectangular (XYZ) bundle adjustment, the Lat/Lon/Radius point corrections written to points.csv are incorrect and do not match those written to bundleout.txt. Also modified the ctest FunctionalTestJigsawBundleXYZ to spot check six lines (points) in points.csv. Addresses DOI-USGS#5646.
1 parent a8dca4f commit 332ec10

File tree

4 files changed

+89
-9
lines changed

4 files changed

+89
-9
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ release.
5353
- Changed 'User Parameters' group in camstats to UserParameters for PVL compliance [#5625](https://github.com/DOI-USGS/ISIS3/issues/5625).
5454

5555
### Fixed
56+
- Fixed bug in the method BundleSolutionInfo::outputPointsCSV() where, when performing a rectangular (XYZ) bundle adjustment, the Lat/Lon/Radius point corrections written to points.csv are incorrect and do not match those written to bundleout.txt. Also modified the ctest FunctionalTestJigsawBundleXYZ to spot check six lines (points) in points.csv.
57+
Issue: [5646](https://github.com/DOI-USGS/ISIS3/issues/5646)
5658
- Fixed noseam bug where a debugging output statement was inadvertently left in noseam.cpp.
5759
Issue: [5660](https://github.com/DOI-USGS/ISIS3/issues/5660)
5860
- Fixed jigsaw bugs in which RADIUS is handled incorrectly in the jigsaw gui and in the bundleout.txt

isis/src/control/objs/BundleSolutionInfo/BundleSolutionInfo.cpp

+67-8
Original file line numberDiff line numberDiff line change
@@ -1613,9 +1613,15 @@ namespace Isis {
16131613
double dX, dY, dZ;
16141614
double dSigmaLat, dSigmaLong, dSigmaRadius;
16151615
QString strStatus;
1616-
double cor_lat_m;
1617-
double cor_lon_m;
1618-
double cor_rad_m;
1616+
double cor_lat_dd = 0.0; // lat correction, decimal degrees
1617+
double cor_lon_dd = 0.0; // lon correction, decimal degrees
1618+
double cor_rad_km = 0.0; // radius correction, kilometers
1619+
double cor_lat_m = 0.0; // lat correction, meters
1620+
double cor_lon_m = 0.0; // lon correction, meters
1621+
double cor_rad_m = 0.0; // radius correction, meters
1622+
double latInit = Isis::Null;
1623+
double lonInit = Isis::Null;
1624+
double radInit = Isis::Null;
16191625
int numMeasures, numRejectedMeasures;
16201626
double dResidualRms;
16211627

@@ -1655,13 +1661,66 @@ namespace Isis {
16551661
numRejectedMeasures = bundlecontrolpoint->numberOfRejectedMeasures();
16561662
dResidualRms = bundlecontrolpoint->residualRms();
16571663

1664+
// Use the local radius in meters, rad*1000., to convert radians to meters now instead of the
1665+
// target body equatorial radius (DAC 09/17/2018; from BundleControlPoint.cpp)
1666+
double rtm = dRadius * 1000.;
1667+
16581668
// point corrections and initial sigmas
16591669
boost::numeric::ublas::bounded_vector< double, 3 > corrections = bundlecontrolpoint->
1660-
corrections();
1661-
// Now use the local radius to convert radians to meters instead of the target body equatorial radius
1662-
cor_lat_m = bundlecontrolpoint->adjustedSurfacePoint().LatitudeToMeters(corrections[0]);
1663-
cor_lon_m = bundlecontrolpoint->adjustedSurfacePoint().LongitudeToMeters(corrections[1]);
1664-
cor_rad_m = corrections[2]*1000.0;
1670+
corrections();
1671+
1672+
if (m_settings->controlPointCoordTypeBundle() == SurfacePoint::Rectangular) {
1673+
double x = bundlecontrolpoint->adjustedSurfacePoint().GetX().kilometers();
1674+
double xCor = corrections(0); // km
1675+
double y = bundlecontrolpoint->adjustedSurfacePoint().GetY().kilometers();
1676+
double yCor = corrections(1); // km
1677+
double z = bundlecontrolpoint->adjustedSurfacePoint().GetZ().kilometers();
1678+
double zCor = corrections(2); // km
1679+
1680+
if (!IsSpecial(x) && !IsSpecial(y) && !IsSpecial(z)) {
1681+
SurfacePoint rectPoint(Displacement(x - xCor, Displacement::Kilometers),
1682+
Displacement(y - yCor, Displacement::Kilometers),
1683+
Displacement(z - zCor, Displacement::Kilometers));
1684+
1685+
latInit = rectPoint.GetLatitude().degrees();
1686+
lonInit = rectPoint.GetLongitude().degrees();
1687+
radInit = rectPoint.GetLocalRadius().kilometers();
1688+
1689+
if (!IsSpecial(dLat)) {
1690+
cor_lat_dd = (dLat - latInit); // degrees
1691+
cor_lat_m = cor_lat_dd * DEG2RAD * rtm;
1692+
}
1693+
if (!IsSpecial(dLon)) {
1694+
cor_lon_dd = (dLon - lonInit); // degrees
1695+
cor_lon_m = cor_lon_dd * DEG2RAD * rtm * cos(dLat*DEG2RAD); // lon corrections meters
1696+
}
1697+
if (!IsSpecial(dRadius)) {
1698+
cor_rad_km = dRadius - radInit;
1699+
cor_rad_m = cor_rad_km * 1000.;
1700+
}
1701+
}
1702+
}
1703+
else if (m_settings->controlPointCoordTypeBundle() == SurfacePoint::Latitudinal) {
1704+
cor_lat_dd = corrections(0) * RAD2DEG; // lat correction, decimal degs
1705+
cor_lon_dd = corrections(1) * RAD2DEG; // lon correction, decimal degs
1706+
cor_rad_m = corrections(2) * 1000.0; // radius correction, meters
1707+
1708+
cor_lat_m = bundlecontrolpoint->adjustedSurfacePoint().LatitudeToMeters(corrections(0));
1709+
cor_lon_m = bundlecontrolpoint->adjustedSurfacePoint().LongitudeToMeters(corrections(1));
1710+
cor_rad_km = corrections(2);
1711+
1712+
if (!IsSpecial(dLat)) {
1713+
latInit = dLat - cor_lat_dd;
1714+
}
1715+
1716+
if (!IsSpecial(dLon)) {
1717+
lonInit = dLon - cor_lon_dd;
1718+
}
1719+
1720+
if (!IsSpecial(dRadius)) {
1721+
radInit = dRadius - corrections(2); // km
1722+
}
1723+
}
16651724

16661725
if (bundlecontrolpoint->type() == ControlPoint::Fixed) {
16671726
strStatus = "FIXED";

isis/src/control/objs/BundleSolutionInfo/BundleSolutionInfo.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,10 @@ namespace Isis {
164164
* solution. 3) Cleaned up spacing of Point Coordinate output in the
165165
* "INPUT: GLOBAL IMAGE PARAMETER UNCERTAINTIES" section. Originally
166166
* added to UofA code on 2019-07-30.
167-
*
167+
* @history 2024-12-03 Ken Edmundson - Fixed bug where, when performing a rectangular (XYZ)
168+
* bundle adjustment, the Lat/Lon/Radius point corrections written
169+
* to the points.csv file are incorrect and do not match those written
170+
* to the bundleout.txt file.
168171
*/
169172
class BundleSolutionInfo : public QObject {
170173
Q_OBJECT

isis/tests/FunctionalTestsJigsaw.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,22 @@ TEST_F(ApolloNetwork, FunctionalTestJigsawBundleXYZ) {
291291
UserInterface ui3(APP_XML, args3);
292292
jigsaw(ui3);
293293

294+
// spot check several points in rectlat_bundleout=_points.csv file for hard-coded values
295+
QString pointsOutput = tempDir.path() + "/rectlat_bundleout_points.csv";
296+
297+
CSVReader::CSVAxis csvLine;
298+
CSVReader line = CSVReader(pointsOutput, false, 0, ',', false, true);
299+
300+
// A few "Free" points:
301+
compareCsvLine(line.getRow(30), "AS15_000031957,FREE,3,0,0.33,24.24953243,6.15316218,1736.04358729,293.41498797,289.79559800,472.66868036,842.07328770,-1763.20169592,-574.06347857,1573.74545615,169.66190348,713.01291344");
302+
compareCsvLine(line.getRow(185), "AS15_000055107,FREE,2,0,2.22,24.26546675,6.76093993,1735.38959424,326.33192236,324.29734631,531.76648698,860.53696982,-1800.17000826,-593.89727230,1571.06817968,186.25235838,713.18432228");
303+
compareCsvLine(line.getRow(396), "AS15_Tie14,FREE,4,0,0.76,23.33873588,4.52915858,1737.24818101,272.63659718,266.05983706,414.39324142,981.58162483,-1855.42653496,-276.42906027,1590.12330171,125.95969814,688.23926236");
304+
305+
// A few "Constrained" points:
306+
compareCsvLine(line.getRow(352), "AS15_SocetPAN_01,CONSTRAINED,3,0,0.27,27.61551409,2.18873444,1735.73157411,189.25634559,169.77950505,259.83985021,122.85201072,202.20461434,253.94911381,1536.87168268,58.73802953,804.57403154", 2);
307+
compareCsvLine(line.getRow(360), "AS15_SocetPAN_10,CONSTRAINED,4,0,1.14,25.96576384,3.54303398,1735.73354221,138.47609050,115.15295944,171.82752027,-57.33146538,185.48616378,16.79221293,1557.53867571,96.43742025,759.96317490", 2);
308+
compareCsvLine(line.getRow(380), "AS15_SocetPAN_40,CONSTRAINED,2,0,0.42,25.77444416, 1.88039771,1735.54642874,157.27333414,137.46544829,212.01849634,7.32724742,68.12099922,156.67875462,1562.04017978,51.28321523,754.66675754", 2);
309+
294310
// Compare network and images.csv against the latitude, latitude bundle
295311

296312
// Compare network against the latitude/latitude network

0 commit comments

Comments
 (0)