@@ -708,7 +708,10 @@ def base(self):
708
708
is an identity matrix.
709
709
"""
710
710
if self ._base is None :
711
- self ._base = SE3 ()
711
+ if isinstance (self , ERobot2 ):
712
+ self ._base = SE2 ()
713
+ else :
714
+ self ._base = SE3 ()
712
715
713
716
return self ._base
714
717
@@ -881,6 +884,35 @@ def control_type(self, cn):
881
884
882
885
# --------------------------------------------------------------------- #
883
886
887
+ # TODO probably should be a static method
888
+ def _get_graphical_backend (self , backend ):
889
+ #
890
+ # find the right backend, modules are imported here on an as needs basis
891
+ if backend .lower () == 'swift' : # pragma nocover
892
+ if isinstance (self , rtb .DHRobot ):
893
+ raise NotImplementedError (
894
+ 'Plotting in Swift is not implemented for DHRobots yet' )
895
+
896
+ from roboticstoolbox .backends .Swift import Swift
897
+ env = Swift ()
898
+
899
+ elif backend .lower () == 'pyplot' :
900
+ from roboticstoolbox .backends .PyPlot import PyPlot
901
+ env = PyPlot ()
902
+
903
+ elif backend .lower () == 'pyplot2' :
904
+ from roboticstoolbox .backends .PyPlot import PyPlot2
905
+ env = PyPlot2 ()
906
+
907
+ elif backend .lower () == 'vpython' :
908
+ from roboticstoolbox .backends .VPython import VPython
909
+ env = VPython ()
910
+
911
+ else :
912
+ raise ValueError ('unknown backend' , backend )
913
+
914
+ return env
915
+
884
916
def plot (
885
917
self , q , backend = None , block = False , dt = 0.050 ,
886
918
limits = None , vellipse = False , fellipse = False ,
@@ -1457,12 +1489,8 @@ def teach(
1457
1489
occurs.
1458
1490
"""
1459
1491
1460
- if isinstance (self , rtb .ERobot ): # pragma nocover
1461
- raise NotImplementedError (
1462
- "2D Plotting of ERobot's not implemented yet" )
1463
-
1464
- if q is not None :
1465
- self .q = q
1492
+ if q is None :
1493
+ q = np .zeros ((self .n ,))
1466
1494
1467
1495
# Make an empty 3D figure
1468
1496
env = self ._get_graphical_backend (backend )
@@ -1473,7 +1501,7 @@ def teach(
1473
1501
self , readonly = True ,
1474
1502
jointaxes = jointaxes , eeframe = eeframe , shadow = shadow , name = name )
1475
1503
1476
- env ._add_teach_panel (self )
1504
+ env ._add_teach_panel (self , q )
1477
1505
1478
1506
# Keep the plot open
1479
1507
if block : # pragma: no cover
0 commit comments