Skip to content

Commit dabf104

Browse files
TakumItoTakumi Ito
and
Takumi Ito
authored
feat(freespace_planning_algorithms): add is_back flag into the return of A* python wrapper (#7831)
add is_back flag to the return of getWaypoints Signed-off-by: Takumi Ito <takumi.ito@tier4.jp> Co-authored-by: Takumi Ito <takumi.ito@tier4.jp>
1 parent 93a6abf commit dabf104

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

planning/autoware_freespace_planning_algorithms/autoware_freespace_planning_algorithms/astar_search.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
AstarParam = _fp.AstarParam
2525

2626

27+
class PlannerWaypoint:
28+
def __init__(self, pose, is_back):
29+
self.pose = pose
30+
self.is_back = is_back
31+
32+
2733
class PlannerWaypoints:
2834
def __init__(self):
2935
self.waypoints = []
@@ -59,6 +65,9 @@ def getWaypoints(self):
5965
for waypoint in waypoints_vector.waypoints:
6066
pos = Point(x=waypoint[0], y=waypoint[1], z=waypoint[2])
6167
quat = Quaternion(x=waypoint[3], y=waypoint[4], z=waypoint[5], w=waypoint[6])
62-
waypoints.waypoints.append(Pose(position=pos, orientation=quat))
68+
is_bask = bool(waypoint[7])
69+
waypoints.waypoints.append(
70+
PlannerWaypoint(Pose(position=pos, orientation=quat), is_bask)
71+
)
6372

6473
return waypoints

planning/autoware_freespace_planning_algorithms/scripts/bind/astar_search_pybind.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ class AstarSearchPython : public freespace_planning_algorithms::AstarSearch
8989
// python-side. So this function returns [*position, *quaternion] as double array
9090
const auto & xyz = waypoint.pose.pose.position;
9191
const auto & quat = waypoint.pose.pose.orientation;
92+
const double & is_back = waypoint.is_back;
9293
waypoints_vector.waypoints.push_back(
93-
std::vector<double>({xyz.x, xyz.y, xyz.z, quat.x, quat.y, quat.z, quat.w}));
94+
std::vector<double>({xyz.x, xyz.y, xyz.z, quat.x, quat.y, quat.z, quat.w, is_back}));
9495
}
9596
waypoints_vector.length = waypoints.compute_length();
9697
return waypoints_vector;

0 commit comments

Comments
 (0)