Commit 506fb4d0 authored by Guilhem Saurel's avatar Guilhem Saurel

[Tests] use load

Which lead to find that __main__ was missing the variations of icub &
ur5
parent 146632c5
......@@ -237,7 +237,12 @@ ROBOTS = {
'double_pendulum': (loadDoublePendulum, {}),
'hector': (loadHector, {}),
'hyq': (loadHyQ, {}),
'icub': (loadICub, {}),
'icub': (loadICub, {
'reduced': False
}),
'icub_reduced': (loadICub, {
'reduced': True
}),
'iris': (loadIris, {}),
'kinova': (loadKinova, {}),
'panda': (loadPanda, {}),
......@@ -258,6 +263,12 @@ ROBOTS = {
'hand': False
}),
'ur5': (loadUR, {}),
'ur5_gripper': (loadUR, {
'gripper': True
}),
'ur5_limited': (loadUR, {
'limited': True
}),
}
......
......@@ -2,66 +2,70 @@
import unittest
import example_robot_data as erd
from example_robot_data import load
class RobotTestCase(unittest.TestCase):
def check(self, robot, expected_nq, expected_nv):
def check(self, name, expected_nq, expected_nv):
"""Helper function for the real tests"""
robot = load(name, display=False)
self.assertEqual(robot.model.nq, expected_nq)
self.assertEqual(robot.model.nv, expected_nv)
self.assertTrue(hasattr(robot, "q0"))
def test_anymal(self):
self.check(erd.loadANYmal(), 19, 18)
self.check('anymal', 19, 18)
def test_anymal_kinova(self):
self.check(erd.loadANYmal(withArm="kinova"), 25, 24)
self.check('anymal_kinova', 25, 24)
def test_hyq(self):
self.check(erd.loadHyQ(), 19, 18)
self.check('hyq', 19, 18)
def test_talos(self):
self.check(erd.loadTalos(), 39, 38)
self.check('talos', 39, 38)
def test_talos_arm(self):
self.check(erd.loadTalos(arm=True), 7, 7)
self.check('talos_arm', 7, 7)
def test_talos_legs(self):
self.check(erd.loadTalos(legs=True), 19, 18)
self.check('talos_legs', 19, 18)
def test_icub(self):
self.check(erd.loadICub(reduced=False), 39, 38)
self.check('icub', 39, 38)
def test_icub_reduced(self):
self.check('icub_reduced', 36, 35)
def test_solo(self):
self.check(erd.loadSolo(), 15, 14)
self.check('solo', 15, 14)
def test_solo12(self):
self.check(erd.loadSolo(False), 19, 18)
self.check('solo12', 19, 18)
def test_tiago(self):
self.check(erd.loadTiago(), 50, 48)
self.check('tiago', 50, 48)
def test_tiago_no_hand(self):
self.check(erd.loadTiago(hand=False), 14, 12)
self.check('tiago_no_hand', 14, 12)
def test_ur5(self):
self.check(erd.loadUR(), 6, 6)
self.check('ur5', 6, 6)
def test_ur5_limited(self):
self.check(erd.loadUR(limited=True), 6, 6)
self.check('ur5_limited', 6, 6)
def test_ur5_gripper(self):
self.check(erd.loadUR(gripper=True), 6, 6)
self.check('ur5_gripper', 6, 6)
def test_kinova(self):
self.check(erd.loadKinova(), 9, 6)
self.check('kinova', 9, 6)
def test_romeo(self):
self.check(erd.loadRomeo(), 62, 61)
self.check('romeo', 62, 61)
def test_panda(self):
self.check(erd.loadPanda(), 9, 9)
self.check('panda', 9, 9)
if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment