41 static const rclcpp::Logger
LOGGER = rclcpp::get_logger(
"moveit.ros.benchmarks.BenchmarkOptions");
61 if (node->has_parameter(
"benchmark_config.parameters.name"))
69 RCLCPP_WARN(LOGGER,
"No benchmark_config found on param server");
161 planning_pipeline_names.clear();
178 node->get_parameter_or(std::string(
"benchmark_config.warehouse.host"),
hostname_, std::string(
"127.0.0.1"));
179 node->get_parameter_or(std::string(
"benchmark_config.warehouse.port"),
port_, 33829);
181 if (!node->get_parameter(
"benchmark_config.warehouse.scene_name",
scene_name_))
182 RCLCPP_WARN(LOGGER,
"Benchmark scene_name NOT specified");
184 RCLCPP_INFO(LOGGER,
"Benchmark host: %s",
hostname_.c_str());
185 RCLCPP_INFO(LOGGER,
"Benchmark port: %d",
port_);
186 RCLCPP_INFO(LOGGER,
"Benchmark scene: %s",
scene_name_.c_str());
191 node->get_parameter_or(std::string(
"benchmark_config.parameters.name"),
benchmark_name_, std::string(
""));
192 node->get_parameter_or(std::string(
"benchmark_config.parameters.runs"),
runs_, 10);
193 node->get_parameter_or(std::string(
"benchmark_config.parameters.timeout"),
timeout_, 10.0);
194 node->get_parameter_or(std::string(
"benchmark_config.parameters.output_directory"),
output_directory_,
196 node->get_parameter_or(std::string(
"benchmark_config.parameters.queries"),
query_regex_, std::string(
".*"));
197 node->get_parameter_or(std::string(
"benchmark_config.parameters.start_states"),
start_state_regex_, std::string(
""));
198 node->get_parameter_or(std::string(
"benchmark_config.parameters.goal_constraints"),
goal_constraint_regex_,
200 node->get_parameter_or(std::string(
"benchmark_config.parameters.path_constraints"),
path_constraint_regex_,
202 node->get_parameter_or(std::string(
"benchmark_config.parameters.trajectory_constraints"),
204 node->get_parameter_or(std::string(
"benchmark_config.parameters.predefined_poses"),
predefined_poses_, {});
205 node->get_parameter_or(std::string(
"benchmark_config.parameters.predefined_poses_group"),
predefined_poses_group_,
208 if (!node->get_parameter(std::string(
"benchmark_config.parameters.group"),
group_name_))
209 RCLCPP_INFO(LOGGER,
"Benchmark group NOT specified");
211 if (node->has_parameter(
"benchmark_config.parameters.workspace"))
215 node->get_parameter_or(std::string(
"benchmark_config.parameters.goal_offset.x"),
goal_offsets[0], 0.0);
216 node->get_parameter_or(std::string(
"benchmark_config.parameters.goal_offset.y"),
goal_offsets[1], 0.0);
217 node->get_parameter_or(std::string(
"benchmark_config.parameters.goal_offset.z"),
goal_offsets[2], 0.0);
218 node->get_parameter_or(std::string(
"benchmark_config.parameters.goal_offset.roll"),
goal_offsets[3], 0.0);
219 node->get_parameter_or(std::string(
"benchmark_config.parameters.goal_offset.pitch"),
goal_offsets[4], 0.0);
220 node->get_parameter_or(std::string(
"benchmark_config.parameters.goal_offset.yaw"),
goal_offsets[5], 0.0);
223 RCLCPP_INFO(LOGGER,
"Benchmark #runs: %d",
runs_);
224 RCLCPP_INFO(LOGGER,
"Benchmark timeout: %f secs",
timeout_);
225 RCLCPP_INFO(LOGGER,
"Benchmark group: %s",
group_name_.c_str());
226 RCLCPP_INFO(LOGGER,
"Benchmark query regex: '%s'",
query_regex_.c_str());
227 RCLCPP_INFO(LOGGER,
"Benchmark start state regex: '%s':",
start_state_regex_.c_str());
232 RCLCPP_INFO(LOGGER,
"Benchmark output directory: %s",
output_directory_.c_str());
233 RCLCPP_INFO_STREAM(LOGGER,
"Benchmark workspace: min_corner: ["
243 if (!node->get_parameter(
"benchmark_config.parameters.workspace.frame_id",
workspace_.header.frame_id))
244 RCLCPP_WARN(LOGGER,
"Workspace frame_id not specified in benchmark config");
246 node->get_parameter_or(std::string(
"benchmark_config.parameters.workspace.min_corner.x"),
workspace_.min_corner.x,
248 node->get_parameter_or(std::string(
"benchmark_config.parameters.workspace.min_corner.y"),
workspace_.min_corner.y,
250 node->get_parameter_or(std::string(
"benchmark_config.parameters.workspace.min_corner.z"),
workspace_.min_corner.z,
253 node->get_parameter_or(std::string(
"benchmark_config.parameters.workspace.max_corner.x"),
workspace_.max_corner.x,
255 node->get_parameter_or(std::string(
"benchmark_config.parameters.workspace.max_corner.y"),
workspace_.max_corner.y,
257 node->get_parameter_or(std::string(
"benchmark_config.parameters.workspace.max_corner.z"),
workspace_.max_corner.z,
260 workspace_.header.stamp = rclcpp::Clock().now();
267 const std::string np =
"benchmark_config.planning_pipelines";
268 std::vector<std::string> pipelines;
269 if (!node->get_parameter(np +
".pipelines", pipelines))
271 RCLCPP_ERROR(LOGGER,
"Fail to get the parameter in `%s` namespace.", (np +
".pipelines").c_str());
275 for (
const std::string& pipeline : pipelines)
277 std::string pipeline_name;
278 const std::string pipeline_parameter_name = std::string(np).append(
".").append(pipeline).append(
".name");
279 if (!node->get_parameter(pipeline_parameter_name, pipeline_name))
281 RCLCPP_ERROR(LOGGER,
"Fail to get the parameter in `%s` namespace.", pipeline_parameter_name.c_str());
285 RCLCPP_INFO(LOGGER,
"Reading in planner names for planning pipeline '%s'", pipeline_name.c_str());
287 std::vector<std::string> planners;
288 if (!node->get_parameter(pipeline_parameter_name, planners))
290 RCLCPP_ERROR(LOGGER,
"Fail to get the parameter in `%s` namespace.", pipeline_parameter_name.c_str());
294 for (
const std::string& planner : planners)
295 RCLCPP_INFO(LOGGER,
" %s", planner.c_str());
const moveit_msgs::msg::WorkspaceParameters & getWorkspaceParameters() const
const std::string & getPathConstraintRegex() const
Get the regex expression for matching the names of all path constraints to plan with.
const std::map< std::string, std::vector< std::string > > & getPlanningPipelineConfigurations() const
Get all planning pipeline names mapped to their parameter configuration.
std::vector< std::string > predefined_poses_
virtual ~BenchmarkOptions()
Destructor.
const std::string & getBenchmarkName() const
Get the reference name of the benchmark.
int getNumRuns() const
Get the specified number of benchmark query runs.
double getTimeout() const
Get the maximum timeout per planning attempt.
std::string predefined_poses_group_
std::string path_constraint_regex_
const std::string & getHostName() const
Set the ROS namespace the node handle should use for parameter lookup.
void readWorkspaceParameters(const rclcpp::Node::SharedPtr &node)
void readBenchmarkParameters(const rclcpp::Node::SharedPtr &node)
std::string output_directory_
std::string start_state_regex_
void readBenchmarkOptions(const rclcpp::Node::SharedPtr &node)
std::string goal_constraint_regex_
moveit_msgs::msg::WorkspaceParameters workspace_
void getPlanningPipelineNames(std::vector< std::string > &planning_pipeline_names) const
Get all planning pipeline names.
int getPort() const
Get the port of the warehouse database host server.
void getGoalOffsets(std::vector< double > &offsets) const
Get the constant position/orientation offset to be used for shifting all goal constraints.
const std::string & getQueryRegex() const
Get the regex expression for matching the names of all queries to run.
std::string trajectory_constraint_regex_
const std::vector< std::string > & getPredefinedPoses() const
Get the names of all predefined poses to consider for planning.
BenchmarkOptions()
Constructor.
std::map< std::string, std::vector< std::string > > planning_pipelines_
planner configurations
const std::string & getGroupName() const
Get the name of the planning group to run the benchmark with.
const std::string & getWorkspaceFrameID() const
const std::string & getPredefinedPosesGroup() const
Get the name of the planning group for which the predefined poses are defined.
const std::string & getGoalConstraintRegex() const
Get the regex expression for matching the names of all goal constraints to plan to.
void readWarehouseOptions(const rclcpp::Node::SharedPtr &node)
int runs_
benchmark parameters
const std::string & getStartStateRegex() const
Get the regex expression for matching the names of all start states to plan from.
const std::string & getSceneName() const
Get the reference name of the planning scene stored inside the warehouse database.
std::string benchmark_name_
void readPlannerConfigs(const rclcpp::Node::SharedPtr &node)
std::string hostname_
warehouse parameters
const std::string & getOutputDirectory() const
Get the target directory for the generated benchmark result data.
const std::string & getTrajectoryConstraintRegex() const
Get the regex expression for matching the names of all trajectory constraints to plan with.
const rclcpp::Logger LOGGER