mirror of
https://github.com/AtsushiSakai/PythonRobotics.git
synced 2026-01-11 09:37:54 -05:00
code cleanup
This commit is contained in:
@@ -75,7 +75,7 @@ class RRT():
|
||||
return path
|
||||
|
||||
def choose_parent(self, newNode, nearinds):
|
||||
if len(nearinds) == 0:
|
||||
if not nearinds:
|
||||
return newNode
|
||||
|
||||
dlist = []
|
||||
|
||||
@@ -5,16 +5,18 @@ Path Planning Sample Code with RRT for car like robot.
|
||||
author: AtsushiSakai(@Atsushi_twi)
|
||||
|
||||
"""
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import copy
|
||||
import math
|
||||
import random
|
||||
import sys
|
||||
sys.path.append("../ReedsSheppPath/")
|
||||
|
||||
import random
|
||||
import math
|
||||
import copy
|
||||
import numpy as np
|
||||
import reeds_shepp_path_planning
|
||||
import matplotlib.pyplot as plt
|
||||
try:
|
||||
import reeds_shepp_path_planning
|
||||
except:
|
||||
raise
|
||||
|
||||
show_animation = True
|
||||
STEP_SIZE = 0.1
|
||||
@@ -80,7 +82,7 @@ class RRT():
|
||||
return path
|
||||
|
||||
def choose_parent(self, newNode, nearinds):
|
||||
if len(nearinds) == 0:
|
||||
if not nearinds:
|
||||
return newNode
|
||||
|
||||
dlist = []
|
||||
@@ -166,7 +168,7 @@ class RRT():
|
||||
# print("OK YAW TH num is")
|
||||
# print(len(fgoalinds))
|
||||
|
||||
if len(fgoalinds) == 0:
|
||||
if not fgoalinds:
|
||||
return None
|
||||
|
||||
mincost = min([self.nodeList[i].cost for i in fgoalinds])
|
||||
@@ -194,9 +196,9 @@ class RRT():
|
||||
nnode = len(self.nodeList)
|
||||
r = 50.0 * math.sqrt((math.log(nnode) / nnode))
|
||||
# r = self.expandDis * 5.0
|
||||
dlist = [(node.x - newNode.x) ** 2 +
|
||||
(node.y - newNode.y) ** 2 +
|
||||
(node.yaw - newNode.yaw) ** 2
|
||||
dlist = [(node.x - newNode.x) ** 2
|
||||
+ (node.y - newNode.y) ** 2
|
||||
+ (node.yaw - newNode.yaw) ** 2
|
||||
for node in self.nodeList]
|
||||
nearinds = [dlist.index(i) for i in dlist if i <= r ** 2]
|
||||
return nearinds
|
||||
@@ -247,9 +249,9 @@ class RRT():
|
||||
# input()
|
||||
|
||||
def GetNearestListIndex(self, nodeList, rnd):
|
||||
dlist = [(node.x - rnd.x) ** 2 +
|
||||
(node.y - rnd.y) ** 2 +
|
||||
(node.yaw - rnd.yaw) ** 2 for node in nodeList]
|
||||
dlist = [(node.x - rnd.x) ** 2
|
||||
+ (node.y - rnd.y) ** 2
|
||||
+ (node.yaw - rnd.yaw) ** 2 for node in nodeList]
|
||||
minind = dlist.index(min(dlist))
|
||||
|
||||
return minind
|
||||
|
||||
@@ -13,7 +13,7 @@ environment:
|
||||
init:
|
||||
- "ECHO %MINICONDA% %PYTHON_VERSION% %PYTHON_ARCH%"
|
||||
|
||||
|
||||
|
||||
install:
|
||||
# If there is a newer build queued for the same PR, cancel this one.
|
||||
# The AppVeyor 'rollout builds' option is supposed to serve the same
|
||||
|
||||
Reference in New Issue
Block a user