Skip to content

Commit 31384b8

Browse files
authored
Fixed bug where Lat/Lon/Radius point corrections are wrong in points.csv when running a rectangular (XYZ) bundle adjustment (#5688)
* 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 #5646. * Removed unnecessary, duplicate calls to retrieve X,Y, and Z point :coordinates in method BundleSolutionInfo::outputPointsCSV. Addresses #5646.
1 parent 992df27 commit 31384b8

File tree

4 files changed

+86
-9
lines changed

4 files changed

+86
-9
lines changed

CHANGELOG.md

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

6868
### Fixed
69+
- 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.
70+
Issue: [5646](https://github.com/DOI-USGS/ISIS3/issues/5646)
6971
- Fixed noseam bug where a debugging output statement was inadvertently left in noseam.cpp.
7072
Issue: [5660](https://github.com/DOI-USGS/ISIS3/issues/5660)
7173
- 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

+64-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,63 @@ 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 xCor = corrections(0); // km
1674+
double yCor = corrections(1); // km
1675+
double zCor = corrections(2); // km
1676+
1677+
if (!IsSpecial(dX) && !IsSpecial(dY) && !IsSpecial(dZ)) {
1678+
SurfacePoint rectPoint(Displacement(dX - xCor, Displacement::Kilometers),
1679+
Displacement(dY - yCor, Displacement::Kilometers),
1680+
Displacement(dZ - zCor, Displacement::Kilometers));
1681+
1682+
latInit = rectPoint.GetLatitude().degrees();
1683+
lonInit = rectPoint.GetLongitude().degrees();
1684+
radInit = rectPoint.GetLocalRadius().kilometers();
1685+
1686+
if (!IsSpecial(dLat)) {
1687+
cor_lat_dd = (dLat - latInit); // degrees
1688+
cor_lat_m = cor_lat_dd * DEG2RAD * rtm;
1689+
}
1690+
if (!IsSpecial(dLon)) {
1691+
cor_lon_dd = (dLon - lonInit); // degrees
1692+
cor_lon_m = cor_lon_dd * DEG2RAD * rtm * cos(dLat*DEG2RAD); // lon corrections meters
1693+
}
1694+
if (!IsSpecial(dRadius)) {
1695+
cor_rad_km = dRadius - radInit;
1696+
cor_rad_m = cor_rad_km * 1000.;
1697+
}
1698+
}
1699+
}
1700+
else if (m_settings->controlPointCoordTypeBundle() == SurfacePoint::Latitudinal) {
1701+
cor_lat_dd = corrections(0) * RAD2DEG; // lat correction, decimal degs
1702+
cor_lon_dd = corrections(1) * RAD2DEG; // lon correction, decimal degs
1703+
cor_rad_m = corrections(2) * 1000.0; // radius correction, meters
1704+
1705+
cor_lat_m = bundlecontrolpoint->adjustedSurfacePoint().LatitudeToMeters(corrections(0));
1706+
cor_lon_m = bundlecontrolpoint->adjustedSurfacePoint().LongitudeToMeters(corrections(1));
1707+
cor_rad_km = corrections(2);
1708+
1709+
if (!IsSpecial(dLat)) {
1710+
latInit = dLat - cor_lat_dd;
1711+
}
1712+
1713+
if (!IsSpecial(dLon)) {
1714+
lonInit = dLon - cor_lon_dd;
1715+
}
1716+
1717+
if (!IsSpecial(dRadius)) {
1718+
radInit = dRadius - corrections(2); // km
1719+
}
1720+
}
16651721

16661722
if (bundlecontrolpoint->type() == ControlPoint::Fixed) {
16671723
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)