diff --git a/ros_gz_bridge/src/convert/ros_gz_interfaces.cpp b/ros_gz_bridge/src/convert/ros_gz_interfaces.cpp index c4d06e49c..478e773ce 100644 --- a/ros_gz_bridge/src/convert/ros_gz_interfaces.cpp +++ b/ros_gz_bridge/src/convert/ros_gz_interfaces.cpp @@ -14,6 +14,9 @@ #include "ros_gz_bridge/convert/ros_gz_interfaces.hpp" +using MCEntityMatchFirst = gz::msgs::MaterialColor::EntityMatch::MaterialColor_EntityMatch_FIRST; +using MCEntityMatchAll = gz::msgs::MaterialColor::EntityMatch::MaterialColor_EntityMatch_ALL; + namespace ros_gz_bridge { @@ -389,12 +392,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(MCEntityMatchFirst); 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(MCEntityMatchAll); break; default: std::cerr << "Unsupported entity match type [" @@ -417,9 +418,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() == MCEntityMatchFirst) { 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() == MCEntityMatchAll) { ros_msg.entity_match = ros_gz_interfaces::msg::MaterialColor::ALL; } else { std::cerr << "Unsupported EntityMatch [" <<