Skip to content

Commit

Permalink
Merge branch 'main' into merge_8_main_20240822
Browse files Browse the repository at this point in the history
  • Loading branch information
iche033 authored Aug 23, 2024
2 parents 3505389 + 40d966b commit 931c4dc
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/DopplerVelocityLog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1731,12 +1731,34 @@ namespace gz
samplePointInSensorFrame;

// Transform sample point to the environmental data frame
const gz::math::Vector3d samplePointInDataFrame =
const std::optional<gz::math::CoordinateVector3>
samplePointInDataFrameCoordVec =
this->worldState->origin.PositionTransform(
samplePointInWorldFrame,
gz::math::CoordinateVector3::Metric(samplePointInWorldFrame),
gz::math::SphericalCoordinates::GLOBAL,
this->waterVelocityReference);

if (!samplePointInDataFrameCoordVec.has_value())
continue;

gz::math::Vector3d samplePointInDataFrame;
if (samplePointInDataFrameCoordVec->IsSpherical())
{
samplePointInDataFrame.Set(
samplePointInDataFrameCoordVec->Lat()->Radian(),
samplePointInDataFrameCoordVec->Lon()->Radian(),
*samplePointInDataFrameCoordVec->Z());
}
else if (samplePointInDataFrameCoordVec->IsMetric())
{
samplePointInDataFrame =
*samplePointInDataFrameCoordVec->AsMetricVector();
}
else
{
continue;
}

// Sample water velocity in the world frame at sample point
const gz::math::Vector3d sampledVelocityInWorldFrame =
this->waterVelocity->LookUp(samplePointInDataFrame);
Expand Down

0 comments on commit 931c4dc

Please sign in to comment.