@@ -38,8 +38,8 @@ class FKine(FunctionBlock):
3838
3939 nin = 1
4040 nout = 1
41- inlabels = ('q' ,)
42- outlabels = ('T' ,)
41+ inlabels = ("q" ,)
42+ outlabels = ("T" ,)
4343
4444 def __init__ (self , robot = None , args = {}, ** blockargs ):
4545 """
@@ -63,7 +63,7 @@ def __init__(self, robot=None, args={}, **blockargs):
6363 :output T: End-effector pose as an SE(3) object
6464 """
6565 if robot is None :
66- raise ValueError (' robot is not defined' )
66+ raise ValueError (" robot is not defined" )
6767
6868 super ().__init__ (** blockargs )
6969 self .type = "forward-kinematics"
@@ -97,8 +97,8 @@ class IKine(FunctionBlock):
9797
9898 nin = 1
9999 nout = 1
100- inlabels = ('T' ,)
101- outlabels = ('q' ,)
100+ inlabels = ("T" ,)
101+ outlabels = ("q" ,)
102102
103103 def __init__ (
104104 self , robot = None , q0 = None , useprevious = True , ik = None , seed = None , ** blockargs
@@ -132,7 +132,7 @@ def __init__(
132132
133133 """
134134 if robot is None :
135- raise ValueError (' robot is not defined' )
135+ raise ValueError (" robot is not defined" )
136136
137137 super ().__init__ (** blockargs )
138138 self .type = "inverse-kinematics"
@@ -174,6 +174,7 @@ def output(self, t=None):
174174
175175# ------------------------------------------------------------------------ #
176176
177+
177178class Jacobian (FunctionBlock ):
178179 """
179180 :blockname:`JACOBIAN`
@@ -192,17 +193,11 @@ class Jacobian(FunctionBlock):
192193
193194 nin = 1
194195 nout = 1
195- inlabels = ('q' ,)
196- outlabels = ('J' ,)
196+ inlabels = ("q" ,)
197+ outlabels = ("J" ,)
197198
198199 def __init__ (
199- self ,
200- robot ,
201- frame = "0" ,
202- inverse = False ,
203- pinv = False ,
204- transpose = False ,
205- ** blockargs
200+ self , robot , frame = "0" , inverse = False , pinv = False , transpose = False , ** blockargs
206201 ):
207202 """
208203 :param robot: Robot model
@@ -238,8 +233,8 @@ def __init__(
238233 error will occur.
239234 """
240235 if robot is None :
241- raise ValueError (' robot is not defined' )
242-
236+ raise ValueError (" robot is not defined" )
237+
243238 super ().__init__ (** blockargs )
244239
245240 self .robot = robot
@@ -273,9 +268,9 @@ def output(self, t=None):
273268 return [J ]
274269
275270
276-
277271# ------------------------------------------------------------------------ #
278272
273+
279274class FDyn (TransferBlock ):
280275 """
281276 :blockname:`FDYN`
@@ -296,8 +291,8 @@ class FDyn(TransferBlock):
296291
297292 nin = 1
298293 nout = 3
299- outlabels = ('q' , 'qd' , ' qdd' )
300- inlabels = ( 'τ' )
294+ outlabels = ("q" , "qd" , " qdd" )
295+ inlabels = "τ"
301296
302297 def __init__ (self , robot , q0 = None , ** blockargs ):
303298 """
@@ -325,8 +320,8 @@ def __init__(self, robot, q0=None, **blockargs):
325320
326321 """
327322 if robot is None :
328- raise ValueError (' robot is not defined' )
329-
323+ raise ValueError (" robot is not defined" )
324+
330325 super ().__init__ (** blockargs )
331326 self .type = "forward-dynamics"
332327
@@ -385,8 +380,8 @@ class IDyn(FunctionBlock):
385380
386381 nin = 3
387382 nout = 1
388- inlabels = ('q' , 'qd' , ' qdd' )
389- outlabels = ( 'τ' )
383+ inlabels = ("q" , "qd" , " qdd" )
384+ outlabels = "τ"
390385
391386 def __init__ (self , robot , gravity = None , ** blockargs ):
392387 """
@@ -415,7 +410,7 @@ def __init__(self, robot, gravity=None, **blockargs):
415410 .. TODO:: end-effector wrench input, base wrench output, payload input
416411 """
417412 if robot is None :
418- raise ValueError (' robot is not defined' )
413+ raise ValueError (" robot is not defined" )
419414
420415 super ().__init__ (** blockargs )
421416 self .type = "inverse-dynamics"
@@ -429,7 +424,9 @@ def __init__(self, robot, gravity=None, **blockargs):
429424 self .outport_names (("$\t au$" ,))
430425
431426 def output (self , t = None ):
432- tau = self .robot .rne (self .inputs [0 ], self .inputs [1 ], self .inputs [2 ], gravity = self .gravity )
427+ tau = self .robot .rne (
428+ self .inputs [0 ], self .inputs [1 ], self .inputs [2 ], gravity = self .gravity
429+ )
433430 return [tau ]
434431
435432
@@ -451,8 +448,8 @@ class Gravload(FunctionBlock):
451448
452449 nin = 1
453450 nout = 1
454- inlabels = ('q' ,)
455- outlabels = ( 'τ' )
451+ inlabels = ("q" ,)
452+ outlabels = "τ"
456453
457454 def __init__ (self , robot , gravity = None , ** blockargs ):
458455 """
@@ -478,8 +475,8 @@ def __init__(self, robot, gravity=None, **blockargs):
478475
479476 """
480477 if robot is None :
481- raise ValueError (' robot is not defined' )
482-
478+ raise ValueError (" robot is not defined" )
479+
483480 super ().__init__ (** blockargs )
484481 self .type = "gravload"
485482
@@ -492,6 +489,7 @@ def output(self, t=None):
492489 tau = self .robot .gravload (self .inputs [0 ], gravity = self .gravity )
493490 return [tau ]
494491
492+
495493class Gravload_X (FunctionBlock ):
496494 """
497495 :blockname:`GRAVLOAD_X`
@@ -510,8 +508,8 @@ class Gravload_X(FunctionBlock):
510508
511509 nin = 1
512510 nout = 1
513- inlabels = ('q' ,)
514- outlabels = ( 'w' )
511+ inlabels = ("q" ,)
512+ outlabels = "w"
515513
516514 def __init__ (self , robot , representation = "rpy/xyz" , gravity = None , ** blockargs ):
517515 """
@@ -537,8 +535,8 @@ def __init__(self, robot, representation="rpy/xyz", gravity=None, **blockargs):
537535
538536 """
539537 if robot is None :
540- raise ValueError (' robot is not defined' )
541-
538+ raise ValueError (" robot is not defined" )
539+
542540 super ().__init__ (** blockargs )
543541 self .type = "gravload-x"
544542
@@ -550,9 +548,12 @@ def __init__(self, robot, representation="rpy/xyz", gravity=None, **blockargs):
550548
551549 def output (self , t = None ):
552550 q = self .inputs [0 ]
553- w = self .robot .gravload_x (q , representation = self .representation , gravity = self .gravity )
551+ w = self .robot .gravload_x (
552+ q , representation = self .representation , gravity = self .gravity
553+ )
554554 return [w ]
555555
556+
556557class Inertia (FunctionBlock ):
557558 """
558559 :blockname:`INERTIA`
@@ -571,8 +572,8 @@ class Inertia(FunctionBlock):
571572
572573 nin = 1
573574 nout = 1
574- inlabels = ('q' ,)
575- outlabels = ( 'M' )
575+ inlabels = ("q" ,)
576+ outlabels = "M"
576577
577578 def __init__ (self , robot , ** blockargs ):
578579 """
@@ -596,8 +597,8 @@ def __init__(self, robot, **blockargs):
596597
597598 """
598599 if robot is None :
599- raise ValueError (' robot is not defined' )
600-
600+ raise ValueError (" robot is not defined" )
601+
601602 super ().__init__ (** blockargs )
602603 self .type = "inertia"
603604
@@ -609,6 +610,7 @@ def output(self, t=None):
609610 M = self .robot .inertia (self .inputs [0 ])
610611 return [M ]
611612
613+
612614class Inertia_X (FunctionBlock ):
613615 """
614616 :blockname:`INERTIA_X`
@@ -627,8 +629,8 @@ class Inertia_X(FunctionBlock):
627629
628630 nin = 1
629631 nout = 1
630- inlabels = ('q' ,)
631- outlabels = ( 'M' )
632+ inlabels = ("q" ,)
633+ outlabels = "M"
632634
633635 def __init__ (self , robot , representation = "rpy/xyz" , pinv = False , ** blockargs ):
634636 """
@@ -652,8 +654,8 @@ def __init__(self, robot, representation="rpy/xyz", pinv=False, **blockargs):
652654
653655 """
654656 if robot is None :
655- raise ValueError (' robot is not defined' )
656-
657+ raise ValueError (" robot is not defined" )
658+
657659 super ().__init__ (** blockargs )
658660 self .type = "inertia-x"
659661
@@ -667,8 +669,11 @@ def output(self, t=None):
667669 q = self .inputs [0 ]
668670 Mx = self .robot .inertia_x (q , pinv = self .pinv , representation = self .representation )
669671 return [Mx ]
672+
673+
670674# ------------------------------------------------------------------------ #
671675
676+
672677class FDyn_X (TransferBlock ):
673678 """
674679 :blockname:`FDYN_X`
@@ -689,10 +694,18 @@ class FDyn_X(TransferBlock):
689694
690695 nin = 1
691696 nout = 5
692- outlabels = ('q' , 'qd' , 'x' , 'xd' , ' xdd' )
693- inlabels = ( 'w' )
697+ outlabels = ("q" , "qd" , "x" , "xd" , " xdd" )
698+ inlabels = "w"
694699
695- def __init__ (self , robot , q0 = None , gravcomp = False , velcomp = False , representation = 'rpy/xyz' , ** blockargs ):
700+ def __init__ (
701+ self ,
702+ robot ,
703+ q0 = None ,
704+ gravcomp = False ,
705+ velcomp = False ,
706+ representation = "rpy/xyz" ,
707+ ** blockargs ,
708+ ):
696709 """
697710 :param robot: Robot model
698711 :type robot: Robot subclass
@@ -718,8 +731,8 @@ def __init__(self, robot, q0=None, gravcomp=False, velcomp=False, representation
718731
719732 """
720733 if robot is None :
721- raise ValueError (' robot is not defined' )
722-
734+ raise ValueError (" robot is not defined" )
735+
723736 super ().__init__ (** blockargs )
724737 self .type = "forward-dynamics-x"
725738
@@ -795,6 +808,7 @@ def deriv(self):
795808
796809# ------------------------------------------------------------------------ #
797810
811+
798812class ArmPlot (GraphicsBlock ):
799813 """
800814 :blockname:`ARMPLOT`
@@ -813,7 +827,7 @@ class ArmPlot(GraphicsBlock):
813827
814828 nin = 1
815829 nout = 0
816- inlabels = ('q' ,)
830+ inlabels = ("q" ,)
817831
818832 def __init__ (self , robot = None , q0 = None , backend = None , ** blockargs ):
819833 """
@@ -837,7 +851,7 @@ def __init__(self, robot=None, q0=None, backend=None, **blockargs):
837851 block name.
838852 """
839853 if robot is None :
840- raise ValueError (' robot is not defined' )
854+ raise ValueError (" robot is not defined" )
841855
842856 super ().__init__ (** blockargs )
843857 self .inport_names (("q" ,))
@@ -848,13 +862,13 @@ def __init__(self, robot=None, q0=None, backend=None, **blockargs):
848862 self .backend = backend
849863 self .q0 = q0
850864 self .env = None
851- print (' ARMPLOT init' )
865+ print (" ARMPLOT init" )
852866
853867 def start (self , state ):
854868 # create the plot
855869 # super().reset()
856870 # if state.options.graphics:
857- print (' ARMPLOT init' )
871+ print (" ARMPLOT init" )
858872 self .fig = self .create_figure (state )
859873 self .env = self .robot .plot (
860874 self .q0 , backend = self .backend , fig = self .fig , block = False
@@ -870,7 +884,6 @@ def step(self, state):
870884 super ().step (state )
871885
872886
873-
874887if __name__ == "__main__" :
875888
876889 from pathlib import Path
0 commit comments