@@ -380,6 +380,66 @@ convert_gz_to_ros(
380
380
ros_msg.intensity = gz_msg.intensity ();
381
381
}
382
382
383
+ #if HAVE_MATERIALCOLOR
384
+ template <>
385
+ void
386
+ convert_ros_to_gz (
387
+ const ros_gz_interfaces::msg::MaterialColor & ros_msg,
388
+ gz::msgs::MaterialColor & gz_msg)
389
+ {
390
+ using EntityMatch = gz::msgs::MaterialColor::EntityMatch;
391
+
392
+ switch (ros_msg.entity_match ) {
393
+ case ros_gz_interfaces::msg::MaterialColor::FIRST:
394
+ gz_msg.set_entity_match (EntityMatch::MaterialColor_EntityMatch_FIRST);
395
+ break ;
396
+ case ros_gz_interfaces::msg::MaterialColor::ALL:
397
+ gz_msg.set_entity_match (EntityMatch::MaterialColor_EntityMatch_ALL);
398
+ break ;
399
+ default :
400
+ std::cerr << " Unsupported entity match type ["
401
+ << ros_msg.entity_match << " ]\n " ;
402
+ }
403
+
404
+ convert_ros_to_gz (ros_msg.header , (*gz_msg.mutable_header ()));
405
+ convert_ros_to_gz (ros_msg.entity , *gz_msg.mutable_entity ());
406
+ convert_ros_to_gz (ros_msg.ambient , *gz_msg.mutable_ambient ());
407
+ convert_ros_to_gz (ros_msg.diffuse , *gz_msg.mutable_diffuse ());
408
+ convert_ros_to_gz (ros_msg.specular , *gz_msg.mutable_specular ());
409
+ convert_ros_to_gz (ros_msg.emissive , *gz_msg.mutable_emissive ());
410
+
411
+ gz_msg.set_shininess (ros_msg.shininess );
412
+ }
413
+
414
+ template <>
415
+ void
416
+ convert_gz_to_ros (
417
+ const gz::msgs::MaterialColor & gz_msg,
418
+ ros_gz_interfaces::msg::MaterialColor & ros_msg)
419
+ {
420
+ using EntityMatch = gz::msgs::MaterialColor::EntityMatch;
421
+ if (gz_msg.entity_match () == EntityMatch::MaterialColor_EntityMatch_FIRST) {
422
+ ros_msg.entity_match = ros_gz_interfaces::msg::MaterialColor::FIRST;
423
+ /* *INDENT-OFF* */
424
+ } else if (gz_msg.entity_match () ==
425
+ EntityMatch::MaterialColor_EntityMatch_ALL) {
426
+ /* *INDENT-ON* */
427
+ ros_msg.entity_match = ros_gz_interfaces::msg::MaterialColor::ALL;
428
+ } else {
429
+ std::cerr << " Unsupported EntityMatch [" <<
430
+ gz_msg.entity_match () << " ]" << std::endl;
431
+ }
432
+ convert_gz_to_ros (gz_msg.header (), ros_msg.header );
433
+ convert_gz_to_ros (gz_msg.entity (), ros_msg.entity );
434
+ convert_gz_to_ros (gz_msg.ambient (), ros_msg.ambient );
435
+ convert_gz_to_ros (gz_msg.diffuse (), ros_msg.diffuse );
436
+ convert_gz_to_ros (gz_msg.specular (), ros_msg.specular );
437
+ convert_gz_to_ros (gz_msg.emissive (), ros_msg.emissive );
438
+
439
+ ros_msg.shininess = gz_msg.shininess ();
440
+ }
441
+ #endif // HAVE_MATERIALCOLOR
442
+
383
443
template <>
384
444
void
385
445
convert_ros_to_gz (
0 commit comments