Skip to content

Commit 205e539

Browse files
committed
collision fix
1 parent 6fbe680 commit 205e539

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

roboticstoolbox/robot/Robot.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,6 +1480,12 @@ def collided(self, shape):
14801480
if link.collided(shape):
14811481
return True
14821482

1483+
if isinstance(self, rtb.ERobot):
1484+
for gripper in self.grippers:
1485+
for link in gripper.links:
1486+
if link.collided(shape):
1487+
return True
1488+
14831489
return False
14841490

14851491
def joint_velocity_damper(self, ps=0.05, pi=0.1, n=None, gain=1.0):

roboticstoolbox/tools/p_servo.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env python
22

33
import numpy as np
4-
from spatialmath import SE3
4+
from spatialmath import SE3, base
5+
import math
56

67

78
def p_servo(wTe, wTep, gain=2, threshold=0.1):
@@ -57,3 +58,23 @@ def p_servo(wTe, wTep, gain=2, threshold=0.1):
5758
arrived = False
5859

5960
return v, arrived
61+
62+
63+
# def _angle_axis(T, Td):
64+
# d = base.transl(Td) - base.transl(T)
65+
# R = base.t2r(Td) @ base.t2r(T).T
66+
# li = np.r_[R[2, 1] - R[1, 2], R[0, 2] - R[2, 0], R[1, 0] - R[0, 1]]
67+
68+
# if base.iszerovec(li):
69+
# # diagonal matrix case
70+
# if np.trace(R) > 0:
71+
# # (1,1,1) case
72+
# a = np.zeros((3,))
73+
# else:
74+
# a = np.pi / 2 * (np.diag(R) + 1)
75+
# else:
76+
# # non-diagonal matrix case
77+
# ln = base.norm(li)
78+
# a = math.atan2(ln, np.trace(R) - 1) * li / ln
79+
80+
# return np.r_[d, a]

0 commit comments

Comments
 (0)