Skip to content

Commit

Permalink
refactor: automatically detect bag file
Browse files Browse the repository at this point in the history
Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp>
  • Loading branch information
HiroIshida committed May 14, 2022
1 parent a5c077b commit 5dbd9f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions planning/freespace_planning_algorithms/test/debug_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from math import atan2
from math import cos
from math import sin
import os
from typing import Tuple

from geometry_msgs.msg import Pose
Expand Down Expand Up @@ -162,14 +163,15 @@ def plot_problem(pd: ProblemDescription, ax):


if __name__ == "__main__":
for postfix in ["single", "multi"]:
for idx in range(4):
pose_list = []
bag_path = "/tmp/result_{0}{1}".format(postfix, idx)
for cand_dir in os.listdir("/tmp"):
if cand_dir.startswith("fpalgos"):
bag_path = os.path.join("/tmp", cand_dir)
pd = ProblemDescription.from_rosbag_path(bag_path)

fig, ax = plt.subplots()
plot_problem(pd, ax)
fig.tight_layout()
file_name = bag_path + "-plot.png"

file_name = os.path.join("/tmp", cand_dir + "-plot.png")
plt.savefig(file_name)
print("saved to {}".format(file_name))
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ TEST(AstarSearchTestSuite, SingleCurvature)
for (size_t i = 0; i < goal_xs.size(); i++) {
std::array<double, 3> start{6., 4., 0.5 * 3.1415};
std::array<double, 3> goal{goal_xs[i], 4., 0.5 * 3.1415};
std::string dir_name = "/tmp/result_single" + std::to_string(i);
std::string dir_name = "/tmp/fpalgos-result_single" + std::to_string(i);
EXPECT_TRUE(test_astar(start, goal, dir_name));
}
}
Expand All @@ -222,7 +222,7 @@ TEST(AstarSearchTestSuite, MultiCurvature)
for (size_t i = 0; i < goal_xs.size(); i++) {
std::array<double, 3> start{6., 4., 0.5 * 3.1415};
std::array<double, 3> goal{goal_xs[i], 4., 0.5 * 3.1415};
std::string dir_name = "/tmp/result_multi" + std::to_string(i);
std::string dir_name = "/tmp/fpalgos-result_multi" + std::to_string(i);
EXPECT_TRUE(test_astar(start, goal, dir_name, maximum_turning_radius, turning_radius_size));
}
}
Expand Down

0 comments on commit 5dbd9f5

Please sign in to comment.