Skip to content

Commit

Permalink
Address PR feedback.
Browse files Browse the repository at this point in the history
Signed-off-by: Arjo Chakravarty <[email protected]>
  • Loading branch information
arjo129 committed Jan 25, 2023
1 parent 56b157a commit 303df10
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
6 changes: 3 additions & 3 deletions include/gz/msgs/Utility.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion proto/gz/msgs/data_load_options.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions src/Utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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;
}
}

Expand Down
12 changes: 12 additions & 0 deletions src/Utility_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/////////////////////////////////////////////////
Expand Down

0 comments on commit 303df10

Please sign in to comment.