Skip to content

Commit 2db7b2c

Browse files
committed
允许添加属性,且 jacobian 的求解依赖于 robot.links 的长度,而不再是 robot.n
1 parent 1fe831c commit 2db7b2c

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

robot/Robot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ def __setattr__(self, name, value):
214214
self.__dict__[name] = value
215215

216216
else:
217-
raise AttributeError
217+
#raise AttributeError
218+
self.__dict__[name] = value
218219

219220
def plot(self, q, fig=None, ax=None, show=True):
220221
# TODO 绘制机器人三维图像

robot/jacobian.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ def jacob0(robot, q):
3636
q = mat(q)
3737
Jn = jacobn(robot, q) # Jacobian from joint to wrist space
3838
# convert to Jacobian in base coordinates
39-
# |R 0|
40-
# J0 = |0 R| * Jn
4139
Tn = fkine(robot,q) # end-effector transformation
4240
R = t2r(Tn)
4341
return concatenate( ( concatenate( (R,zeros((3,3))) ,1) , concatenate( (zeros((3,3)),R) ,1) ))*Jn
@@ -68,8 +66,8 @@ def jacobn(robot, q):
6866
@see: L{jacobn}, L{diff2tr}, L{tr2diff}
6967
"""
7068
q = arg2array(q)
71-
n = robot.n
7269
L = robot.links
70+
n = len(L)
7371
J = mat([[],[],[],[],[],[]])
7472
U = robot.tool
7573
for j in range(n-1,-1,-1):

0 commit comments

Comments
 (0)