Skip to content

Commit ceccf7f

Browse files
author
Takumi Ito
committed
modularize and some modification
Signed-off-by: Takumi Ito <takumi.ito@tier4.jp>
1 parent adcd0ca commit ceccf7f

File tree

9 files changed

+39
-20
lines changed

9 files changed

+39
-20
lines changed

planning/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
result/
22
costmap/
3+
*.egg-info/

planning/planning_tuning_tools/scripts/astar_tuning_tools/README.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,22 @@
1414
source install/setup.bash
1515
```
1616

17+
3. Move to this directory and run
18+
19+
```sh
20+
pip3 install .
21+
```
22+
1723
## Costmap generation
1824

1925
### Usage
2026

21-
1. Run the script `python3 generate_costmap.py --save_name [filename]`
27+
1. Run the script
28+
29+
```sh
30+
python3 generate_costmap.py --save_name [filename]
31+
```
32+
2233
2. Then the GUI shows up
2334
- Drag and drop to put an obstacle
2435
- Drag and drop the same points again to remove the obstacle
@@ -70,7 +81,12 @@ Search for goals on grid: discretized on x, y, yaw axes.
7081

7182
### Usage
7283

73-
1. Run the script `python3 visualize_trajectories.py --dir_name [save dir name]`
84+
1. Run the script
85+
86+
```sh
87+
python3 visualize_trajectories.py --dir_name [save dir name]
88+
```
89+
7490
2. Then the two GUIs show up
7591
- Viewer of the searched trajectories
7692
- Drag and drop to put a goal in specified direction

planning/planning_tuning_tools/scripts/astar_tuning_tools/common/__init__.py

Whitespace-only changes.

planning/planning_tuning_tools/scripts/astar_tuning_tools/common/common_classes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ def __init__(self, costmap, xs, ys, yaws):
77

88

99
class Result:
10-
def __init__(self, x, y, yaw, find, trajectory):
10+
def __init__(self, x, y, yaw, find, waypoints):
1111
self.xs = x
1212
self.ys = y
1313
self.yaws = yaw
1414
self.find = find
15-
self.trajectory = trajectory
15+
self.waypoints = waypoints

planning/planning_tuning_tools/scripts/astar_tuning_tools/param/__init__.py

Whitespace-only changes.

planning/planning_tuning_tools/scripts/astar_tuning_tools/search_gridgoal.py

+2-15
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
import pickle
1919
import time
2020

21-
from autoware_auto_planning_msgs.msg import Trajectory
22-
from autoware_auto_planning_msgs.msg import TrajectoryPoint
2321
from common.common_classes import Result
2422
from common.common_classes import SearchInfo
2523
import freespace_planning_algorithms.astar_search as fp
@@ -46,16 +44,6 @@ def float_range(start, end, step):
4644
return f_range
4745

4846

49-
def createTrajectory(waypoints):
50-
trajectory = Trajectory()
51-
for waypoint in waypoints.waypoints:
52-
trajectory_point = TrajectoryPoint()
53-
trajectory_point.pose = waypoint
54-
trajectory.points.append(trajectory_point)
55-
56-
return trajectory
57-
58-
5947
if __name__ == "__main__":
6048
parser = argparse.ArgumentParser(description="place of save result")
6149
parser.add_argument(
@@ -139,12 +127,11 @@ def createTrajectory(waypoints):
139127
goal_pose.orientation.z = quaterinon.z
140128

141129
find = astar.makePlan(start_pose, goal_pose)
142-
trajectory = []
130+
waypoints = fp.PlannerWaypoints()
143131
if find:
144132
waypoints = astar.getWaypoints()
145-
trajectory = createTrajectory(waypoints)
146133

147-
result = Result(x, y, yaw, find, trajectory)
134+
result = Result(x, y, yaw, find, waypoints)
148135

149136
pickle.dump(result, f)
150137

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from setuptools import find_packages
2+
from setuptools import setup
3+
4+
setup(name="astar_tuning_tools", version="1.0.0", packages=find_packages())

planning/planning_tuning_tools/scripts/astar_tuning_tools/visualize_trajectories.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import sys
2020

2121
from autoware_auto_planning_msgs.msg import Trajectory
22+
from autoware_auto_planning_msgs.msg import TrajectoryPoint
2223
import matplotlib.colors as mcolors
2324
import matplotlib.pyplot as plt
2425
import numpy as np
@@ -32,6 +33,16 @@
3233
COLOR_KEYS = list(TAB_COLORS.keys())
3334

3435

36+
def createTrajectory(waypoints):
37+
trajectory = Trajectory()
38+
for waypoint in waypoints.waypoints:
39+
trajectory_point = TrajectoryPoint()
40+
trajectory_point.pose = waypoint.pose
41+
trajectory.points.append(trajectory_point)
42+
43+
return trajectory
44+
45+
3546
class DrawClickedTrajectory:
3647
def __init__(self, fig, xs, ys, yaws, trajectories):
3748
self.press_point = None
@@ -180,7 +191,7 @@ def drawnow(self):
180191
with open(filename, "rb") as f:
181192
result = pickle.load(f)
182193
results[k][i][j] = result.find
183-
trajectories[k][i][j] = result.trajectory
194+
trajectories[k][i][j] = createTrajectory(result.waypoints)
184195

185196
# detect obstacle
186197
obstacle_x = []

0 commit comments

Comments
 (0)