def print_joint_bounds(robot=None): if not robot: robot = RobotCommander() print 'NAME'.center(16), 'MIN'.center(10), 'MAX'.center(10) for name in robot.get_joint_names(): joint = robot.get_joint(name) bounds = joint.bounds() if bounds: print '%15s % 10.3f % 10.3f' % (name, bounds[0], bounds[1])
class TestLimits(unittest.TestCase): def setUp(self): self.robot = RobotCommander() self.bounds = list() for name in self.robot.get_joint_names(): joint = self.robot.get_joint(name) bounds = joint.bounds() if bounds: self.bounds.append((name, bounds)) def test_min_max(self): """Test whether the min is actually lower than max.""" failed = list() for name, bounds in self.bounds: if bounds[0] > bounds[1]: failed.append(name) self.assertFalse(failed, "Bounds are not valid for: %s" % " ".join(failed))