Skip to content

Commit f40296c

Browse files
committed
Fix bug in mstraj when segment durations are specified
1 parent 4f8120a commit f40296c

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

roboticstoolbox/tools/trajectory.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -933,11 +933,9 @@ def mrange(start, stop, step):
933933
and includes the final value unlike range() or np.arange()
934934
"""
935935
ret = []
936-
v = start
937-
while v <= stop:
938-
ret.append(v)
939-
v += step
940-
return np.r_[ret]
936+
istart = round(start / step)
937+
istop = round(stop / step)
938+
return np.arange(istart, istop + 1) * step
941939

942940
for seg in range(0, ns):
943941
q_next = viapoints[seg, :] # current target

0 commit comments

Comments
 (0)