Skip to content

Commit

Permalink
Using MCEntityMatch.
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Perseghetti <[email protected]>
  • Loading branch information
bperseghetti committed Feb 1, 2024
1 parent 0d1108d commit e27a19c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ros_gz_bridge/src/convert/ros_gz_interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{

Expand Down Expand Up @@ -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 ["
Expand All @@ -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 [" <<
Expand Down

0 comments on commit e27a19c

Please sign in to comment.