Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor improvements and debug info in task composer #378

Merged
merged 2 commits into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion tesseract_task_composer/core/src/task_composer_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,15 @@ TaskComposerGraph::TaskComposerGraph(std::string name,
throw std::runtime_error("Task Composer Graph '" + name_ + "' edge is missing 'source' entry");

if (YAML::Node n = edge["destinations"])
destinations = n.as<std::vector<std::string>>();
{
if (n.IsSequence())
destinations = n.as<std::vector<std::string>>();
else if (n.IsScalar())
destinations.push_back(n.as<std::string>());
else
throw std::runtime_error("Task Composer Graph '" + name_ +
"' entry 'destinations' must be a scalar or sequence");
}
else
throw std::runtime_error("Task Composer Graph '" + name_ + "' edge is missing 'destinations' entry");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <tesseract_task_composer/taskflow/taskflow_task_composer_executor.h>
#include <tesseract_task_composer/taskflow/taskflow_task_composer_future.h>
#include <tesseract_common/utils.h>
#include <taskflow/taskflow.hpp>

namespace tesseract_planning
Expand Down Expand Up @@ -80,10 +81,13 @@ TaskComposerFuture::UPtr TaskflowTaskComposerExecutor::run(const TaskComposerNod
else
throw std::runtime_error("TaskComposerExecutor, unsupported node type!");

// std::ofstream out_data;
// out_data.open(tesseract_common::getTempPath() + "task_composer_example.dot");
// taskflow.top->dump(out_data); // dump the graph including dynamic tasks
// out_data.close();
#ifndef NDEBUG
std::ofstream out_data;
out_data.open(tesseract_common::getTempPath() + "taskflow_task_executor_" + tesseract_common::getTimestampString() +
".dot");
taskflow->front()->dump(out_data); // dump the graph including dynamic tasks
out_data.close();
#endif

std::shared_future<void> f = executor_->run(*(taskflow->front()));
return std::make_unique<TaskflowTaskComposerFuture>(f, std::move(taskflow));
Expand Down
Loading