-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b10217b
commit be0de31
Showing
9 changed files
with
249 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
tesseract_task_composer/core/include/tesseract_task_composer/core/nodes/sync_task.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/** | ||
* @file sync_task.h | ||
* | ||
* @author Levi Armstrong | ||
* @date August 13, 2023 | ||
* @version TODO | ||
* @bug No known bugs | ||
* | ||
* @copyright Copyright (c) 2023, Plectix Robotics | ||
* | ||
* @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. | ||
*/ | ||
#ifndef TESSERACT_TASK_COMPOSER_SYNC_TASK_H | ||
#define TESSERACT_TASK_COMPOSER_SYNC_TASK_H | ||
|
||
#include <tesseract_common/macros.h> | ||
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH | ||
#include <boost/serialization/access.hpp> | ||
TESSERACT_COMMON_IGNORE_WARNINGS_POP | ||
|
||
#include <tesseract_task_composer/core/task_composer_task.h> | ||
|
||
namespace tesseract_planning | ||
{ | ||
class TaskComposerPluginFactory; | ||
|
||
/** | ||
* @brief This is used as a syncronization point in your task graph | ||
* This task has no inputs or output and is not conditional | ||
*/ | ||
class SyncTask : public TaskComposerTask | ||
{ | ||
public: | ||
using Ptr = std::shared_ptr<SyncTask>; | ||
using ConstPtr = std::shared_ptr<const SyncTask>; | ||
using UPtr = std::unique_ptr<SyncTask>; | ||
using ConstUPtr = std::unique_ptr<const SyncTask>; | ||
|
||
explicit SyncTask(std::string name = "SyncTask"); | ||
explicit SyncTask(std::string name, const YAML::Node& config, const TaskComposerPluginFactory& plugin_factory); | ||
~SyncTask() override = default; | ||
|
||
bool operator==(const SyncTask& rhs) const; | ||
bool operator!=(const SyncTask& rhs) const; | ||
|
||
protected: | ||
friend struct tesseract_common::Serialization; | ||
friend class boost::serialization::access; | ||
template <class Archive> | ||
void serialize(Archive& ar, const unsigned int version); // NOLINT | ||
|
||
TaskComposerNodeInfo::UPtr runImpl(TaskComposerInput& input, | ||
OptionalTaskComposerExecutor executor = std::nullopt) const override final; | ||
}; | ||
|
||
} // namespace tesseract_planning | ||
|
||
#include <boost/serialization/export.hpp> | ||
BOOST_CLASS_EXPORT_KEY2(tesseract_planning::SyncTask, "SyncTask") | ||
|
||
#endif // TESSERACT_TASK_COMPOSER_SYNC_TASK_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/** | ||
* @file sync_task.cpp | ||
* | ||
* @author Levi Armstrong | ||
* @date August 13, 2023 | ||
* @version TODO | ||
* @bug No known bugs | ||
* | ||
* @copyright Copyright (c) 2023, Plectix Robotics | ||
* | ||
* @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/macros.h> | ||
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH | ||
#include <console_bridge/console.h> | ||
#include <boost/serialization/string.hpp> | ||
TESSERACT_COMMON_IGNORE_WARNINGS_POP | ||
|
||
#include <tesseract_task_composer/core/nodes/sync_task.h> | ||
|
||
namespace tesseract_planning | ||
{ | ||
SyncTask::SyncTask(std::string name) : TaskComposerTask(std::move(name), false) {} | ||
SyncTask::SyncTask(std::string name, const YAML::Node& config, const TaskComposerPluginFactory& /*plugin_factory*/) | ||
: TaskComposerTask(std::move(name), config) | ||
{ | ||
if (conditional_) | ||
throw std::runtime_error("SyncTask, config is_conditional should not be true"); | ||
|
||
if (!input_keys_.empty()) | ||
throw std::runtime_error("SyncTask, config does not support 'inputs' entry"); | ||
|
||
if (!output_keys_.empty()) | ||
throw std::runtime_error("SyncTask, config does not support 'outputs' entry"); | ||
} | ||
TaskComposerNodeInfo::UPtr SyncTask::runImpl(TaskComposerInput& /*input*/, | ||
OptionalTaskComposerExecutor /*executor*/) const | ||
{ | ||
auto info = std::make_unique<TaskComposerNodeInfo>(*this); | ||
info->color = "green"; | ||
info->message = "Successful"; | ||
info->return_value = 1; | ||
return info; | ||
} | ||
|
||
bool SyncTask::operator==(const SyncTask& rhs) const { return (TaskComposerTask::operator==(rhs)); } | ||
bool SyncTask::operator!=(const SyncTask& rhs) const { return !operator==(rhs); } | ||
|
||
template <class Archive> | ||
void SyncTask::serialize(Archive& ar, const unsigned int /*version*/) | ||
{ | ||
ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(TaskComposerTask); | ||
} | ||
|
||
} // namespace tesseract_planning | ||
|
||
#include <tesseract_common/serialization.h> | ||
TESSERACT_SERIALIZE_ARCHIVES_INSTANTIATE(tesseract_planning::SyncTask) | ||
BOOST_CLASS_EXPORT_IMPLEMENT(tesseract_planning::SyncTask) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters