forked from cram2/pycram
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tests] split bullet world tetsts into testCase and unittests
- Loading branch information
Showing
11 changed files
with
76 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import unittest | ||
|
||
import numpy as np | ||
import rospkg | ||
|
||
from pycram.bullet_world import BulletWorld, Object, fix_missing_inertial | ||
from pycram.pose import Pose | ||
from pycram.robot_descriptions import robot_description | ||
from pycram.process_module import ProcessModule | ||
from pycram.enums import ObjectType | ||
import os | ||
import xml.etree.ElementTree as ET | ||
import tf | ||
|
||
|
||
class BulletWorldTestCase(unittest.TestCase): | ||
|
||
world: BulletWorld | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
cls.world = BulletWorld("DIRECT") | ||
cls.robot = Object(robot_description.name, ObjectType.ROBOT, robot_description.name + ".urdf") | ||
cls.kitchen = Object("kitchen", ObjectType.ENVIRONMENT, "kitchen.urdf") | ||
cls.milk = Object("milk", ObjectType.MILK, "milk.stl", pose=Pose([1.3, 1, 0.9])) | ||
cls.cereal = Object("cereal", ObjectType.BREAKFAST_CEREAL, "breakfast_cereal.stl", pose=Pose([1.3, 0.7, 0.95])) | ||
ProcessModule.execution_delay = False | ||
|
||
def setUp(self): | ||
self.world.reset_bullet_world() | ||
|
||
|
||
|
||
def tearDown(self): | ||
self.world.reset_bullet_world() | ||
|
||
@classmethod | ||
def tearDownClass(cls): | ||
cls.world.exit() | ||
|
||
|
||
class XMLTester(unittest.TestCase): | ||
|
||
def setUp(self) -> None: | ||
rospack = rospkg.RosPack() | ||
filename = rospack.get_path('pycram') + '/resources/' + 'pr2.urdf' | ||
with open(filename, "r") as f: | ||
self.urdf_string = f.read() | ||
|
||
def test_inertial(self): | ||
result = fix_missing_inertial(self.urdf_string) | ||
resulting_tree = ET.ElementTree(ET.fromstring(result)) | ||
for element in resulting_tree.iter("link"): | ||
self.assertTrue(len([*element.iter("inertial")]) > 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters