@@ -282,11 +282,9 @@ void ThermalCameraSensorTest::ImagesWithBuiltinSDF(
282282 EXPECT_EQ (9 , infoMsg.rectification_matrix ().size ());
283283
284284 // Check that for a box really close it returns box temperature
285- root->RemoveChild (box);
286285 gz::math::Vector3d boxPositionNear (
287286 unitBoxSize * 0.5 + near_ * 0.5 , 0.0 , 0.0 );
288287 box->SetLocalPosition (boxPositionNear);
289- root->AddChild (box);
290288
291289 mgr.RunOnce (std::chrono::steady_clock::duration::zero (), true );
292290 for (int sleep = 0 ;
@@ -316,11 +314,9 @@ void ThermalCameraSensorTest::ImagesWithBuiltinSDF(
316314 g_mutex.unlock ();
317315
318316 // Check that for a box really far it returns ambient temperature
319- root->RemoveChild (box);
320317 gz::math::Vector3d boxPositionFar (
321318 unitBoxSize * 0.5 + far_ * 1.5 , 0.0 , 0.0 );
322319 box->SetLocalPosition (boxPositionFar);
323- root->AddChild (box);
324320
325321 mgr.RunOnce (std::chrono::steady_clock::duration::zero (), true );
326322 for (int sleep = 0 ;
@@ -352,7 +348,11 @@ void ThermalCameraSensorTest::ImagesWithBuiltinSDF(
352348 delete [] g_thermalBuffer;
353349 g_thermalBuffer = nullptr ;
354350
351+ // Clean up rendering ptrs
352+ box.reset ();
353+
355354 // Clean up
355+ mgr.Remove (thermalSensor->Id ());
356356 engine->DestroyScene (scene);
357357 gz::rendering::unloadEngine (engine->Name ());
358358}
@@ -543,11 +543,9 @@ void ThermalCameraSensorTest::Images8BitWithBuiltinSDF(
543543 EXPECT_EQ (9 , infoMsg.rectification_matrix ().size ());
544544
545545 // Check that for a box really close it returns box temperature
546- root->RemoveChild (box);
547546 gz::math::Vector3d boxPositionNear (
548547 unitBoxSize * 0.5 + near_ * 0.5 , 0.0 , 0.0 );
549548 box->SetLocalPosition (boxPositionNear);
550- root->AddChild (box);
551549
552550 mgr.RunOnce (std::chrono::steady_clock::duration::zero (), true );
553551 for (int sleep = 0 ;
@@ -578,11 +576,9 @@ void ThermalCameraSensorTest::Images8BitWithBuiltinSDF(
578576 g_mutex.unlock ();
579577
580578 // Check that for a box really far it returns ambient temperature
581- root->RemoveChild (box);
582579 ignition::math::Vector3d boxPositionFar (
583580 unitBoxSize * 0.5 + far_ * 1.5 , 0.0 , 0.0 );
584581 box->SetLocalPosition (boxPositionFar);
585- root->AddChild (box);
586582
587583 mgr.RunOnce (std::chrono::steady_clock::duration::zero (), true );
588584 for (int sleep = 0 ;
@@ -614,7 +610,11 @@ void ThermalCameraSensorTest::Images8BitWithBuiltinSDF(
614610 delete [] g_thermalBuffer8Bit;
615611 g_thermalBuffer8Bit = nullptr ;
616612
613+ // Clean up rendering ptrs
614+ box.reset ();
615+
617616 // Clean up
617+ mgr.Remove (thermalSensor->Id ());
618618 engine->DestroyScene (scene);
619619 gz::rendering::unloadEngine (engine->Name ());
620620}
0 commit comments