Skip to content

Commit

Permalink
Using MCEntityMatch.
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
  • Loading branch information
bperseghetti committed Feb 1, 2024
1 parent 0d1108d commit 7c6b72d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 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,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
{

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

0 comments on commit 7c6b72d

Please sign in to comment.