From e27a19c352ca4f895699798e63ab336ff7c3b8b7 Mon Sep 17 00:00:00 2001 From: Benjamin Perseghetti Date: Wed, 31 Jan 2024 20:11:44 -0500 Subject: [PATCH] Using MCEntityMatch. Signed-off-by: Benjamin Perseghetti --- ros_gz_bridge/src/convert/ros_gz_interfaces.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ros_gz_bridge/src/convert/ros_gz_interfaces.cpp b/ros_gz_bridge/src/convert/ros_gz_interfaces.cpp index c4d06e49..428a400c 100644 --- a/ros_gz_bridge/src/convert/ros_gz_interfaces.cpp +++ b/ros_gz_bridge/src/convert/ros_gz_interfaces.cpp @@ -14,6 +14,10 @@ #include "ros_gz_bridge/convert/ros_gz_interfaces.hpp" +#if HAVE_MATERIALCOLOR +using MCEntityMatch = gz::msgs::MaterialColor::EntityMatch; +#endif // HAVE_MATERIALCOLOR + namespace ros_gz_bridge { @@ -389,12 +393,10 @@ convert_ros_to_gz( { switch (ros_msg.entity_match) { case ros_gz_interfaces::msg::MaterialColor::FIRST: - gz_msg.set_entity_match( - gz::msgs::MaterialColor::EntityMatch::MaterialColor_EntityMatch_FIRST); + gz_msg.set_entity_match(MCEntityMatch::MaterialColor_EntityMatch_FIRST); break; case ros_gz_interfaces::msg::MaterialColor::ALL: - gz_msg.set_entity_match( - gz::msgs::MaterialColor::EntityMatch::MaterialColor_EntityMatch_ALL); + gz_msg.set_entity_match(MCEntityMatch::MaterialColor_EntityMatch_ALL); break; default: std::cerr << "Unsupported entity match type [" @@ -417,9 +419,9 @@ convert_gz_to_ros( const gz::msgs::MaterialColor & gz_msg, ros_gz_interfaces::msg::MaterialColor & ros_msg) { - if (gz_msg.entity_match() == gz::msgs::MaterialColor::EntityMatch::MaterialColor_EntityMatch_FIRST) { + if (gz_msg.entity_match() == MCEntityMatch::MaterialColor_EntityMatch_FIRST) { ros_msg.entity_match = ros_gz_interfaces::msg::MaterialColor::FIRST; - } else if (gz_msg.entity_match() == gz::msgs::MaterialColor::EntityMatch::MaterialColor_EntityMatch_ALL) { + } else if (gz_msg.entity_match() == MCEntityMatch::MaterialColor_EntityMatch_ALL) { ros_msg.entity_match = ros_gz_interfaces::msg::MaterialColor::ALL; } else { std::cerr << "Unsupported EntityMatch [" <<