Skip to content

Commit 931c4dc

Browse files
authored
Merge branch 'main' into merge_8_main_20240822
2 parents 3505389 + 40d966b commit 931c4dc

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

src/DopplerVelocityLog.cc

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,12 +1731,34 @@ namespace gz
17311731
samplePointInSensorFrame;
17321732

17331733
// Transform sample point to the environmental data frame
1734-
const gz::math::Vector3d samplePointInDataFrame =
1734+
const std::optional<gz::math::CoordinateVector3>
1735+
samplePointInDataFrameCoordVec =
17351736
this->worldState->origin.PositionTransform(
1736-
samplePointInWorldFrame,
1737+
gz::math::CoordinateVector3::Metric(samplePointInWorldFrame),
17371738
gz::math::SphericalCoordinates::GLOBAL,
17381739
this->waterVelocityReference);
17391740

1741+
if (!samplePointInDataFrameCoordVec.has_value())
1742+
continue;
1743+
1744+
gz::math::Vector3d samplePointInDataFrame;
1745+
if (samplePointInDataFrameCoordVec->IsSpherical())
1746+
{
1747+
samplePointInDataFrame.Set(
1748+
samplePointInDataFrameCoordVec->Lat()->Radian(),
1749+
samplePointInDataFrameCoordVec->Lon()->Radian(),
1750+
*samplePointInDataFrameCoordVec->Z());
1751+
}
1752+
else if (samplePointInDataFrameCoordVec->IsMetric())
1753+
{
1754+
samplePointInDataFrame =
1755+
*samplePointInDataFrameCoordVec->AsMetricVector();
1756+
}
1757+
else
1758+
{
1759+
continue;
1760+
}
1761+
17401762
// Sample water velocity in the world frame at sample point
17411763
const gz::math::Vector3d sampledVelocityInWorldFrame =
17421764
this->waterVelocity->LookUp(samplePointInDataFrame);

0 commit comments

Comments
 (0)