Skip to content

Commit f9a4fc1

Browse files
committed
code cleanup
1 parent 8542504 commit f9a4fc1

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

PathPlanning/RRTDubins/rrt_dubins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def Planning(self, animation=False):
7575
return path
7676

7777
def choose_parent(self, newNode, nearinds):
78-
if len(nearinds) == 0:
78+
if not nearinds:
7979
return newNode
8080

8181
dlist = []

PathPlanning/RRTStarReedsShepp/rrt_star_reeds_shepp.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@
55
author: AtsushiSakai(@Atsushi_twi)
66
77
"""
8-
8+
import matplotlib.pyplot as plt
9+
import numpy as np
10+
import copy
11+
import math
12+
import random
913
import sys
1014
sys.path.append("../ReedsSheppPath/")
1115

12-
import random
13-
import math
14-
import copy
15-
import numpy as np
16-
import reeds_shepp_path_planning
17-
import matplotlib.pyplot as plt
16+
try:
17+
import reeds_shepp_path_planning
18+
except:
19+
raise
1820

1921
show_animation = True
2022
STEP_SIZE = 0.1
@@ -80,7 +82,7 @@ def Planning(self, animation=True):
8082
return path
8183

8284
def choose_parent(self, newNode, nearinds):
83-
if len(nearinds) == 0:
85+
if not nearinds:
8486
return newNode
8587

8688
dlist = []
@@ -166,7 +168,7 @@ def get_best_last_index(self):
166168
# print("OK YAW TH num is")
167169
# print(len(fgoalinds))
168170

169-
if len(fgoalinds) == 0:
171+
if not fgoalinds:
170172
return None
171173

172174
mincost = min([self.nodeList[i].cost for i in fgoalinds])
@@ -194,9 +196,9 @@ def find_near_nodes(self, newNode):
194196
nnode = len(self.nodeList)
195197
r = 50.0 * math.sqrt((math.log(nnode) / nnode))
196198
# r = self.expandDis * 5.0
197-
dlist = [(node.x - newNode.x) ** 2 +
198-
(node.y - newNode.y) ** 2 +
199-
(node.yaw - newNode.yaw) ** 2
199+
dlist = [(node.x - newNode.x) ** 2
200+
+ (node.y - newNode.y) ** 2
201+
+ (node.yaw - newNode.yaw) ** 2
200202
for node in self.nodeList]
201203
nearinds = [dlist.index(i) for i in dlist if i <= r ** 2]
202204
return nearinds
@@ -247,9 +249,9 @@ def DrawGraph(self, rnd=None):
247249
# input()
248250

249251
def GetNearestListIndex(self, nodeList, rnd):
250-
dlist = [(node.x - rnd.x) ** 2 +
251-
(node.y - rnd.y) ** 2 +
252-
(node.yaw - rnd.yaw) ** 2 for node in nodeList]
252+
dlist = [(node.x - rnd.x) ** 2
253+
+ (node.y - rnd.y) ** 2
254+
+ (node.yaw - rnd.yaw) ** 2 for node in nodeList]
253255
minind = dlist.index(min(dlist))
254256

255257
return minind

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ environment:
1313
init:
1414
- "ECHO %MINICONDA% %PYTHON_VERSION% %PYTHON_ARCH%"
1515

16-
16+
1717
install:
1818
# If there is a newer build queued for the same PR, cancel this one.
1919
# The AppVeyor 'rollout builds' option is supposed to serve the same

0 commit comments

Comments
 (0)