From f4b43a5ac0a9ad8d942fe90749e3df6b29ae386f Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Tue, 20 Dec 2022 22:10:46 +0800 Subject: [PATCH 01/11] Adds a message that allows loading environments via a topic Required by https://github.com/gazebosim/gz-sim/pull/1842 Signed-off-by: Arjo Chakravarty --- include/gz/msgs/Utility.hh | 16 ++++++ proto/gz/msgs/data_load_options.proto | 60 +++++++++++++++++++++++ proto/gz/msgs/spherical_coordinates.proto | 20 ++++++++ src/Utility.cc | 38 ++++++++++++++ src/Utility_TEST.cc | 23 +++++++++ 5 files changed, 157 insertions(+) create mode 100644 proto/gz/msgs/data_load_options.proto diff --git a/include/gz/msgs/Utility.hh b/include/gz/msgs/Utility.hh index b737da96..1d57c5ac 100644 --- a/include/gz/msgs/Utility.hh +++ b/include/gz/msgs/Utility.hh @@ -94,6 +94,14 @@ namespace gz math::SphericalCoordinates Convert( const msgs::SphericalCoordinates &_coord); + /// \brief Convert a msgs::SphericalCoordinatesType to an + /// gz::math::SphericalCoordinates::CoordinateTpye + /// \param[in] _sc The spherical coordinate type to convert + /// \return A gz::math::SphericalCoordinatesType object + GZ_MSGS_VISIBLE + math::SphericalCoordinates::CoordinateType Convert( + const msgs::SphericalCoordinatesType &_sc); + /// \brief Convert a msgs::AxisAlignedBox to an /// gz::math::AxisAlignedBox /// \param[in] _b The axis aligned box to convert @@ -212,6 +220,14 @@ namespace gz msgs::SphericalCoordinates Convert( const math::SphericalCoordinates &_coord); + /// \brief Convert a msgs::SphericalCoordinatesType to an + /// gz::math::SphericalCoordinates::CoordinateTpye + /// \param[in] _coord The spherical coordinates to convert + /// \return A gz::math::SphericalCoordinatesType object + GZ_MSGS_VISIBLE + msgs::SphericalCoordinatesType ConvertCoord( + const math::SphericalCoordinates::CoordinateType &_sc); + /// \brief Convert a gz::math::Planed to a msgs::PlaneGeom /// \param[in] _p The plane to convert /// \return A msgs::PlaneGeom object diff --git a/proto/gz/msgs/data_load_options.proto b/proto/gz/msgs/data_load_options.proto new file mode 100644 index 00000000..f83c630f --- /dev/null +++ b/proto/gz/msgs/data_load_options.proto @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2022 Open Source Robotics Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +syntax = "proto3"; +package gz.msgs; +option java_package = "com.gz.msgs"; +option java_outer_classname = "DataLoadPathOptions"; + +import "gz/msgs/spherical_coordinates.proto"; + + + +/// \brief Used for specifying how to load environmental data +message DataLoadPathOptions +{ + /// \brief + enum DataAngularUnits + { + RADIANS = 0; + DEGREES = 1; + } + + /// \brief File path to load + string path = 1; + + /// \brief Name of time axis + string time = 2; + + /// \brief Is the data static in time + bool static_time = 3; + + /// \brief Name of x axis + string x = 4; + + /// \brief Name of y axis + string y = 5; + + /// \brief Name of z axis + string z = 6; + + /// Units + DataAngularUnits units = 7; + + /// Spherical Coodinate type + gz.msgs.SphericalCoordinatesType coordinate_type = 8; +} \ No newline at end of file diff --git a/proto/gz/msgs/spherical_coordinates.proto b/proto/gz/msgs/spherical_coordinates.proto index 9b485277..aa2135ca 100644 --- a/proto/gz/msgs/spherical_coordinates.proto +++ b/proto/gz/msgs/spherical_coordinates.proto @@ -27,6 +27,26 @@ option java_outer_classname = "SphericalCoordinatesProtos"; import "gz/msgs/entity.proto"; import "gz/msgs/header.proto"; +enum SphericalCoordinatesType +{ + /// \brief Latitude, Longitude and Altitude by SurfaceType + SPHERICAL = 0; + + /// \brief Earth centered, earth fixed Cartesian + ECEF = 1; + + /// \brief Local tangent plane (East, North, Up) + 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; +} + message SphericalCoordinates { /// \brief Planetary surface models. diff --git a/src/Utility.cc b/src/Utility.cc index dfc7995b..44b59d66 100644 --- a/src/Utility.cc +++ b/src/Utility.cc @@ -183,6 +183,25 @@ namespace gz return out; } + ///////////////////////////////////////////// + math::SphericalCoordinates::CoordinateType Convert( + const msgs::SphericalCoordinatesType &_sc) + { + switch (_sc) + { + case msgs::SphericalCoordinatesType::ECEF: + return math::SphericalCoordinates::CoordinateType::ECEF; + case msgs::SphericalCoordinatesType::GLOBAL: + return math::SphericalCoordinates::CoordinateType::GLOBAL; + case msgs::SphericalCoordinatesType::SPHERICAL: + return math::SphericalCoordinates::CoordinateType::SPHERICAL; + case msgs::SphericalCoordinatesType::LOCAL: + return math::SphericalCoordinates::CoordinateType::LOCAL; + case msgs::SphericalCoordinatesType::LOCAL2: + return math::SphericalCoordinates::CoordinateType::LOCAL2; + } + } + ///////////////////////////////////////////// math::AxisAlignedBox Convert(const msgs::AxisAlignedBox &_b) { @@ -349,6 +368,25 @@ namespace gz return result; } + ///////////////////////////////////////////// + msgs::SphericalCoordinatesType ConvertCoord( + const math::SphericalCoordinates::CoordinateType &_sc) + { + switch (_sc) + { + case math::SphericalCoordinates::CoordinateType::ECEF: + return msgs::SphericalCoordinatesType::ECEF; + case math::SphericalCoordinates::CoordinateType::GLOBAL: + return msgs::SphericalCoordinatesType::GLOBAL; + case math::SphericalCoordinates::CoordinateType::SPHERICAL: + return msgs::SphericalCoordinatesType::SPHERICAL; + case math::SphericalCoordinates::CoordinateType::LOCAL: + return msgs::SphericalCoordinatesType::LOCAL; + case math::SphericalCoordinates::CoordinateType::LOCAL2: + return msgs::SphericalCoordinatesType::LOCAL2; + } + } + ///////////////////////////////////////////// msgs::PlaneGeom Convert(const gz::math::Planed &_p) { diff --git a/src/Utility_TEST.cc b/src/Utility_TEST.cc index dac61e9e..82caa059 100644 --- a/src/Utility_TEST.cc +++ b/src/Utility_TEST.cc @@ -398,6 +398,29 @@ TEST(MsgsTest, ConvertMathSphericalCoordinatesToMsgs) EXPECT_DOUBLE_EQ(10000, mathCustom.SurfaceAxisPolar()); } +///////////////////////////////////////////////// +TEST(MsgsTest, ConvertMsgsSphericalCoordinatesTypeToMath) +{ + EXPECT_EQ(Convert(msgs::SphericalCoordinatesType::ECEF), + math::SphericalCoordinates::CoordinateType::ECEF); + EXPECT_EQ(Convert(msgs::SphericalCoordinatesType::GLOBAL), + math::SphericalCoordinates::CoordinateType::GLOBAL); + EXPECT_EQ(Convert(msgs::SphericalCoordinatesType::SPHERICAL), + math::SphericalCoordinates::CoordinateType::SPHERICAL); + EXPECT_EQ(Convert(msgs::SphericalCoordinatesType::LOCAL), + math::SphericalCoordinates::CoordinateType::LOCAL); + EXPECT_EQ(Convert(msgs::SphericalCoordinatesType::LOCAL2), + math::SphericalCoordinates::CoordinateType::LOCAL2); +} + +///////////////////////////////////////////////// +TEST(MsgsTest, ConvertMathSphericalCoordinatedTypeToMsg) +{ + EXPECT_EQ(msgs::ConvertCoord( + math::SphericalCoordinates::CoordinateType::ECEF), + msgs::SphericalCoordinatesType::ECEF); +} + ///////////////////////////////////////////////// TEST(UtilityTest, ConvertStringMsg) { From 56b157a13fee9d2d5b0d88a61592cedaadeacf7f Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Tue, 20 Dec 2022 22:23:39 +0800 Subject: [PATCH 02/11] style Signed-off-by: Arjo Chakravarty --- include/gz/msgs/Utility.hh | 2 +- proto/gz/msgs/data_load_options.proto | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/gz/msgs/Utility.hh b/include/gz/msgs/Utility.hh index 1d57c5ac..85de9aef 100644 --- a/include/gz/msgs/Utility.hh +++ b/include/gz/msgs/Utility.hh @@ -226,7 +226,7 @@ namespace gz /// \return A gz::math::SphericalCoordinatesType object GZ_MSGS_VISIBLE msgs::SphericalCoordinatesType ConvertCoord( - const math::SphericalCoordinates::CoordinateType &_sc); + const math::SphericalCoordinates::CoordinateType &_coord); /// \brief Convert a gz::math::Planed to a msgs::PlaneGeom /// \param[in] _p The plane to convert diff --git a/proto/gz/msgs/data_load_options.proto b/proto/gz/msgs/data_load_options.proto index f83c630f..7ab7cd3e 100644 --- a/proto/gz/msgs/data_load_options.proto +++ b/proto/gz/msgs/data_load_options.proto @@ -22,8 +22,6 @@ option java_outer_classname = "DataLoadPathOptions"; import "gz/msgs/spherical_coordinates.proto"; - - /// \brief Used for specifying how to load environmental data message DataLoadPathOptions { From 303df1023fd5de0dbe3a2e4c9675a86cf272a3ad Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Wed, 21 Dec 2022 07:42:35 +0800 Subject: [PATCH 03/11] Address PR feedback. Signed-off-by: Arjo Chakravarty --- include/gz/msgs/Utility.hh | 6 +++--- proto/gz/msgs/data_load_options.proto | 2 +- src/Utility.cc | 7 +++++++ src/Utility_TEST.cc | 12 ++++++++++++ 4 files changed, 23 insertions(+), 4 deletions(-) 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); } ///////////////////////////////////////////////// From 2475c08e62b823eed52b5909524b2ae4a741ae29 Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Thu, 5 Jan 2023 14:22:40 +0800 Subject: [PATCH 04/11] Style Signed-off-by: Arjo Chakravarty --- src/Utility.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utility.cc b/src/Utility.cc index 70554f20..073b86cc 100644 --- a/src/Utility.cc +++ b/src/Utility.cc @@ -200,7 +200,7 @@ namespace gz case msgs::SphericalCoordinatesType::LOCAL2: return math::SphericalCoordinates::CoordinateType::LOCAL2; default: - //default to local coords + // Default to local coords std::cerr << "Invalid coordinate type passed. Defaulting to local.\n"; return math::SphericalCoordinates::CoordinateType::LOCAL; } From 9b39a6d9cb6206bc6dacaef6ca508e00cd149171 Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Thu, 5 Jan 2023 15:14:40 +0800 Subject: [PATCH 05/11] coverage Signed-off-by: Arjo Chakravarty --- src/Utility.cc | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Utility.cc b/src/Utility.cc index 073b86cc..6675b10d 100644 --- a/src/Utility.cc +++ b/src/Utility.cc @@ -197,12 +197,8 @@ namespace gz return math::SphericalCoordinates::CoordinateType::SPHERICAL; case msgs::SphericalCoordinatesType::LOCAL: 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; + return math::SphericalCoordinates::CoordinateType::LOCAL2; } } @@ -386,11 +382,8 @@ namespace gz return msgs::SphericalCoordinatesType::SPHERICAL; case math::SphericalCoordinates::CoordinateType::LOCAL: 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; + return msgs::SphericalCoordinatesType::LOCAL2; } } From cc4ce08975af9230d1aa506f93945c992dc42e0f Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Wed, 25 Jan 2023 03:15:40 +0000 Subject: [PATCH 06/11] style Signed-off-by: Arjo Chakravarty --- proto/gz/msgs/data_load_options.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proto/gz/msgs/data_load_options.proto b/proto/gz/msgs/data_load_options.proto index 7a03a452..f679c623 100644 --- a/proto/gz/msgs/data_load_options.proto +++ b/proto/gz/msgs/data_load_options.proto @@ -38,7 +38,7 @@ message DataLoadPathOptions /// \brief Name of time axis string time = 2; - /// \brief Is the data static in time + /// \brief Is the data static in time bool static_time = 3; /// \brief Name of x axis @@ -55,4 +55,4 @@ message DataLoadPathOptions /// Spherical Coodinate type gz.msgs.SphericalCoordinatesType coordinate_type = 8; -} \ No newline at end of file +} From 4c6088615264d672f1ba634f4b7cf5b457aa799f Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Wed, 1 Mar 2023 09:18:37 +0000 Subject: [PATCH 07/11] Bump copyright Signed-off-by: Arjo Chakravarty --- proto/gz/msgs/data_load_options.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/gz/msgs/data_load_options.proto b/proto/gz/msgs/data_load_options.proto index f679c623..6216e79b 100644 --- a/proto/gz/msgs/data_load_options.proto +++ b/proto/gz/msgs/data_load_options.proto @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Open Source Robotics Foundation + * Copyright (C) 2023 Open Source Robotics Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 8c0e400c8517c2a79c9bc849e3ab07163c643603 Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Tue, 9 May 2023 06:46:10 +0000 Subject: [PATCH 08/11] Address PR feedback Signed-off-by: Arjo Chakravarty --- include/gz/msgs/Utility.hh | 2 +- src/Utility.cc | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/gz/msgs/Utility.hh b/include/gz/msgs/Utility.hh index cdc1d030..fd8ebc32 100644 --- a/include/gz/msgs/Utility.hh +++ b/include/gz/msgs/Utility.hh @@ -222,7 +222,7 @@ namespace gz /// \brief Convert a gz::math::SphericalCoordinates::CoordinateType /// to a msgs::SphericalCoordinatesType - /// \param[in] _coord The spherical coordinates to convert + /// \param[in] _coord The spherical coordinates type to convert /// \return A gz::msgs::SphericalCoordinatesType object GZ_MSGS_VISIBLE msgs::SphericalCoordinatesType ConvertCoord( diff --git a/src/Utility.cc b/src/Utility.cc index 6675b10d..eb3a3e66 100644 --- a/src/Utility.cc +++ b/src/Utility.cc @@ -197,9 +197,11 @@ namespace gz return math::SphericalCoordinates::CoordinateType::SPHERICAL; case msgs::SphericalCoordinatesType::LOCAL: return math::SphericalCoordinates::CoordinateType::LOCAL; - default: + case msgs::SphericalCoordinatesType::LOCAL2: return math::SphericalCoordinates::CoordinateType::LOCAL2; } + std::cerr << "Invalid coordinate type passed" << std::endl; + return math::SphericalCoordinates::CoordinateType::LOCAL2; } ///////////////////////////////////////////// @@ -385,6 +387,7 @@ namespace gz default: return msgs::SphericalCoordinatesType::LOCAL2; } + std::cerr << "Invalid coordinate type passed" << std::endl; } ///////////////////////////////////////////// From c1766cf65a2a8184c99773e7e2b82d5eb0d7bf23 Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Wed, 10 May 2023 01:53:25 +0000 Subject: [PATCH 09/11] Coverage Signed-off-by: Arjo Chakravarty --- src/Utility_TEST.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Utility_TEST.cc b/src/Utility_TEST.cc index 71b3f2e7..a822df28 100644 --- a/src/Utility_TEST.cc +++ b/src/Utility_TEST.cc @@ -411,6 +411,8 @@ TEST(MsgsTest, ConvertMsgsSphericalCoordinatesTypeToMath) math::SphericalCoordinates::CoordinateType::LOCAL); EXPECT_EQ(Convert(msgs::SphericalCoordinatesType::LOCAL2), math::SphericalCoordinates::CoordinateType::LOCAL2); + EXPECT_EQ(Convert((msgs::SphericalCoordinatesType)500000), + math::SphericalCoordinates::CoordinateType::LOCAL2); } ///////////////////////////////////////////////// @@ -431,6 +433,9 @@ TEST(MsgsTest, ConvertMathSphericalCoordinatedTypeToMsg) EXPECT_EQ(msgs::ConvertCoord( math::SphericalCoordinates::CoordinateType::LOCAL2), msgs::SphericalCoordinatesType::LOCAL2); + EXPECT_EQ(msgs::ConvertCoord( + (math::SphericalCoordinates::CoordinateType)500000), + msgs::SphericalCoordinatesType::LOCAL2); } ///////////////////////////////////////////////// From 101a7238be21e0fdaeb361d34384d58b1099ae1b Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Wed, 10 May 2023 02:04:57 +0000 Subject: [PATCH 10/11] Get rid of compiler Signed-off-by: Arjo Chakravarty --- src/Utility.cc | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/Utility.cc b/src/Utility.cc index eb3a3e66..109dc1da 100644 --- a/src/Utility.cc +++ b/src/Utility.cc @@ -199,8 +199,9 @@ namespace gz return math::SphericalCoordinates::CoordinateType::LOCAL; case msgs::SphericalCoordinatesType::LOCAL2: return math::SphericalCoordinates::CoordinateType::LOCAL2; - } - std::cerr << "Invalid coordinate type passed" << std::endl; + default: + std::cerr << "Invalid coordinate type passed" << std::endl; + } return math::SphericalCoordinates::CoordinateType::LOCAL2; } @@ -374,20 +375,28 @@ namespace gz msgs::SphericalCoordinatesType ConvertCoord( const math::SphericalCoordinates::CoordinateType &_sc) { + auto result = msgs::SphericalCoordinatesType::LOCAL2; switch (_sc) { case math::SphericalCoordinates::CoordinateType::ECEF: - return msgs::SphericalCoordinatesType::ECEF; + result = msgs::SphericalCoordinatesType::ECEF; + break; case math::SphericalCoordinates::CoordinateType::GLOBAL: - return msgs::SphericalCoordinatesType::GLOBAL; + result = msgs::SphericalCoordinatesType::GLOBAL; + break; case math::SphericalCoordinates::CoordinateType::SPHERICAL: - return msgs::SphericalCoordinatesType::SPHERICAL; + result = msgs::SphericalCoordinatesType::SPHERICAL; + break; case math::SphericalCoordinates::CoordinateType::LOCAL: - return msgs::SphericalCoordinatesType::LOCAL; + result = msgs::SphericalCoordinatesType::LOCAL; + break; + case math::SphericalCoordinates::CoordinateType::LOCAL2: + result = msgs::SphericalCoordinatesType::LOCAL2; + break; default: - return msgs::SphericalCoordinatesType::LOCAL2; + std::cerr << "Invalid coordinate type passed" << std::endl; } - std::cerr << "Invalid coordinate type passed" << std::endl; + return result; } ///////////////////////////////////////////// From bc90bd5b65fdf56fea38238199e59f163721b2d5 Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Wed, 10 May 2023 02:13:48 +0000 Subject: [PATCH 11/11] Style Signed-off-by: Arjo Chakravarty --- src/Utility.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utility.cc b/src/Utility.cc index 109dc1da..f9aae03a 100644 --- a/src/Utility.cc +++ b/src/Utility.cc @@ -201,7 +201,7 @@ namespace gz return math::SphericalCoordinates::CoordinateType::LOCAL2; default: std::cerr << "Invalid coordinate type passed" << std::endl; - } + } return math::SphericalCoordinates::CoordinateType::LOCAL2; }