diff --git a/include/gz/msgs/Utility.hh b/include/gz/msgs/Utility.hh index 85de9aef..cdc1d030 100644 --- a/include/gz/msgs/Utility.hh +++ b/include/gz/msgs/Utility.hh @@ -220,10 +220,10 @@ namespace gz msgs::SphericalCoordinates Convert( const math::SphericalCoordinates &_coord); - /// \brief Convert a msgs::SphericalCoordinatesType to an - /// gz::math::SphericalCoordinates::CoordinateTpye + /// \brief Convert a gz::math::SphericalCoordinates::CoordinateType + /// to a msgs::SphericalCoordinatesType /// \param[in] _coord The spherical coordinates to convert - /// \return A gz::math::SphericalCoordinatesType object + /// \return A gz::msgs::SphericalCoordinatesType object GZ_MSGS_VISIBLE msgs::SphericalCoordinatesType ConvertCoord( const math::SphericalCoordinates::CoordinateType &_coord); diff --git a/proto/gz/msgs/data_load_options.proto b/proto/gz/msgs/data_load_options.proto index 7ab7cd3e..7a03a452 100644 --- a/proto/gz/msgs/data_load_options.proto +++ b/proto/gz/msgs/data_load_options.proto @@ -25,7 +25,7 @@ import "gz/msgs/spherical_coordinates.proto"; /// \brief Used for specifying how to load environmental data message DataLoadPathOptions { - /// \brief + /// \brief Units used by spherical coordinates enum DataAngularUnits { RADIANS = 0; diff --git a/src/Utility.cc b/src/Utility.cc index 44b59d66..70554f20 100644 --- a/src/Utility.cc +++ b/src/Utility.cc @@ -199,6 +199,10 @@ namespace gz return math::SphericalCoordinates::CoordinateType::LOCAL; case msgs::SphericalCoordinatesType::LOCAL2: return math::SphericalCoordinates::CoordinateType::LOCAL2; + default: + //default to local coords + std::cerr << "Invalid coordinate type passed. Defaulting to local.\n"; + return math::SphericalCoordinates::CoordinateType::LOCAL; } } @@ -384,6 +388,9 @@ namespace gz return msgs::SphericalCoordinatesType::LOCAL; case math::SphericalCoordinates::CoordinateType::LOCAL2: return msgs::SphericalCoordinatesType::LOCAL2; + default: + std::cerr << "Invalid coordinate type passed. Defaulting to local.\n"; + return msgs::SphericalCoordinatesType::LOCAL; } } diff --git a/src/Utility_TEST.cc b/src/Utility_TEST.cc index 82caa059..71b3f2e7 100644 --- a/src/Utility_TEST.cc +++ b/src/Utility_TEST.cc @@ -419,6 +419,18 @@ TEST(MsgsTest, ConvertMathSphericalCoordinatedTypeToMsg) EXPECT_EQ(msgs::ConvertCoord( math::SphericalCoordinates::CoordinateType::ECEF), msgs::SphericalCoordinatesType::ECEF); + EXPECT_EQ(msgs::ConvertCoord( + math::SphericalCoordinates::CoordinateType::GLOBAL), + msgs::SphericalCoordinatesType::GLOBAL); + EXPECT_EQ(msgs::ConvertCoord( + math::SphericalCoordinates::CoordinateType::SPHERICAL), + msgs::SphericalCoordinatesType::SPHERICAL); + EXPECT_EQ(msgs::ConvertCoord( + math::SphericalCoordinates::CoordinateType::LOCAL), + msgs::SphericalCoordinatesType::LOCAL); + EXPECT_EQ(msgs::ConvertCoord( + math::SphericalCoordinates::CoordinateType::LOCAL2), + msgs::SphericalCoordinatesType::LOCAL2); } /////////////////////////////////////////////////