Skip to content

Commit

Permalink
Merge branch 'AtsushiSakai:master' into angle_mod
Browse files Browse the repository at this point in the history
  • Loading branch information
videh25 authored Jan 2, 2024
2 parents cffd7ab + 748b9be commit 964fb51
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
config-file: ./.github/codeql/codeql-config.yml
# Override language selection by uncommenting this and choosing your languages
Expand All @@ -34,7 +34,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -48,4 +48,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
17 changes: 14 additions & 3 deletions PathPlanning/DStar/dstar.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""
import math


from sys import maxsize

import matplotlib.pyplot as plt
Expand Down Expand Up @@ -103,7 +104,7 @@ def process_state(self):
if y.h <= k_old and x.h > y.h + x.cost(y):
x.parent = y
x.h = y.h + x.cost(y)
elif k_old == x.h:
if k_old == x.h:
for y in self.map.get_neighbors(x):
if y.t == "new" or y.parent == x and y.h != x.h + x.cost(y) \
or y.parent != x and y.h > x.h + x.cost(y):
Expand All @@ -116,7 +117,7 @@ def process_state(self):
self.insert(y, x.h + x.cost(y))
else:
if y.parent != x and y.h > x.h + x.cost(y):
self.insert(y, x.h)
self.insert(x, x.h)
else:
if y.parent != x and x.h > y.h + x.cost(y) \
and y.t == "close" and y.h > k_old:
Expand Down Expand Up @@ -173,6 +174,8 @@ def run(self, start, end):
s.set_state("e")
tmp = start

AddNewObstacle(self.map) # add new obstacle after the first search finished

while tmp != end:
tmp.set_state("*")
rx.append(tmp.x)
Expand All @@ -195,6 +198,15 @@ def modify(self, state):
if k_min >= state.h:
break

def AddNewObstacle(map:Map):
ox, oy = [], []
for i in range(5, 21):
ox.append(i)
oy.append(40)
map.set_obstacle([(i, j) for i, j in zip(ox, oy)])
if show_animation:
plt.pause(0.001)
plt.plot(ox, oy, ".g")

def main():
m = Map(100, 100)
Expand All @@ -217,7 +229,6 @@ def main():
for i in range(0, 40):
ox.append(40)
oy.append(60 - i)
print([(i, j) for i, j in zip(ox, oy)])
m.set_obstacle([(i, j) for i, j in zip(ox, oy)])

start = [10, 10]
Expand Down
4 changes: 2 additions & 2 deletions PathPlanning/HybridAStar/car.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def rectangle_check(x, y, yaw, ox, oy):
rx, ry = converted_xy[0], converted_xy[1]

if not (rx > LF or rx < -LB or ry > W / 2.0 or ry < -W / 2.0):
return False # no collision
return False # collision

return True # collision
return True # no collision


def plot_arrow(x, y, yaw, length=1.0, width=0.5, fc="r", ec="k"):
Expand Down
4 changes: 2 additions & 2 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ matplotlib == 3.8.2
cvxpy == 1.4.1
pytest == 7.4.3 # For unit test
pytest-xdist == 3.5.0 # For unit test
mypy == 1.7.1 # For unit test
ruff == 0.1.7 # For unit test
mypy == 1.8.0 # For unit test
ruff == 0.1.9 # For unit test

0 comments on commit 964fb51

Please sign in to comment.