Skip to content

Commit

Permalink
[tests] moved XML test to test_bullet_world
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigul committed Jan 3, 2024
1 parent d998714 commit dbe783b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
13 changes: 0 additions & 13 deletions test/bullet_world_testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from pycram.process_module import ProcessModule
from pycram.enums import ObjectType
import os
import xml.etree.ElementTree as ET
import tf


Expand Down Expand Up @@ -41,16 +40,4 @@ 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)
24 changes: 23 additions & 1 deletion test/test_bullet_world.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import unittest

import rospkg

from bullet_world_testcase import BulletWorldTestCase
from pycram.pose import Pose
import numpy as np
from pycram.bullet_world import fix_missing_inertial
import xml.etree.ElementTree as ET


class BulletWorldTest(BulletWorldTestCase):
Expand All @@ -14,4 +20,20 @@ def test_robot_orientation(self):
head_position = self.robot.get_link_position('head_pan_link').z
#self.robot.set_orientation(list(2*tf.transformations.quaternion_from_euler(0, 0, np.pi, axes="sxyz")))
self.robot.set_orientation(Pose(orientation=[0, 0, 1, 1]))
self.assertEqual(self.robot.get_link_position('head_pan_link').z, head_position)
self.assertEqual(self.robot.get_link_position('head_pan_link').z, head_position)


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)

0 comments on commit dbe783b

Please sign in to comment.