Skip to content

Commit 4142b43

Browse files
committed
added the attribute q to joint velocity damper method
1 parent 687d345 commit 4142b43

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

roboticstoolbox/robot/Robot.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,7 @@ def collided(self, q, shape: Shape, skip: bool = False) -> bool:
13311331

13321332
def joint_velocity_damper(
13331333
self,
1334+
q=None,
13341335
ps: float = 0.05,
13351336
pi: float = 0.1,
13361337
n: Union[int, None] = None,
@@ -1368,16 +1369,19 @@ def joint_velocity_damper(
13681369

13691370
if n is None:
13701371
n = self.n
1372+
1373+
if q is None:
1374+
q = np.copy(self.q)
13711375

13721376
Ain = np.zeros((n, n))
13731377
Bin = np.zeros(n)
13741378

13751379
for i in range(n):
13761380
if self.q[i] - self.qlim[0, i] <= pi:
1377-
Bin[i] = -gain * (((self.qlim[0, i] - self.q[i]) + ps) / (pi - ps))
1381+
Bin[i] = -gain * (((self.qlim[0, i] - q[i]) + ps) / (pi - ps))
13781382
Ain[i, i] = -1
13791383
if self.qlim[1, i] - self.q[i] <= pi:
1380-
Bin[i] = gain * ((self.qlim[1, i] - self.q[i]) - ps) / (pi - ps)
1384+
Bin[i] = gain * ((self.qlim[1, i] - q[i]) - ps) / (pi - ps)
13811385
Ain[i, i] = 1
13821386

13831387
return Ain, Bin

0 commit comments

Comments
 (0)