Skip to content

Commit c632d2f

Browse files
committed
[tests] MultiRobotTest is no longer inheriting from EmptyBulletWorldTest
This change was made, as multiple robots are added into the world structure for MultiRobotTests and would otherwise break other tests
1 parent ab5439f commit c632d2f

1 file changed

Lines changed: 29 additions & 3 deletions

File tree

‎test/test_multirobot/test_robot_manager.py‎

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
1+
import os
2+
import time
3+
import unittest
4+
15
from pycram.datastructures.enums import WorldMode
26
from pycram.datastructures.pose import PoseStamped
7+
from pycram.datastructures.world import UseProspectionWorld
38
from pycram.multirobot import RobotManager
49
from pycram.object_descriptors.urdf import ObjectDescription
10+
from pycram.plan import Plan
511
from pycram.robot_description import RobotDescription
6-
from pycram.testing import EmptyBulletWorldTestCase
12+
from pycram.ros_utils.viz_marker_publisher import VizMarkerPublisher
713
from pycram.world_concepts.world_object import Object
814
from pycram.worlds.bullet_world import BulletWorld
915
from pycrap.ontologies import Robot, Milk, Cereal
1016

1117

12-
class MultiRobotTestCase(EmptyBulletWorldTestCase):
18+
class MultiRobotTestCase(unittest.TestCase):
1319
world: BulletWorld
1420
extension: str = ObjectDescription.get_file_extension()
1521

1622
@classmethod
1723
def setUpClass(cls):
18-
super().setUpClass()
1924
cls.world = BulletWorld(mode=WorldMode.DIRECT)
2025

26+
if "ROS_VERSION" in os.environ:
27+
cls.viz_marker_publisher = VizMarkerPublisher()
28+
2129
cls.robot_pr2 = Object("pr2", Robot,
2230
'pr2' + cls.extension,
2331
pose=PoseStamped.from_list([0, 1, 0]))
@@ -45,6 +53,24 @@ def check_current_robot(self, name):
4553
self.check_robot(name="tiago_dual", base_link="base_link", torso_link="torso_lift_link",
4654
torso_joint="torso_lift_joint", number_of_links=69, number_of_joints=68)
4755

56+
def setUp(self):
57+
self.world.reset_world(remove_saved_states=True)
58+
Plan.current_plan = None
59+
with UseProspectionWorld():
60+
pass
61+
62+
63+
def tearDown(self):
64+
time.sleep(0.05)
65+
self.world.reset_world(remove_saved_states=True)
66+
with UseProspectionWorld():
67+
pass
68+
69+
@classmethod
70+
def tearDownClass(cls):
71+
if "ROS_VERSION" in os.environ:
72+
cls.viz_marker_publisher._stop_publishing()
73+
cls.world.exit()
4874

4975
class TestMultiRobot(MultiRobotTestCase):
5076

0 commit comments

Comments
 (0)