Skip to content

Commit bfc785c

Browse files
committed
remove np.matrix
1 parent eaa9b4d commit bfc785c

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

PathPlanning/BatchInformedRRTStar/batch_informed_rrtstar.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,13 @@ def setup_planning(self):
174174
# Computing the sampling space
175175
cMin = math.sqrt(pow(self.start[0] - self.goal[1], 2) +
176176
pow(self.start[0] - self.goal[1], 2)) / 1.5
177-
xCenter = np.matrix([[(self.start[0] + self.goal[0]) / 2.0],
178-
[(self.goal[1] - self.start[1]) / 2.0], [0]])
179-
a1 = np.matrix([[(self.goal[0] - self.start[0]) / cMin],
180-
[(self.goal[1] - self.start[1]) / cMin], [0]])
177+
xCenter = np.array([[(self.start[0] + self.goal[0]) / 2.0],
178+
[(self.goal[1] - self.start[1]) / 2.0], [0]])
179+
a1 = np.array([[(self.goal[0] - self.start[0]) / cMin],
180+
[(self.goal[1] - self.start[1]) / cMin], [0]])
181181
etheta = math.atan2(a1[1], a1[0])
182182
# first column of idenity matrix transposed
183-
id1_t = np.matrix([1.0, 0.0, 0.0])
183+
id1_t = np.array([1.0, 0.0, 0.0]).reshape(1, 3)
184184
M = np.dot(a1, id1_t)
185185
U, S, Vh = np.linalg.svd(M, 1, 1)
186186
C = np.dot(np.dot(U, np.diag(
@@ -530,7 +530,6 @@ def updateGraph(self):
530530

531531
def drawGraph(self, xCenter=None, cBest=None, cMin=None, etheta=None,
532532
samples=None, start=None, end=None, tree=None):
533-
print("Plotting Graph")
534533
plt.clf()
535534
for rnd in samples:
536535
if rnd is not None:
@@ -561,9 +560,9 @@ def plot_ellipse(self, xCenter, cBest, cMin, etheta):
561560
t = np.arange(0, 2 * math.pi + 0.1, 0.1)
562561
x = [a * math.cos(it) for it in t]
563562
y = [b * math.sin(it) for it in t]
564-
R = np.matrix([[math.cos(angle), math.sin(angle)],
565-
[-math.sin(angle), math.cos(angle)]])
566-
fx = R * np.matrix([x, y])
563+
R = np.array([[math.cos(angle), math.sin(angle)],
564+
[-math.sin(angle), math.cos(angle)]])
565+
fx = R @ np.array([x, y])
567566
px = np.array(fx[0, :] + cx).flatten()
568567
py = np.array(fx[1, :] + cy).flatten()
569568
plt.plot(cx, cy, "xc")

0 commit comments

Comments
 (0)