Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
sjahr committed Oct 12, 2023
1 parent 3b0f51f commit b53a5f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ namespace
*/
template <class TAdapter>
[[nodiscard]] bool callAdapterChain(const std::vector<TAdapter>& adapter_vector,
const planning_scene::PlanningSceneConstPtr& planning_scene,
planning_interface::MotionPlanRequest& req,
planning_interface::MotionPlanResponse& res, const rclcpp::Logger& logger)
const planning_scene::PlanningSceneConstPtr& planning_scene,
planning_interface::MotionPlanRequest& req,
planning_interface::MotionPlanResponse& res, const rclcpp::Logger& logger)
{
for (const auto& adapter : adapter_vector)
{
assert(adapter);
RCLCPP_INFO(logger, "Calling PlanningAdapter '%s'", adapter->getDescription().c_str());
// If adapter does not succeed, break chain and return false
if (!adapter->adapt(planning_scene, req, res))
Expand All @@ -97,9 +98,9 @@ template <class TAdapter>
*/
template <class TPluginClass>
void loadPluginVector(const std::shared_ptr<rclcpp::Node>& node,
const std::unique_ptr<pluginlib::ClassLoader<TPluginClass>>& plugin_loader,
std::vector<std::shared_ptr<const TPluginClass>>& plugin_vector,
const std::vector<std::string>& plugin_names, const std::string& parameter_namespace)
const std::unique_ptr<pluginlib::ClassLoader<TPluginClass>>& plugin_loader,
std::vector<std::shared_ptr<const TPluginClass>>& plugin_vector,
const std::vector<std::string>& plugin_names, const std::string& parameter_namespace)
{
// Try loading a plugin for each plugin name
for (const std::string& plugin_name : plugin_names)
Expand Down Expand Up @@ -127,7 +128,6 @@ void loadPluginVector(const std::shared_ptr<rclcpp::Node>& node,
{
RCLCPP_WARN(node->get_logger(), "Failed to load adapter '%s'", plugin_name.c_str());
}
plugin_vector.push_back(std::move(adapter));
}
};
} // namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,9 @@ bool planning_pipeline::PlanningPipeline::generatePlan(const planning_scene::Pla
planning_interface::MotionPlanRequest mutable_request = req;
try
{
RCLCPP_INFO(LOGGER, "Let's plan");
// Call plan request adapter chain
if (!planning_request_adapter_vector_.empty())
{
RCLCPP_INFO(LOGGER, "Call plan request adapter chain");
solved = callAdapterChain<planning_interface::PlanningRequestAdapterConstPtr>(
planning_request_adapter_vector_, planning_scene, mutable_request, res, node_->get_logger());
}
Expand All @@ -235,7 +233,6 @@ bool planning_pipeline::PlanningPipeline::generatePlan(const planning_scene::Pla
// Call plan response adapter chain
if (solved)
{
RCLCPP_INFO(LOGGER, "Call plan response adapter chain");
if (!planning_request_adapter_vector_.empty())
{
solved = callAdapterChain<planning_interface::PlanningResponseAdapterConstPtr>(
Expand Down

0 comments on commit b53a5f6

Please sign in to comment.