Exemple #1
0
    def test_camera_removal(self):
        """
        Ensure that the camera processes are stopped when removing a robot,
        stopping or resetting a simulation
        """
        manager = SimulationManager()
        client = manager.launchSimulation(gui=False)

        pepper = manager.spawnPepper(client, spawn_ground_plane=True)
        handle = pepper.subscribeCamera(PepperVirtual.ID_CAMERA_TOP)
        camera = pepper.getCamera(handle)

        self.assertTrue(camera.isActive())
        manager.removePepper(pepper)
        self.assertFalse(camera.isActive())

        pepper = manager.spawnPepper(client, spawn_ground_plane=True)
        handle = pepper.subscribeCamera(PepperVirtual.ID_CAMERA_TOP)
        camera = pepper.getCamera(handle)

        self.assertTrue(camera.isActive())
        manager.resetSimulation(client)
        self.assertFalse(camera.isActive())

        pepper = manager.spawnPepper(client, spawn_ground_plane=True)
        handle = pepper.subscribeCamera(PepperVirtual.ID_CAMERA_TOP)
        camera = pepper.getCamera(handle)

        self.assertTrue(camera.isActive())
        manager.stopSimulation(client)
        self.assertFalse(camera.isActive())
Exemple #2
0
 def test_reset_simulation(self):
     """
     Test the @resetSimulation method
     """
     manager = SimulationManager()
     client = manager.launchSimulation(gui=False)
     manager.resetSimulation(client)
     manager.stopSimulation(client)
Exemple #3
0
        PepperBaseTest,
        PepperJointTest,
        PepperLaserTest,
        PepperCameraTest,
        PepperPostureTest,
        PepperSelfCollisionTest]

    physics_client = simulation_manager.launchSimulation(gui=False)

    for test_class in test_classes:
        pybullet.setAdditionalSearchPath(pybullet_data.getDataPath())
        pybullet.loadMJCF("mjcf/ground_plane.xml")
        test_results.append(
            test_runner.run(test_loader.loadTestsFromTestCase(test_class)))

        simulation_manager.resetSimulation(physics_client)

    simulation_manager.stopSimulation(physics_client)

    print("------------------------------------------------------------------")
    for i in range(len(test_results)):
        test_count = test_results[i].testsRun
        test_failures = test_results[i].failures
        test_errors = test_results[i].errors
        test_passed = test_count - len(test_failures)

        if len(test_failures) != 0:
            has_failed = True

        print(test_classes[i].__name__ + "[" + str(test_count) + " tests]:")
        print(str(test_passed) + " [\033[1m\033[92mpassed\033[0m]")