Skip to content

Commit

Permalink
Add TaskComposerPipeline and improve task composer code coverage (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
Levi-Armstrong authored Jun 23, 2023
1 parent cdad44c commit 5a1bcf3
Show file tree
Hide file tree
Showing 55 changed files with 2,795 additions and 325 deletions.
33 changes: 25 additions & 8 deletions tesseract_task_composer/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ This file allows you define Excutors and Tasks (aka Nodes).
destinations: [ErrorTask, IterativeSplineParameterizationTask]
- source: IterativeSplineParameterizationTask
destinations: [ErrorTask, DoneTask]
terminals: [ErrorTask, DoneTask]
Task Composer Executors Plugins
-------------------------------
Expand Down Expand Up @@ -117,7 +118,7 @@ Define the graph nodes and edges as shown in the config below.
.. code-block:: yaml
CartesianPipeline:
class: GraphTaskFactory
class: PipelineTaskFactory
config:
inputs: [input_data]
outputs: [output_data]
Expand Down Expand Up @@ -172,6 +173,7 @@ Define the graph nodes and edges as shown in the config below.
destinations: [ErrorTask, IterativeSplineParameterizationTask]
- source: IterativeSplineParameterizationTask
destinations: [ErrorTask, DoneTask]
terminals: [ErrorTask, DoneTask]
Leveraging a perviously defined task.

Expand All @@ -182,7 +184,7 @@ Also in most case the tasks inputs and sometimes the outputs must be renamed. Th
.. code-block:: yaml
UsePreviouslyDefinedTaskPipeline:
class: GraphTaskFactory
class: PipelineTaskFactory
config:
inputs: [input_data]
outputs: [output_data]
Expand All @@ -194,14 +196,17 @@ Also in most case the tasks inputs and sometimes the outputs must be renamed. Th
inputs: [input_data]
outputs: [output_data]
CartesianPipelineTask:
task: CartesianPipeline
input_remapping:
input_data: output_data
output_remapping:
output_data: output_data
task:
name: CartesianPipeline
conditional: false
input_remapping:
input_data: output_data
output_remapping:
output_data: output_data
edges:
- source: MinLengthTask
destinations: [CartesianPipelineTask]
terminals: [CartesianPipelineTask]
Descartes Motion Planner Task
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -454,7 +459,19 @@ The final task that is called in a task graph if error occurs
class: ErrorTaskFactory
config:
conditional: false
Error Task
^^^^^^^^^^

The task that is called if you want to abort everything

.. code-block:: yaml
AbortTask:
class: AbortTaskFactory
config:
conditional: false
Fix State Bounds Task
^^^^^^^^^^^^^^^^^^^^^

Expand Down
68 changes: 51 additions & 17 deletions tesseract_task_composer/config/task_composer_plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ task_composer_plugins:
tasks:
plugins:
DescartesFPipeline:
class: GraphTaskFactory
class: PipelineTaskFactory
config:
conditional: true
inputs: [input_data]
outputs: [output_data]
nodes:
Expand Down Expand Up @@ -61,9 +62,11 @@ task_composer_plugins:
destinations: [ErrorTask, IterativeSplineParameterizationTask]
- source: IterativeSplineParameterizationTask
destinations: [ErrorTask, DoneTask]
terminals: [ErrorTask, DoneTask]
DescartesDPipeline:
class: GraphTaskFactory
class: PipelineTaskFactory
config:
conditional: true
inputs: [input_data]
outputs: [output_data]
nodes:
Expand Down Expand Up @@ -108,9 +111,11 @@ task_composer_plugins:
destinations: [ErrorTask, IterativeSplineParameterizationTask]
- source: IterativeSplineParameterizationTask
destinations: [ErrorTask, DoneTask]
terminals: [ErrorTask, DoneTask]
DescartesFNPCPipeline:
class: GraphTaskFactory
class: PipelineTaskFactory
config:
conditional: true
inputs: [input_data]
outputs: [output_data]
nodes:
Expand Down Expand Up @@ -148,9 +153,11 @@ task_composer_plugins:
destinations: [ErrorTask, IterativeSplineParameterizationTask]
- source: IterativeSplineParameterizationTask
destinations: [ErrorTask, DoneTask]
terminals: [ErrorTask, DoneTask]
DescartesDNPCPipeline:
class: GraphTaskFactory
class: PipelineTaskFactory
config:
conditional: true
inputs: [input_data]
outputs: [output_data]
nodes:
Expand Down Expand Up @@ -188,9 +195,11 @@ task_composer_plugins:
destinations: [ErrorTask, IterativeSplineParameterizationTask]
- source: IterativeSplineParameterizationTask
destinations: [ErrorTask, DoneTask]
terminals: [ErrorTask, DoneTask]
OMPLPipeline:
class: GraphTaskFactory
class: PipelineTaskFactory
config:
conditional: true
inputs: [input_data]
outputs: [output_data]
nodes:
Expand Down Expand Up @@ -235,9 +244,11 @@ task_composer_plugins:
destinations: [ErrorTask, IterativeSplineParameterizationTask]
- source: IterativeSplineParameterizationTask
destinations: [ErrorTask, DoneTask]
terminals: [ErrorTask, DoneTask]
TrajOptPipeline:
class: GraphTaskFactory
class: PipelineTaskFactory
config:
conditional: true
inputs: [input_data]
outputs: [output_data]
nodes:
Expand Down Expand Up @@ -282,9 +293,11 @@ task_composer_plugins:
destinations: [ErrorTask, IterativeSplineParameterizationTask]
- source: IterativeSplineParameterizationTask
destinations: [ErrorTask, DoneTask]
terminals: [ErrorTask, DoneTask]
TrajOptIfoptPipeline:
class: GraphTaskFactory
class: PipelineTaskFactory
config:
conditional: true
inputs: [input_data]
outputs: [output_data]
nodes:
Expand Down Expand Up @@ -329,9 +342,11 @@ task_composer_plugins:
destinations: [ErrorTask, IterativeSplineParameterizationTask]
- source: IterativeSplineParameterizationTask
destinations: [ErrorTask, DoneTask]
terminals: [ErrorTask, DoneTask]
CartesianPipeline:
class: GraphTaskFactory
class: PipelineTaskFactory
config:
conditional: true
inputs: [input_data]
outputs: [output_data]
nodes:
Expand Down Expand Up @@ -385,9 +400,11 @@ task_composer_plugins:
destinations: [ErrorTask, IterativeSplineParameterizationTask]
- source: IterativeSplineParameterizationTask
destinations: [ErrorTask, DoneTask]
terminals: [ErrorTask, DoneTask]
FreespacePipeline:
class: GraphTaskFactory
class: PipelineTaskFactory
config:
conditional: true
inputs: [input_data]
outputs: [output_data]
nodes:
Expand Down Expand Up @@ -441,9 +458,11 @@ task_composer_plugins:
destinations: [ErrorTask, IterativeSplineParameterizationTask]
- source: IterativeSplineParameterizationTask
destinations: [ErrorTask, DoneTask]
terminals: [ErrorTask, DoneTask]
RasterFtPipeline:
class: GraphTaskFactory
class: PipelineTaskFactory
config:
conditional: true
inputs: [input_data]
outputs: [output_data]
nodes:
Expand Down Expand Up @@ -491,9 +510,11 @@ task_composer_plugins:
destinations: [ErrorTask, RasterMotionTask]
- source: RasterMotionTask
destinations: [ErrorTask, DoneTask]
terminals: [ErrorTask, DoneTask]
RasterCtPipeline:
class: GraphTaskFactory
class: PipelineTaskFactory
config:
conditional: true
inputs: [input_data]
outputs: [output_data]
nodes:
Expand Down Expand Up @@ -541,9 +562,11 @@ task_composer_plugins:
destinations: [ErrorTask, RasterMotionTask]
- source: RasterMotionTask
destinations: [ErrorTask, DoneTask]
terminals: [ErrorTask, DoneTask]
RasterFtOnlyPipeline:
class: GraphTaskFactory
class: PipelineTaskFactory
config:
conditional: true
inputs: [input_data]
outputs: [output_data]
nodes:
Expand Down Expand Up @@ -585,9 +608,11 @@ task_composer_plugins:
destinations: [ErrorTask, RasterMotionTask]
- source: RasterMotionTask
destinations: [ErrorTask, DoneTask]
terminals: [ErrorTask, DoneTask]
RasterCtOnlyPipeline:
class: GraphTaskFactory
class: PipelineTaskFactory
config:
conditional: true
inputs: [input_data]
outputs: [output_data]
nodes:
Expand Down Expand Up @@ -629,9 +654,11 @@ task_composer_plugins:
destinations: [ErrorTask, RasterMotionTask]
- source: RasterMotionTask
destinations: [ErrorTask, DoneTask]
terminals: [ErrorTask, DoneTask]
RasterFtGlobalPipeline:
class: GraphTaskFactory
class: PipelineTaskFactory
config:
conditional: true
inputs: [input_data]
outputs: [output_data]
nodes:
Expand Down Expand Up @@ -688,9 +715,11 @@ task_composer_plugins:
destinations: [ErrorTask, RasterMotionTask]
- source: RasterMotionTask
destinations: [ErrorTask, DoneTask]
terminals: [ErrorTask, DoneTask]
RasterCtGlobalPipeline:
class: GraphTaskFactory
class: PipelineTaskFactory
config:
conditional: true
inputs: [input_data]
outputs: [output_data]
nodes:
Expand Down Expand Up @@ -747,9 +776,11 @@ task_composer_plugins:
destinations: [ErrorTask, RasterMotionTask]
- source: RasterMotionTask
destinations: [ErrorTask, DoneTask]
terminals: [ErrorTask, DoneTask]
RasterFtOnlyGlobalPipeline:
class: GraphTaskFactory
class: PipelineTaskFactory
config:
conditional: true
inputs: [input_data]
outputs: [output_data]
nodes:
Expand Down Expand Up @@ -800,9 +831,11 @@ task_composer_plugins:
destinations: [ErrorTask, RasterMotionTask]
- source: RasterMotionTask
destinations: [ErrorTask, DoneTask]
terminals: [ErrorTask, DoneTask]
RasterCtOnlyGlobalPipeline:
class: GraphTaskFactory
class: PipelineTaskFactory
config:
conditional: true
inputs: [input_data]
outputs: [output_data]
nodes:
Expand Down Expand Up @@ -853,3 +886,4 @@ task_composer_plugins:
destinations: [ErrorTask, RasterMotionTask]
- source: RasterMotionTask
destinations: [ErrorTask, DoneTask]
terminals: [ErrorTask, DoneTask]
8 changes: 7 additions & 1 deletion tesseract_task_composer/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ add_library(
src/task_composer_input.cpp
src/task_composer_node.cpp
src/task_composer_node_info.cpp
src/task_composer_pipeline.cpp
src/task_composer_plugin_factory.cpp
src/task_composer_problem.cpp
src/task_composer_server.cpp
Expand Down Expand Up @@ -36,7 +37,12 @@ target_code_coverage(
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>")

add_library(${PROJECT_NAME}_nodes src/nodes/done_task.cpp src/nodes/error_task.cpp src/nodes/start_task.cpp)
add_library(
${PROJECT_NAME}_nodes
src/nodes/abort_task.cpp
src/nodes/done_task.cpp
src/nodes/error_task.cpp
src/nodes/start_task.cpp)
target_link_libraries(
${PROJECT_NAME}_nodes
PUBLIC ${PROJECT_NAME}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* @file abort_task.h
*
* @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.
*/
#ifndef TESSERACT_TASK_COMPOSER_ABORT_TASK_H
#define TESSERACT_TASK_COMPOSER_ABORT_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;
class AbortTask : public TaskComposerTask
{
public:
using Ptr = std::shared_ptr<AbortTask>;
using ConstPtr = std::shared_ptr<const AbortTask>;
using UPtr = std::unique_ptr<AbortTask>;
using ConstUPtr = std::unique_ptr<const AbortTask>;

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 <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::AbortTask, "AbortTask")

#endif // TESSERACT_TASK_COMPOSER_ABORT_TASK_H
Loading

0 comments on commit 5a1bcf3

Please sign in to comment.