Skip to content

Commit a53c290

Browse files
committed
remove more code, fix test
Signed-off-by: Ian Chen <ichen@openrobotics.org>
1 parent a9d0bac commit a53c290

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

include/gz/sim/components/Model.hh

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace serializers
4141
/// \param[in] _time Model to stream
4242
/// \return The stream.
4343
public: static std::ostream &Serialize(std::ostream &_out,
44-
const sdf::Model &_model)
44+
const sdf::Model &)
4545
{
4646
// Skip serialization of model sdf
4747
// \todo(iche033) It was found that deserialization is
@@ -60,25 +60,11 @@ namespace serializers
6060
/// \param[out] _model Model to populate
6161
/// \return The stream.
6262
public: static std::istream &Deserialize(std::istream &_in,
63-
sdf::Model &_model)
63+
sdf::Model &)
6464
{
65-
std::string sdf(std::istreambuf_iterator<char>(_in), {});
66-
if (sdf.empty())
67-
{
68-
return _in;
69-
}
70-
71-
// Its super expensive to create an SDFElement for some reason
65+
// Its super expensive to create an SDFElement for some reason.
66+
// So seriazliation / deserialization of model sdf is skipped
7267
// https://github.com/gazebosim/sdformat/issues/1478
73-
sdf::Root root;
74-
sdf::Errors errors = root.LoadSdfString(sdf);
75-
if (!root.Model())
76-
{
77-
gzwarn << "Unable to deserialize sdf::Model " << sdf<< std::endl;
78-
return _in;
79-
}
80-
81-
_model = *root.Model();
8268
return _in;
8369
}
8470
};

test/integration/components.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,8 +1276,10 @@ TEST_F(ComponentsTest, ModelSdf)
12761276
std::istringstream istr(ostr.str());
12771277
comp2.Deserialize(istr);
12781278

1279-
EXPECT_EQ("my_model", comp2.Data().Name());
1280-
EXPECT_EQ(1u, comp2.Data().LinkCount());
1279+
// Model sdf serialization / deserialization is disabled due to perf issue
1280+
// https://github.com/gazebosim/sdformat/issues/1478
1281+
// EXPECT_EQ("my_model", comp2.Data().Name());
1282+
// EXPECT_EQ(1u, comp2.Data().LinkCount());
12811283
}
12821284

12831285
/////////////////////////////////////////////////

0 commit comments

Comments
 (0)