Bench-MR
A Motion Planning Benchmark for Wheeled Mobile Robots
GRIPS.h
Go to the documentation of this file.
1#pragma once
2#include <chrono>
3#include <fstream>
4#include <params.hpp>
5
11
12using namespace params;
13class GRIPS {
14 public:
16
17 struct RoundStats : public Group {
18 Property<double> path_length{std::numeric_limits<double>::quiet_NaN(),
19 "path_length", this};
20 Property<double> max_curvature{std::numeric_limits<double>::quiet_NaN(),
21 "max_curvature", this};
22 Property<double> time{std::numeric_limits<double>::quiet_NaN(), "time",
23 this};
24 Property<int> nodes{-1, "nodes", this};
26 std::numeric_limits<double>::quiet_NaN(),
27 "median_node_obstacle_distance", this};
29 std::numeric_limits<double>::quiet_NaN(), "mean_node_obstacle_distance",
30 this};
32 std::numeric_limits<double>::quiet_NaN(), "min_node_obstacle_distance",
33 this};
35 std::numeric_limits<double>::quiet_NaN(), "max_node_obstacle_distance",
36 this};
38 std::numeric_limits<double>::quiet_NaN(), "std_node_obstacle_distance",
39 this};
41 std::numeric_limits<double>::quiet_NaN(),
42 "median_traj_obstacle_distance", this};
44 std::numeric_limits<double>::quiet_NaN(), "mean_traj_obstacle_distance",
45 this};
47 std::numeric_limits<double>::quiet_NaN(), "min_traj_obstacle_distance",
48 this};
50 std::numeric_limits<double>::quiet_NaN(), "max_traj_obstacle_distance",
51 this};
53 std::numeric_limits<double>::quiet_NaN(), "std_traj_obstacle_distance",
54 this};
55 Property<RoundType> type{ROUND_UNKOWN, "type", this};
57
58 std::string typeName() const {
59 switch (type.value()) {
60 case ROUND_GD:
61 return "gd";
62 case ROUND_PRUNING:
63 return "pruning";
64 case ROUND_ORIGINAL:
65 return "original";
66 default:
67 return "unknown";
68 }
69 }
70
71 RoundStats() : Group("round") {}
72 };
73
74 static int insertedNodes;
75 static int pruningRounds;
76 static std::vector<int> nodesPerRound;
77 static std::vector<RoundStats> statsPerRound;
78 static double smoothingTime;
79
80 static bool smooth(ompl::geometric::PathGeometric &path,
81 const std::vector<Point> &originalPathIntermediaries);
82
83 static bool smooth(ompl::geometric::PathGeometric &path) {
84 auto intermediary = ompl::geometric::PathGeometric(path);
85 OMPL_DEBUG("GRIPS path has %d node(s).", path.getStateCount());
86 return smooth(path, Point::fromPath(intermediary));
87 }
88
89 private:
90 static RoundStats roundStats;
91
92 static void beginRound(RoundType type = ROUND_UNKOWN);
93 static void endRound(const ompl::geometric::PathGeometric &path);
94
95 static Stopwatch stopWatch;
96};
Definition: GRIPS.h:13
static bool smooth(ompl::geometric::PathGeometric &path)
Definition: GRIPS.h:83
static std::vector< int > nodesPerRound
Definition: GRIPS.h:76
static int insertedNodes
Definition: GRIPS.h:74
RoundType
Definition: GRIPS.h:15
@ ROUND_PRUNING
Definition: GRIPS.h:15
@ ROUND_UNKOWN
Definition: GRIPS.h:15
@ ROUND_GD
Definition: GRIPS.h:15
@ ROUND_ORIGINAL
Definition: GRIPS.h:15
static bool smooth(ompl::geometric::PathGeometric &path, const std::vector< Point > &originalPathIntermediaries)
Definition: GRIPS.cpp:17
static int pruningRounds
Definition: GRIPS.h:75
static std::vector< RoundStats > statsPerRound
Definition: GRIPS.h:77
static double smoothingTime
Definition: GRIPS.h:78
Stopwatch implementation to measure elapsed time.
Definition: Stopwatch.hpp:8
Definition: TimedResult.hpp:9
Definition: GRIPS.h:17
Property< double > std_traj_obstacle_distance
Definition: GRIPS.h:52
Property< double > max_node_obstacle_distance
Definition: GRIPS.h:34
Property< double > path_length
Definition: GRIPS.h:18
Property< int > nodes
Definition: GRIPS.h:24
std::string typeName() const
Definition: GRIPS.h:58
Property< double > median_traj_obstacle_distance
Definition: GRIPS.h:40
Property< double > std_node_obstacle_distance
Definition: GRIPS.h:37
TimedResult stopWatch
Definition: GRIPS.h:56
Property< double > mean_traj_obstacle_distance
Definition: GRIPS.h:43
Property< double > median_node_obstacle_distance
Definition: GRIPS.h:25
Property< RoundType > type
Definition: GRIPS.h:55
Property< double > min_traj_obstacle_distance
Definition: GRIPS.h:46
Property< double > max_curvature
Definition: GRIPS.h:20
Property< double > time
Definition: GRIPS.h:22
Property< double > min_node_obstacle_distance
Definition: GRIPS.h:31
RoundStats()
Definition: GRIPS.h:71
Property< double > max_traj_obstacle_distance
Definition: GRIPS.h:49
Property< double > mean_node_obstacle_distance
Definition: GRIPS.h:28
static std::vector< Point > fromPath(const ompl::geometric::PathGeometric &p, bool interpolate=false)
Definition: Primitives.cpp:25