@@ -870,7 +870,7 @@ msgs::Atmosphere gz::sim::convert(const sdf::Atmosphere &_in)
870
870
out.set_type (msgs::Atmosphere::ADIABATIC);
871
871
}
872
872
// todo(anyone) add mass density to sdf::Atmosphere?
873
- // out.set_mass_density(_in.MassDensity());k
873
+ // out.set_mass_density(_in.MassDensity());
874
874
875
875
return out;
876
876
}
@@ -1703,15 +1703,7 @@ msgs::ParticleEmitter gz::sim::convert(const sdf::ParticleEmitter &_in)
1703
1703
}
1704
1704
}
1705
1705
1706
- // / \todo(nkoenig) Modify the particle_emitter.proto file to
1707
- // / have a topic field.
1708
- if (!_in.Topic ().empty ())
1709
- {
1710
- auto header = out.mutable_header ()->add_data ();
1711
- header->set_key (" topic" );
1712
- header->add_value (_in.Topic ());
1713
- }
1714
-
1706
+ out.mutable_topic ()->set_data (_in.Topic ());
1715
1707
out.mutable_particle_scatter_ratio ()->set_data (_in.ScatterRatio ());
1716
1708
return out;
1717
1709
}
@@ -1766,15 +1758,8 @@ sdf::ParticleEmitter gz::sim::convert(const msgs::ParticleEmitter &_in)
1766
1758
out.SetColorRangeImage (_in.color_range_image ().data ());
1767
1759
if (_in.has_particle_scatter_ratio ())
1768
1760
out.SetScatterRatio (_in.particle_scatter_ratio ().data ());
1769
-
1770
- for (int i = 0 ; i < _in.header ().data_size (); ++i)
1771
- {
1772
- auto data = _in.header ().data (i);
1773
- if (data.key () == " topic" && data.value_size () > 0 )
1774
- {
1775
- out.SetTopic (data.value (0 ));
1776
- }
1777
- }
1761
+ if (_in.has_topic ())
1762
+ out.SetTopic (_in.topic ().data ());
1778
1763
1779
1764
return out;
1780
1765
}
@@ -1792,10 +1777,7 @@ msgs::Projector gz::sim::convert(const sdf::Projector &_in)
1792
1777
out.set_fov (_in.HorizontalFov ().Radian ());
1793
1778
out.set_texture (_in.Texture ().empty () ? " " :
1794
1779
asFullPath (_in.Texture (), _in.FilePath ()));
1795
-
1796
- auto header = out.mutable_header ()->add_data ();
1797
- header->set_key (" visibility_flags" );
1798
- header->add_value (std::to_string (_in.VisibilityFlags ()));
1780
+ out.set_visibility_flags (_in.VisibilityFlags ());
1799
1781
1800
1782
return out;
1801
1783
}
@@ -1812,26 +1794,7 @@ sdf::Projector gz::sim::convert(const msgs::Projector &_in)
1812
1794
out.SetHorizontalFov (math::Angle (_in.fov ()));
1813
1795
out.SetTexture (_in.texture ());
1814
1796
out.SetRawPose (msgs::Convert (_in.pose ()));
1815
-
1816
- // / \todo(anyone) add "visibility_flags" field to projector.proto
1817
- for (int i = 0 ; i < _in.header ().data_size (); ++i)
1818
- {
1819
- auto data = _in.header ().data (i);
1820
- if (data.key () == " visibility_flags" && data.value_size () > 0 )
1821
- {
1822
- try
1823
- {
1824
- out.SetVisibilityFlags (std::stoul (data.value (0 )));
1825
- }
1826
- catch (...)
1827
- {
1828
- gzerr << " Failed to parse projector <visibility_flags>: "
1829
- << data.value (0 ) << " . Using default value: 0xFFFFFFFF."
1830
- << std::endl;
1831
- out.SetVisibilityFlags (0xFFFFFFFF );
1832
- }
1833
- }
1834
- }
1797
+ out.SetVisibilityFlags (_in.visibility_flags ());
1835
1798
1836
1799
return out;
1837
1800
}
0 commit comments