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

Remove deprecations: tock #476

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
32 changes: 32 additions & 0 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,38 @@ Deprecated code produces compile-time warnings. These warning serve as
notification to users that their code should be upgraded. The next major
release will remove the deprecated code.

## Gazebo Msgs 11.X to 12.X

### Deprecations

1. **camerasensor.proto**
+ The `image_format` field is deprecated. Use `pixel_format` instead.

1. **gps.proto**
+ This message is deprecated. Use `NavSat` instead.

1. **gps_sensor.proto**
+ This message is deprecated. Use `NavSat` instead.

### Removals

1. **spherical_coordinates.proto**
+ The `LOCAL2` item has been removed from the
`msgs::SphericalCoordinatesType` enum.

1. **SphericalCoordinates.hh**
+ The function `inline msgs::SphericalCoordinatesType ConvertCoord(
const math::SphericalCoordinates::CoordinateType &_sc)`
does not accept `math::SphericalCoordinates::CoordinatesType::LOCAL2` anymore.
+ The function `inline math::SphericalCoordinates::CoordinateType Convert(
const msgs::SphericalCoordinatesType &_sc)`
does not accept `msgs::SphericalCoordinatesType::LOCAL2` anymore.

1. **MessageFactory.hh**
+ The function `MessageFactory::MessagePtr MessageFactory::New(
const std::string &_msgType)` does not accept non-fully qualified names
anymore.

## Gazebo Msgs 10.X to 11.X
### Deprecations

Expand Down
17 changes: 2 additions & 15 deletions core/include/gz/msgs/convert/SphericalCoordinates.hh
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ 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
auto result = msgs::SphericalCoordinatesType::LOCAL;
switch (_sc)
{
case math::SphericalCoordinates::CoordinateType::ECEF:
Expand All @@ -51,11 +49,6 @@ 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 @@ -76,16 +69,10 @@ 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
return math::SphericalCoordinates::CoordinateType::LOCAL;
}

/////////////////////////////////
Expand Down
13 changes: 0 additions & 13 deletions core/src/MessageFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,6 @@ MessageFactory::MessagePtr MessageFactory::New(
};

auto ret = getMessagePtr(type);

// Message was not found in either static or dynamic message types,
// try again adding the gz.msgs prefix
if (nullptr == ret)
{
ret = getMessagePtr(kGzMsgsPrefix + type);
if (nullptr != ret)
{
std::cerr << "Message (" << kGzMsgsPrefix + type
<< ") was retrieved with non-fully qualified name. "
<< "This behavior is deprecated in msgs12" << std::endl;
}
}
return ret;
}

Expand Down
2 changes: 1 addition & 1 deletion proto/gz/msgs/camerasensor.proto
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ message CameraSensor
Vector2d image_size = 3;

/// \brief Image format. This field is deprecated, please use pixel_format.
string image_format = 4;
string image_format = 4 [deprecated = true];

/// \brief Near clip distance in meters.
double near_clip = 5;
Expand Down
4 changes: 4 additions & 0 deletions proto/gz/msgs/gps.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ option java_outer_classname = "GPSProtos";
/// \interface GPS
/// \brief Data from a GPS sensor
/// This message will be deprecated, use NavSat instead.
/// Remove this message in gz-msgs13.

import "gz/msgs/header.proto";

message GPS
{
/// \brief Deprecated message.
option deprecated = true;

/// \brief Optional header data
Header header = 1;

Expand Down
4 changes: 4 additions & 0 deletions proto/gz/msgs/gps_sensor.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ option java_outer_classname = "Protos";
/// \interface GPSSensor
/// \brief Information about a GPS sensor element
/// This message will be deprecated in favor of NavSat sensor.
/// Remove this message in gz-msgs13.

import "gz/msgs/sensor_noise.proto";
import "gz/msgs/header.proto";

message GPSSensor
{
/// \brief Deprecated message.
option deprecated = true;

/// \brief Sensing information
message Sensing
{
Expand Down
3 changes: 0 additions & 3 deletions proto/gz/msgs/spherical_coordinates.proto
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ enum SphericalCoordinatesType

/// \brief Heading-adjusted tangent plane (X, Y, Z)
LOCAL = 3;

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

message SphericalCoordinates
Expand Down
2 changes: 1 addition & 1 deletion test/integration/Factory_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ TEST(FactoryTest, NewWithMalformedData)
TEST(FactoryTest, DeprecatedNonFullyQualified)
{
auto msg = Factory::New("StringMsg");
EXPECT_TRUE(msg.get() != nullptr);
EXPECT_TRUE(msg.get() == nullptr);
}

/////////////////////////////////////////////////
Expand Down
21 changes: 2 additions & 19 deletions test/integration/Utility_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,6 @@ 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 @@ -367,10 +363,6 @@ 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(
Expand Down Expand Up @@ -457,12 +449,8 @@ 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
math::SphericalCoordinates::CoordinateType::LOCAL);
}

/////////////////////////////////////////////////
Expand All @@ -480,14 +468,9 @@ 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
msgs::SphericalCoordinatesType::LOCAL);
}

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