Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate LOCAL2 in SphericalCoordinates #450

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions core/include/gz/msgs/convert/SphericalCoordinates.hh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ inline namespace GZ_MSGS_VERSION_NAMESPACE {
inline msgs::SphericalCoordinatesType ConvertCoord(
const math::SphericalCoordinates::CoordinateType &_sc)
{
GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
auto result = msgs::SphericalCoordinatesType::LOCAL2;
GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION
switch (_sc)
{
case math::SphericalCoordinates::CoordinateType::ECEF:
Expand All @@ -49,9 +51,11 @@ inline msgs::SphericalCoordinatesType ConvertCoord(
case math::SphericalCoordinates::CoordinateType::LOCAL:
result = msgs::SphericalCoordinatesType::LOCAL;
break;
GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
case math::SphericalCoordinates::CoordinateType::LOCAL2:
result = msgs::SphericalCoordinatesType::LOCAL2;
break;
GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION
default:
std::cerr << "Invalid coordinate type passed" << std::endl;
}
Expand All @@ -72,12 +76,16 @@ inline math::SphericalCoordinates::CoordinateType Convert(
return math::SphericalCoordinates::CoordinateType::SPHERICAL;
case msgs::SphericalCoordinatesType::LOCAL:
return math::SphericalCoordinates::CoordinateType::LOCAL;
GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
case msgs::SphericalCoordinatesType::LOCAL2:
return math::SphericalCoordinates::CoordinateType::LOCAL2;
GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION
default:
std::cerr << "Invalid coordinate type passed" << std::endl;
}
GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
return math::SphericalCoordinates::CoordinateType::LOCAL2;
GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION
}

/////////////////////////////////
Expand Down
4 changes: 1 addition & 3 deletions proto/gz/msgs/spherical_coordinates.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@ enum SphericalCoordinatesType
GLOBAL = 2;

/// \brief Heading-adjusted tangent plane (X, Y, Z)
/// This has kept a bug for backwards compatibility, use
/// LOCAL2 for the correct behaviour.
LOCAL = 3;

/// \brief Heading-adjusted tangent plane (X, Y, Z)
LOCAL2 = 4;
LOCAL2 = 4 [deprecated=true];
}

message SphericalCoordinates
Expand Down
9 changes: 9 additions & 0 deletions test/integration/Utility_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,10 @@ TEST(MsgsTest, ConvertMathSphericalCoordinatesToMsgs)
msgs::ConvertCoord(math::SphericalCoordinates::CoordinateType::SPHERICAL));
EXPECT_EQ(msgs::SphericalCoordinatesType::LOCAL,
msgs::ConvertCoord(math::SphericalCoordinates::CoordinateType::LOCAL));
GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
EXPECT_EQ(msgs::SphericalCoordinatesType::LOCAL2,
msgs::ConvertCoord(math::SphericalCoordinates::CoordinateType::LOCAL2));
GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION

EXPECT_EQ(math::SphericalCoordinates::CoordinateType::ECEF,
msgs::Convert(msgs::SphericalCoordinatesType::ECEF));
Expand All @@ -365,8 +367,11 @@ TEST(MsgsTest, ConvertMathSphericalCoordinatesToMsgs)
msgs::Convert(msgs::SphericalCoordinatesType::SPHERICAL));
EXPECT_EQ(math::SphericalCoordinates::CoordinateType::LOCAL,
msgs::Convert(msgs::SphericalCoordinatesType::LOCAL));
GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
EXPECT_EQ(math::SphericalCoordinates::CoordinateType::LOCAL2,
msgs::Convert(msgs::SphericalCoordinatesType::LOCAL2));
GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION


auto msg = msgs::Convert(
math::SphericalCoordinates(
Expand Down Expand Up @@ -452,10 +457,12 @@ TEST(MsgsTest, ConvertMsgsSphericalCoordinatesTypeToMath)
math::SphericalCoordinates::CoordinateType::SPHERICAL);
EXPECT_EQ(Convert(msgs::SphericalCoordinatesType::LOCAL),
math::SphericalCoordinates::CoordinateType::LOCAL);
GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
EXPECT_EQ(Convert(msgs::SphericalCoordinatesType::LOCAL2),
math::SphericalCoordinates::CoordinateType::LOCAL2);
EXPECT_EQ(Convert((msgs::SphericalCoordinatesType)500000),
math::SphericalCoordinates::CoordinateType::LOCAL2);
GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION
}

/////////////////////////////////////////////////
Expand All @@ -473,12 +480,14 @@ TEST(MsgsTest, ConvertMathSphericalCoordinatedTypeToMsg)
EXPECT_EQ(msgs::ConvertCoord(
math::SphericalCoordinates::CoordinateType::LOCAL),
msgs::SphericalCoordinatesType::LOCAL);
GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
EXPECT_EQ(msgs::ConvertCoord(
math::SphericalCoordinates::CoordinateType::LOCAL2),
msgs::SphericalCoordinatesType::LOCAL2);
EXPECT_EQ(msgs::ConvertCoord(
(math::SphericalCoordinates::CoordinateType)500000),
msgs::SphericalCoordinatesType::LOCAL2);
GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION
}

/////////////////////////////////////////////////
Expand Down
Loading