Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport]: Fix ModelPhotoShootTest test failures (#2294) #2339

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/worlds/model_photo_shoot.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
filename="ignition-gazebo-sensors-system"
name="ignition::gazebo::systems::Sensors">
<render_engine>ogre2</render_engine>
<background_color>1, 1, 1</background_color>
<background_color>1.0 1.0 1.0</background_color>
</plugin>
<include>
<uri>https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/Robonaut</uri>
Expand Down
12 changes: 8 additions & 4 deletions test/integration/ModelPhotoShootTest.hh
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ class ModelPhotoShootTest : public InternalFixture<::testing::Test>
// First run of the server generating images through the plugin.
TestFixture fixture(common::joinPaths(std::string(PROJECT_SOURCE_PATH),
_sdfWorld));
fixture.Server()->SetUpdatePeriod(1ns);

common::ConnectionPtr postRenderConn;
fixture.OnConfigure([&](
Expand All @@ -242,7 +241,12 @@ class ModelPhotoShootTest : public InternalFixture<::testing::Test>
std::bind(&ModelPhotoShootTest::OnPostRender, this));
}).Finalize();

fixture.Server()->Run(true, 50, false);
fixture.Server()->SetUpdatePeriod(1ns);

for (int i = 0; i < 50; ++i)
{
fixture.Server()->RunOnce(true);
}
this->LoadPoseValues();

fixture.OnPreUpdate([&](const gazebo::UpdateInfo &,
Expand Down Expand Up @@ -284,15 +288,15 @@ class ModelPhotoShootTest : public InternalFixture<::testing::Test>
}
this->checkRandomJoints = false;
}
}).Finalize();
});

this->takeTestPics = true;

const auto end_time = std::chrono::steady_clock::now() +
std::chrono::milliseconds(3000);
while (takeTestPics && end_time > std::chrono::steady_clock::now())
{
fixture.Server()->Run(true, 1, false);
fixture.Server()->RunOnce(true);
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
testImages("1.png", "1_test.png");
Expand Down
2 changes: 1 addition & 1 deletion test/worlds/model_photo_shoot_random_joints.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
filename="ignition-gazebo-sensors-system"
name="ignition::gazebo::systems::Sensors">
<render_engine>ogre2</render_engine>
<background_color>1, 1, 1</background_color>
<background_color>1.0 1.0 1.0</background_color>
</plugin>
<include>
<uri>https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/Robonaut</uri>
Expand Down