Skip to content

Commit

Permalink
Merge pull request #1 from azeey/suggestions_486
Browse files Browse the repository at this point in the history
Suggestions for gazebosim#486
  • Loading branch information
bperseghetti authored Feb 1, 2024
2 parents e27a19c + 1b8722c commit c23d136
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions ros_gz_bridge/src/convert/ros_gz_interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@

#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 @@ -391,12 +387,14 @@ convert_ros_to_gz(
const ros_gz_interfaces::msg::MaterialColor & ros_msg,
gz::msgs::MaterialColor & gz_msg)
{
using EntityMatch = gz::msgs::MaterialColor::EntityMatch;

switch (ros_msg.entity_match) {
case ros_gz_interfaces::msg::MaterialColor::FIRST:
gz_msg.set_entity_match(MCEntityMatch::MaterialColor_EntityMatch_FIRST);
gz_msg.set_entity_match(EntityMatch::MaterialColor_EntityMatch_FIRST);
break;
case ros_gz_interfaces::msg::MaterialColor::ALL:
gz_msg.set_entity_match(MCEntityMatch::MaterialColor_EntityMatch_ALL);
gz_msg.set_entity_match(EntityMatch::MaterialColor_EntityMatch_ALL);
break;
default:
std::cerr << "Unsupported entity match type ["
Expand All @@ -419,9 +417,11 @@ convert_gz_to_ros(
const gz::msgs::MaterialColor & gz_msg,
ros_gz_interfaces::msg::MaterialColor & ros_msg)
{
if (gz_msg.entity_match() == MCEntityMatch::MaterialColor_EntityMatch_FIRST) {
using EntityMatch = gz::msgs::MaterialColor::EntityMatch;
if (gz_msg.entity_match() == EntityMatch::MaterialColor_EntityMatch_FIRST) {
ros_msg.entity_match = ros_gz_interfaces::msg::MaterialColor::FIRST;
} else if (gz_msg.entity_match() == MCEntityMatch::MaterialColor_EntityMatch_ALL) {
} else if (gz_msg.entity_match() ==
EntityMatch::MaterialColor_EntityMatch_ALL) {
ros_msg.entity_match = ros_gz_interfaces::msg::MaterialColor::ALL;
} else {
std::cerr << "Unsupported EntityMatch [" <<
Expand Down

0 comments on commit c23d136

Please sign in to comment.