@@ -123,11 +123,11 @@ class BaseERobot(Robot):
123
123
:references:
124
124
- Kinematic Derivatives using the Elementary Transform Sequence,
125
125
J. Haviland and P. Corke
126
- """
126
+ """ # noqa E501
127
127
128
128
def __init__ (
129
129
self ,
130
- arg ,
130
+ links ,
131
131
base_link = None ,
132
132
gripper_links = None ,
133
133
checkjindex = True ,
@@ -144,72 +144,34 @@ def __init__(
144
144
# search order
145
145
orlinks = []
146
146
147
- if isinstance (arg , DHRobot ):
148
- # we're passed a DHRobot object
149
- # TODO handle dynamic parameters if given
150
- args = args .ets ()
151
-
152
- link_number = 0
153
- if isinstance (arg , ETS ):
154
- # we're passed an ETS string
155
- ets = arg
156
- links = []
157
147
158
- # chop it up into segments, a link frame after every joint
159
- start = 0
160
- for j , k in enumerate (ets .joints ()):
161
- ets_j = ets [start :k + 1 ]
162
- start = k + 1
163
- if j == 0 :
164
- parent = None
165
- else :
166
- parent = links [- 1 ]
167
- elink = ELink (ets_j , parent = parent , name = f"link{ j :d} " )
168
- links .append (elink )
169
-
170
- n = len (ets .joints ())
171
-
172
- tool = ets [start :]
173
- if len (tool ) > 0 :
174
- links .append (ELink (tool , parent = links [- 1 ], name = "ee" ))
175
-
176
- elif isinstance (arg , list ):
177
- # we're passed a list of ELinks
148
+ # check all the incoming ELink objects
149
+ n = 0
150
+ for link in links :
151
+ # if link has no name, give it one
152
+ if link .name is None :
153
+ link .name = f"link-{ link_number } "
154
+ link_number += 1
178
155
179
- # check all the incoming ELink objects
180
- n = 0
181
- ndims = None
182
- links = arg
183
- for link in links :
184
- if isinstance (link , ELink ):
185
- # if link has no name, give it one
186
- if link .name is None :
187
- link .name = f"link-{ link_number } "
188
- link_number += 1
189
-
190
- # put it in the link dictionary, check for duplicates
191
- if link .name in self ._linkdict :
192
- raise ValueError (
193
- f'link name { link .name } is not unique' )
194
- self ._linkdict [link .name ] = link
195
- else :
196
- raise TypeError ("Input can be only ELink" )
197
- if link .isjoint :
198
- n += 1
156
+ # put it in the link dictionary, check for duplicates
157
+ if link .name in self ._linkdict :
158
+ raise ValueError (
159
+ f'link name { link .name } is not unique' )
160
+ self ._linkdict [link .name ] = link
199
161
200
- # resolve parents given by name, within the context of
201
- # this set of links
202
- for link in links :
203
- if isinstance (link .parent , str ):
204
- link ._parent = self ._linkdict [link .parent ]
162
+ if link .isjoint :
163
+ n += 1
205
164
206
- if all ([link .parent is None for link in links ]):
207
- # no parent links were given, assume they are sequential
208
- for i in range (len (links ) - 1 ):
209
- links [i + 1 ]._parent = links [i ]
165
+ # resolve parents given by name, within the context of
166
+ # this set of links
167
+ for link in links :
168
+ if isinstance (link .parent , str ):
169
+ link ._parent = self ._linkdict [link .parent ]
210
170
211
- else :
212
- raise TypeError ('elinks must be a list of ELinks or an ETS' )
171
+ if all ([link .parent is None for link in links ]):
172
+ # no parent links were given, assume they are sequential
173
+ for i in range (len (links ) - 1 ):
174
+ links [i + 1 ]._parent = links [i ]
213
175
214
176
self ._n = n
215
177
0 commit comments