61 if (node->has_parameter(
"benchmark_config.parameters.name"))
64 node->get_parameter_or(std::string(
"benchmark_config.warehouse.host"),
hostname, std::string(
"127.0.0.1"));
65 node->get_parameter_or(std::string(
"benchmark_config.warehouse.port"),
port, 33829);
67 if (!node->get_parameter(
"benchmark_config.warehouse.scene_name",
scene_name))
69 RCLCPP_WARN(getLogger(),
"Benchmark scene_name NOT specified");
72 RCLCPP_INFO(getLogger(),
"Benchmark host: %s",
hostname.c_str());
73 RCLCPP_INFO(getLogger(),
"Benchmark port: %d",
port);
74 RCLCPP_INFO(getLogger(),
"Benchmark scene: %s",
scene_name.c_str());
76 node->get_parameter_or(std::string(
"benchmark_config.parameters.name"),
benchmark_name, std::string(
""));
77 node->get_parameter_or(std::string(
"benchmark_config.parameters.runs"),
runs, 10);
78 node->get_parameter_or(std::string(
"benchmark_config.parameters.timeout"),
timeout, 10.0);
79 node->get_parameter_or(std::string(
"benchmark_config.parameters.output_directory"),
output_directory,
81 node->get_parameter_or(std::string(
"benchmark_config.parameters.queries_regex"),
query_regex, std::string(
".*"));
82 node->get_parameter_or(std::string(
"benchmark_config.parameters.start_states_regex"),
start_state_regex,
84 node->get_parameter_or(std::string(
"benchmark_config.parameters.goal_constraints_regex"),
goal_constraint_regex,
86 node->get_parameter_or(std::string(
"benchmark_config.parameters.path_constraints_regex"),
path_constraint_regex,
88 node->get_parameter_or(std::string(
"benchmark_config.parameters.trajectory_constraints_regex"),
90 node->get_parameter_or(std::string(
"benchmark_config.parameters.predefined_poses"),
predefined_poses, {});
91 node->get_parameter_or(std::string(
"benchmark_config.parameters.predefined_poses_group"),
predefined_poses_group,
94 if (!node->get_parameter(std::string(
"benchmark_config.parameters.group"),
group_name))
96 RCLCPP_WARN(getLogger(),
"Benchmark group NOT specified");
99 if (node->has_parameter(
"benchmark_config.parameters.workspace"))
103 if (!node->get_parameter(
"benchmark_config.parameters.workspace.frame_id",
workspace.header.frame_id))
105 RCLCPP_WARN(getLogger(),
"Workspace frame_id not specified in benchmark config");
108 node->get_parameter_or(std::string(
"benchmark_config.parameters.workspace.min_corner.x"),
workspace.min_corner.x,
110 node->get_parameter_or(std::string(
"benchmark_config.parameters.workspace.min_corner.y"),
workspace.min_corner.y,
112 node->get_parameter_or(std::string(
"benchmark_config.parameters.workspace.min_corner.z"),
workspace.min_corner.z,
115 node->get_parameter_or(std::string(
"benchmark_config.parameters.workspace.max_corner.x"),
workspace.max_corner.x,
117 node->get_parameter_or(std::string(
"benchmark_config.parameters.workspace.max_corner.y"),
workspace.max_corner.y,
119 node->get_parameter_or(std::string(
"benchmark_config.parameters.workspace.max_corner.z"),
workspace.max_corner.z,
122 workspace.header.stamp = rclcpp::Clock().now();
126 node->get_parameter_or(std::string(
"benchmark_config.parameters.goal_offset.x"),
goal_offsets.at(0), 0.0);
127 node->get_parameter_or(std::string(
"benchmark_config.parameters.goal_offset.y"),
goal_offsets.at(1), 0.0);
128 node->get_parameter_or(std::string(
"benchmark_config.parameters.goal_offset.z"),
goal_offsets.at(2), 0.0);
129 node->get_parameter_or(std::string(
"benchmark_config.parameters.goal_offset.roll"),
goal_offsets.at(3), 0.0);
130 node->get_parameter_or(std::string(
"benchmark_config.parameters.goal_offset.pitch"),
goal_offsets.at(4), 0.0);
131 node->get_parameter_or(std::string(
"benchmark_config.parameters.goal_offset.yaw"),
goal_offsets.at(5), 0.0);
133 RCLCPP_INFO(getLogger(),
"Benchmark name: '%s'",
benchmark_name.c_str());
134 RCLCPP_INFO(getLogger(),
"Benchmark #runs: %d",
runs);
135 RCLCPP_INFO(getLogger(),
"Benchmark timeout: %f secs",
timeout);
136 RCLCPP_INFO(getLogger(),
"Benchmark group: %s",
group_name.c_str());
137 RCLCPP_INFO(getLogger(),
"Benchmark query regex: '%s'",
query_regex.c_str());
138 RCLCPP_INFO(getLogger(),
"Benchmark start state regex: '%s':",
start_state_regex.c_str());
143 RCLCPP_INFO(getLogger(),
"Benchmark output directory: %s",
output_directory.c_str());
144 RCLCPP_INFO_STREAM(getLogger(),
"Benchmark workspace: min_corner: ["
148 <<
", " <<
workspace.max_corner.z <<
']');
157 RCLCPP_ERROR(getLogger(),
"No benchmark_config found on param server");
174 const std::string ns =
"benchmark_config.planning_pipelines";
178 std::vector<std::string> pipelines;
179 if (!node->get_parameter(ns +
".pipelines", pipelines))
181 RCLCPP_WARN(getLogger(),
"No single planning pipeline namespace `%s` configured.", (ns +
".pipelines").c_str());
184 for (
const std::string& pipeline : pipelines)
186 if (!pipeline.empty())
188 std::string pipeline_name;
189 const std::string pipeline_parameter_name = std::string(ns).append(
".").append(pipeline).append(
".name");
190 if (!node->get_parameter(pipeline_parameter_name, pipeline_name))
192 RCLCPP_ERROR(getLogger(),
"Fail to get the parameter in `%s` namespace.", pipeline_parameter_name.c_str());
196 RCLCPP_INFO(getLogger(),
"Reading in planner names for planning pipeline '%s'", pipeline_name.c_str());
198 std::vector<std::string> planners;
199 const std::string pipeline_parameter_planners = std::string(ns).append(
".").append(pipeline).append(
".planners");
200 if (!node->get_parameter(pipeline_parameter_planners, planners))
202 RCLCPP_ERROR(getLogger(),
"Fail to get the parameter in `%s` namespace.", pipeline_parameter_planners.c_str());
206 for (
const std::string& planner : planners)
208 RCLCPP_INFO(getLogger(),
" %s", planner.c_str());
217 std::vector<std::string> parallel_pipelines;
218 if (!node->get_parameter(ns +
".parallel_pipelines", parallel_pipelines))
220 RCLCPP_WARN(getLogger(),
"No parallel planning pipeline namespace `%s` configured.",
221 (ns +
".parallel_pipelines").c_str());
224 for (
const std::string& parallel_pipeline : parallel_pipelines)
226 if (!parallel_pipeline.empty())
228 RCLCPP_INFO(getLogger(),
"Reading in parameters for parallel planning pipeline '%s'", parallel_pipeline.c_str());
231 std::vector<std::string> pipelines;
232 const std::string pipelines_parameter =
233 std::string(ns).append(
".").append(parallel_pipeline).append(
".pipelines");
234 if (!node->get_parameter(pipelines_parameter, pipelines))
236 RCLCPP_ERROR(getLogger(),
"Fail to get the parameter in `%s` namespace.", pipelines_parameter.c_str());
241 std::vector<std::string> planner_ids;
242 const std::string pipeline_planner_ids_parameter =
243 std::string(ns).append(
".").append(parallel_pipeline).append(
".planner_ids");
244 if (!node->get_parameter(pipeline_planner_ids_parameter, planner_ids))
246 RCLCPP_ERROR(getLogger(),
"Fail to get the parameter in `%s` namespace.",
247 pipeline_planner_ids_parameter.c_str());
251 if (pipelines.size() != planner_ids.size())
253 RCLCPP_ERROR(getLogger(),
"Number of planner ids is unequal to the number of pipelines in %s.",
254 parallel_pipeline.c_str());
258 std::vector<std::pair<std::string, std::string>> pipeline_planner_id_pairs;
259 for (
size_t i = 0; i < pipelines.size(); ++i)
261 pipeline_planner_id_pairs.push_back(std::pair<std::string, std::string>(pipelines.at(i), planner_ids.at(i)));
268 RCLCPP_INFO(getLogger(),
"Parallel planning pipeline '%s'", entry.first.c_str());
269 for (
const auto& pair : entry.second)
271 RCLCPP_INFO(getLogger(),
" '%s': '%s'", pair.first.c_str(), pair.second.c_str());
276 if (pipelines.empty() && parallel_pipelines.empty())
278 RCLCPP_ERROR(getLogger(),
"No single or parallel planning pipelines configured for benchmarking.");