|
11 | 11 | import spatialmath as sm
|
12 | 12 | from math import pi, sin, cos
|
13 | 13 |
|
14 |
| - |
15 | 14 | class TestERobot(unittest.TestCase):
|
16 | 15 |
|
17 | 16 | def test_ets_init(self):
|
@@ -725,6 +724,60 @@ def test_invdyn(self):
|
725 | 724 | tau = robot.rne(q, z, [1, 1])
|
726 | 725 | nt.assert_array_almost_equal(tau, np.r_[d11 + d12, d21 + d22])
|
727 | 726 |
|
| 727 | +class TestERobot2(unittest.TestCase): |
| 728 | + def test_plot2(self): |
| 729 | + panda = rtb.models.DH.Panda() |
| 730 | + e = panda.plot2(panda.qr, block=False, name=True) |
| 731 | + e.close() |
| 732 | + |
| 733 | + def test_plot2_traj(self): |
| 734 | + panda = rtb.models.DH.Panda() |
| 735 | + q = np.random.rand(3, 7) |
| 736 | + e = panda.plot2(block=False, q=q, dt=0) |
| 737 | + e.close() |
| 738 | + |
| 739 | + def test_teach2_basic(self): |
| 740 | + l0 = rtb.DHLink(d=2) |
| 741 | + r0 = rtb.DHRobot([l0, l0]) |
| 742 | + e = r0.teach2(block=False) |
| 743 | + e.step() |
| 744 | + e.close() |
| 745 | + |
| 746 | + def test_teach2(self): |
| 747 | + panda = rtb.models.DH.Panda() |
| 748 | + e = panda.teach(panda.qr, block=False) |
| 749 | + e.close() |
| 750 | + |
| 751 | + e2 = panda.teach2(block=False, q=panda.qr) |
| 752 | + e2.close() |
| 753 | + |
| 754 | + def test_plot_with_vellipse2(self): |
| 755 | + panda = rtb.models.DH.Panda() |
| 756 | + e = panda.plot2( |
| 757 | + panda.qr, block=False, vellipse=True, limits=[1, 2, 1, 2]) |
| 758 | + e.step() |
| 759 | + e.close() |
| 760 | + |
| 761 | + def test_plot_with_fellipse2(self): |
| 762 | + panda = rtb.models.DH.Panda() |
| 763 | + e = panda.plot2(panda.qr, block=False, fellipse=True) |
| 764 | + e.close() |
| 765 | + |
| 766 | + def test_plot_with_vellipse2_fail(self): |
| 767 | + panda = rtb.models.DH.Panda() |
| 768 | + panda.q = panda.qr |
| 769 | + |
| 770 | + from roboticstoolbox.backends.PyPlot import PyPlot2 |
| 771 | + e = PyPlot2() |
| 772 | + e.launch() |
| 773 | + e.add(panda.fellipse( |
| 774 | + q=panda.qr, centre=[0, 1])) |
| 775 | + |
| 776 | + with self.assertRaises(ValueError): |
| 777 | + e.add(panda.fellipse( |
| 778 | + q=panda.qr, centre='ee', opt='rot')) |
| 779 | + |
| 780 | + e.close() |
728 | 781 |
|
729 | 782 | if __name__ == '__main__': # pragma nocover
|
730 | 783 |
|
|
0 commit comments