Skip to content

Commit

Permalink
Fix SphericalCoordinate deprecation warning in DVL sensor (#460)
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <[email protected]>
  • Loading branch information
iche033 authored Aug 23, 2024
1 parent 1a5a558 commit 40d966b
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 40d966b

Please sign in to comment.