Skip to content

Commit 7ba7330

Browse files
committed
introspection *can* be disabled
Otherwise a new task will always setup the publisher, even if introspection is disabled afterwards. It is a good idea to keep introspection on, but there should be a way to initialize the C++ classes without ROS communication.
1 parent e8191bf commit 7ba7330

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

core/include/moveit/task_constructor/task.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Task : protected WrapperBase
7878
createPlanner(const moveit::core::RobotModelConstPtr& model, const std::string& ns = "move_group",
7979
const std::string& planning_plugin_param_name = "planning_plugin",
8080
const std::string& adapter_plugins_param_name = "request_adapters");
81-
Task(const std::string& id = "",
81+
Task(const std::string& id = "", bool introspection = true,
8282
ContainerBase::pointer&& container = std::make_unique<SerialContainer>("task pipeline"));
8383
Task(Task&& other); // NOLINT(performance-noexcept-move-constructor)
8484
Task& operator=(Task&& other); // NOLINT(performance-noexcept-move-constructor)

core/src/task.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ const ContainerBase* TaskPrivate::stages() const {
104104
return children().empty() ? nullptr : static_cast<ContainerBase*>(children().front().get());
105105
}
106106

107-
Task::Task(const std::string& id, ContainerBase::pointer&& container)
107+
Task::Task(const std::string& id, bool introspection, ContainerBase::pointer&& container)
108108
: WrapperBase(new TaskPrivate(this, id), std::move(container)) {
109109
if (!id.empty())
110110
stages()->setName(id);
111111

112112
// monitor state on commandline
113113
// addTaskCallback(std::bind(&Task::printState, this, std::ref(std::cout)));
114114
// enable introspection by default, but only if ros::init() was called
115-
if (ros::isInitialized())
115+
if (ros::isInitialized() && introspection)
116116
enableIntrospection(true);
117117
}
118118

visualization/motion_planning_tasks/src/local_task_model.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ QModelIndex LocalTaskModel::index(Node* n) const {
7979

8080
LocalTaskModel::LocalTaskModel(ContainerBase::pointer&& container, const planning_scene::PlanningSceneConstPtr& scene,
8181
rviz::DisplayContext* display_context, QObject* parent)
82-
: BaseTaskModel(scene, display_context, parent), Task("", std::move(container)) {
82+
: BaseTaskModel(scene, display_context, parent), Task("", true, std::move(container)) {
8383
root_ = this;
8484
flags_ |= LOCAL_MODEL;
8585
}

0 commit comments

Comments
 (0)