|
| 1 | +import os |
| 2 | +import time |
| 3 | +import unittest |
| 4 | + |
1 | 5 | from pycram.datastructures.enums import WorldMode |
2 | 6 | from pycram.datastructures.pose import PoseStamped |
| 7 | +from pycram.datastructures.world import UseProspectionWorld |
3 | 8 | from pycram.multirobot import RobotManager |
4 | 9 | from pycram.object_descriptors.urdf import ObjectDescription |
| 10 | +from pycram.plan import Plan |
5 | 11 | from pycram.robot_description import RobotDescription |
6 | | -from pycram.testing import EmptyBulletWorldTestCase |
| 12 | +from pycram.ros_utils.viz_marker_publisher import VizMarkerPublisher |
7 | 13 | from pycram.world_concepts.world_object import Object |
8 | 14 | from pycram.worlds.bullet_world import BulletWorld |
9 | 15 | from pycrap.ontologies import Robot, Milk, Cereal |
10 | 16 |
|
11 | 17 |
|
12 | | -class MultiRobotTestCase(EmptyBulletWorldTestCase): |
| 18 | +class MultiRobotTestCase(unittest.TestCase): |
13 | 19 | world: BulletWorld |
14 | 20 | extension: str = ObjectDescription.get_file_extension() |
15 | 21 |
|
16 | 22 | @classmethod |
17 | 23 | def setUpClass(cls): |
18 | | - super().setUpClass() |
19 | 24 | cls.world = BulletWorld(mode=WorldMode.DIRECT) |
20 | 25 |
|
| 26 | + if "ROS_VERSION" in os.environ: |
| 27 | + cls.viz_marker_publisher = VizMarkerPublisher() |
| 28 | + |
21 | 29 | cls.robot_pr2 = Object("pr2", Robot, |
22 | 30 | 'pr2' + cls.extension, |
23 | 31 | pose=PoseStamped.from_list([0, 1, 0])) |
@@ -45,6 +53,24 @@ def check_current_robot(self, name): |
45 | 53 | self.check_robot(name="tiago_dual", base_link="base_link", torso_link="torso_lift_link", |
46 | 54 | torso_joint="torso_lift_joint", number_of_links=69, number_of_joints=68) |
47 | 55 |
|
| 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() |
48 | 74 |
|
49 | 75 | class TestMultiRobot(MultiRobotTestCase): |
50 | 76 |
|
|
0 commit comments