diff --git a/tesseract_task_composer/README.rst b/tesseract_task_composer/README.rst index 361fbe1af0..37311870be 100644 --- a/tesseract_task_composer/README.rst +++ b/tesseract_task_composer/README.rst @@ -476,7 +476,7 @@ The final task that is called in a task graph if successful Error Task ^^^^^^^^^^ -The final task that is called in a task graph if error occurs +The final task that is called in a task graph if error occurs. Also can add `trigger_abort: true` if it should abort when this task is reached. .. code-block:: yaml @@ -485,18 +485,6 @@ The final task that is called in a task graph if error occurs config: conditional: false -Abort Task -^^^^^^^^^^ - -The task that is called if you want to abort everything - -.. code-block:: yaml - - AbortTask: - class: AbortTaskFactory - config: - conditional: false - Sync Task ^^^^^^^^^ diff --git a/tesseract_task_composer/core/CMakeLists.txt b/tesseract_task_composer/core/CMakeLists.txt index 65a4f8fd78..e03fafa1c2 100644 --- a/tesseract_task_composer/core/CMakeLists.txt +++ b/tesseract_task_composer/core/CMakeLists.txt @@ -38,7 +38,6 @@ target_include_directories(${PROJECT_NAME} PUBLIC "$ -TESSERACT_COMMON_IGNORE_WARNINGS_PUSH -#include -TESSERACT_COMMON_IGNORE_WARNINGS_POP - -#include - -namespace tesseract_planning -{ -class TaskComposerPluginFactory; -class AbortTask : public TaskComposerTask -{ -public: - using Ptr = std::shared_ptr; - using ConstPtr = std::shared_ptr; - using UPtr = std::unique_ptr; - using ConstUPtr = std::unique_ptr; - - AbortTask(); - explicit AbortTask(std::string name, bool conditional); - explicit AbortTask(std::string name, const YAML::Node& config, const TaskComposerPluginFactory& plugin_factory); - ~AbortTask() override = default; - - bool operator==(const AbortTask& rhs) const; - bool operator!=(const AbortTask& rhs) const; - -protected: - friend struct tesseract_common::Serialization; - friend class boost::serialization::access; - template - void serialize(Archive& ar, const unsigned int version); // NOLINT - - TaskComposerNodeInfo::UPtr runImpl(TaskComposerContext& context, - OptionalTaskComposerExecutor executor = std::nullopt) const override final; -}; - -} // namespace tesseract_planning - -#include -BOOST_CLASS_EXPORT_KEY2(tesseract_planning::AbortTask, "AbortTask") - -#endif // TESSERACT_TASK_COMPOSER_ABORT_TASK_H diff --git a/tesseract_task_composer/core/src/nodes/abort_task.cpp b/tesseract_task_composer/core/src/nodes/abort_task.cpp deleted file mode 100644 index 5769251cfb..0000000000 --- a/tesseract_task_composer/core/src/nodes/abort_task.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @file abort_task.cpp - * - * @author Levi Armstrong - * @date June 22, 2023 - * @version TODO - * @bug No known bugs - * - * @copyright Copyright (c) 2023, Levi Armstrong - * - * @par License - * Software License Agreement (Apache License) - * @par - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * @par - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -TESSERACT_COMMON_IGNORE_WARNINGS_PUSH -#include -#include -TESSERACT_COMMON_IGNORE_WARNINGS_POP - -#include - -namespace tesseract_planning -{ -AbortTask::AbortTask() : TaskComposerTask("AbortTask", false) {} -AbortTask::AbortTask(std::string name, bool is_conditional) : TaskComposerTask(std::move(name), is_conditional) {} -AbortTask::AbortTask(std::string name, const YAML::Node& config, const TaskComposerPluginFactory& /*plugin_factory*/) - : TaskComposerTask(std::move(name), config) -{ -} - -TaskComposerNodeInfo::UPtr AbortTask::runImpl(TaskComposerContext& context, - OptionalTaskComposerExecutor /*executor*/) const -{ - auto info = std::make_unique(*this); - info->color = "red"; - info->return_value = 0; - info->message = "Aborted"; - context.abort(uuid_); - CONSOLE_BRIDGE_logDebug("%s", info->message.c_str()); - return info; -} - -bool AbortTask::operator==(const AbortTask& rhs) const { return (TaskComposerTask::operator==(rhs)); } -bool AbortTask::operator!=(const AbortTask& rhs) const { return !operator==(rhs); } - -template -void AbortTask::serialize(Archive& ar, const unsigned int /*version*/) -{ - ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(TaskComposerTask); -} - -} // namespace tesseract_planning - -#include -TESSERACT_SERIALIZE_ARCHIVES_INSTANTIATE(tesseract_planning::AbortTask) -BOOST_CLASS_EXPORT_IMPLEMENT(tesseract_planning::AbortTask) diff --git a/tesseract_task_composer/core/src/task_composer_task_plugin_factory.cpp b/tesseract_task_composer/core/src/task_composer_task_plugin_factory.cpp index aa597d347f..9967b53b2e 100644 --- a/tesseract_task_composer/core/src/task_composer_task_plugin_factory.cpp +++ b/tesseract_task_composer/core/src/task_composer_task_plugin_factory.cpp @@ -29,7 +29,6 @@ #include #include -#include #include #include #include @@ -39,7 +38,6 @@ namespace tesseract_planning { -using AbortTaskFactory = TaskComposerTaskFactory; using DoneTaskFactory = TaskComposerTaskFactory; using ErrorTaskFactory = TaskComposerTaskFactory; using RemapTaskFactory = TaskComposerTaskFactory; @@ -59,8 +57,6 @@ namespace tesseract_planning::test_suite using TestTaskFactory = TaskComposerTaskFactory; } -// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) -TESSERACT_ADD_TASK_COMPOSER_NODE_PLUGIN(tesseract_planning::AbortTaskFactory, AbortTaskFactory) // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) TESSERACT_ADD_TASK_COMPOSER_NODE_PLUGIN(tesseract_planning::DoneTaskFactory, DoneTaskFactory) // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)