51int main(
int argc,
char** argv)
53 rclcpp::init(argc, argv);
54 rclcpp::NodeOptions node_options;
55 node_options.allow_undeclared_parameters(
true);
56 node_options.automatically_declare_parameters_from_overrides(
true);
57 rclcpp::Node::SharedPtr node = rclcpp::Node::make_shared(
"moveit_run_benchmark", node_options);
65 std::vector<std::string> planning_pipelines;
66 options.getPlanningPipelineNames(planning_pipelines);
69 RCLCPP_ERROR(node->get_logger(),
"Failed to initialize benchmark server.");
74 if (options.scene_name.empty())
76 std::vector<std::string> scene_names;
79 warehouse_ros::DatabaseLoader db_loader(node);
80 warehouse_ros::DatabaseConnection::Ptr warehouse_connection = db_loader.loadDatabase();
81 warehouse_connection->setParams(options.hostname, options.port, 20);
82 if (warehouse_connection->connect())
85 planning_scene_storage.getPlanningSceneNames(scene_names);
86 RCLCPP_INFO(node->get_logger(),
"Loaded scene names");
90 RCLCPP_ERROR(node->get_logger(),
"Failed to load scene names from DB");
95 catch (std::exception& e)
97 RCLCPP_ERROR(node->get_logger(),
"Failed to load scene names from DB: '%s'", e.what());
102 for (
const auto& name : scene_names)
104 options.scene_name = name;
107 RCLCPP_ERROR(node->get_logger(),
"Failed to run all benchmarks");
115 RCLCPP_ERROR(node->get_logger(),
"Failed to run all benchmarks");
119 RCLCPP_INFO(node->get_logger(),
"Finished benchmarking");