MotionPlanningTaskControlInterface.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package RobotComponents
19  * @author Raphael Grimm ( raphael dot grimm at kit dot edu )
20  * @date 2015
21  * @copyright http://www.gnu.org/licenses/gpl.txt
22  * GNU General Public License
23  */
24 #pragma once
25 
26 #include <RobotComponents/interface/components/MotionPlanning/Tasks/MotionPlanningTask.h>
28 
29 namespace armarx
30 {
32  virtual public MotionPlanningTaskControlInterface
33  {
34  public:
35  // virtual void abortTask(const Ice::Current& = Ice::emptyCurrent) = 0;
36  // virtual Path getPath(const Ice::Current& = Ice::emptyCurrent) const = 0;
37  // virtual TaskStatus::Status getTaskStatus(const Ice::Current& = Ice::emptyCurrent) const = 0;
38 
39 
40  void waitForFinishedPlanning_async(const AMD_MotionPlanningTaskControlInterface_waitForFinishedPlanningPtr& cb, const Ice::Current& = Ice::emptyCurrent) override
41  {
43  }
44  void waitForFinishedRunning_async(const AMD_MotionPlanningTaskControlInterface_waitForFinishedRunningPtr& cb, const Ice::Current& = Ice::emptyCurrent) override
45  {
47  }
48  /**
49  * @brief Returns whether the task is currently planning.
50  * @return Whether the task is currently planning.
51  */
52  bool isRunning(const Ice::Current& = Ice::emptyCurrent) const override;
53 
54  /**
55  * @brief Returns whether the task has finished planning.
56  * @return Whether the task has finished planning.
57  */
58  bool finishedRunning(const Ice::Current& = Ice::emptyCurrent) const override;
59  protected:
62  };
63 
65  virtual public MotionPlanningMultiPathTaskControlInterface
66  {
67  public:
68  // virtual Ice::Long getPathCount(const Ice::Current& = Ice::emptyCurrent) const = 0;
69  // virtual Path getNthPath(Ice::Long n, const Ice::Current& = Ice::emptyCurrent) const = 0;
70  // virtual PathSeq getAllPaths(const Ice::Current& = Ice::emptyCurrent) const = 0;
71  Path getPath(const Ice::Current& = Ice::emptyCurrent) const override
72  {
73  return getNthPath(0);
74  }
75  };
76 
78  virtual public MotionPlanningWithCostTaskControlInterface
79  {
80  public:
81  PathWithCost getPathWithCost(const Ice::Current& = Ice::emptyCurrent) const override = 0;
82  Path getPath(const Ice::Current& = Ice::emptyCurrent) const override
83  {
84  auto p = getPathWithCost();
85  return {std::move(p.nodes), std::move(p.pathName)};
86  }
87  };
88 
90  virtual public MotionPlanningMultiPathWithCostTaskControlInterface,
91  virtual public MotionPlanningMultiPathTaskCI,
92  virtual public MotionPlanningWithCostTaskCI
93  {
94  public:
95  // virtual Ice::Long getPathCount(const Ice::Current& = Ice::emptyCurrent) const = 0;
96  // virtual PathWithCost getBestPath(const Ice::Current& = Ice::emptyCurrent) const = 0;
97  // virtual PathWithCost getNthPathWithCost(Ice::Long, const Ice::Current& = Ice::emptyCurrent) const = 0;
98  // virtual PathWithCostSeq getAllPathsWithCost(const Ice::Current& = Ice::emptyCurrent) const = 0;
99 
100  //default impl
101  Path getPath(const Ice::Current& = Ice::emptyCurrent) const override
102  {
104  }
105 
106  PathWithCost getPathWithCost(const Ice::Current& = Ice::emptyCurrent) const override
107  {
108  return getNthPathWithCost(0);
109  }
110  Path getNthPath(Ice::Long n, const Ice::Current& = Ice::emptyCurrent) const override
111  {
112  auto p = getNthPathWithCost(n);
113  return {std::move(p.nodes), std::move(p.pathName)};
114  }
115  PathSeq getAllPaths(const Ice::Current& = Ice::emptyCurrent) const override;
116 
117  };
118 }
armarx::MotionPlanningTaskCI::waitForFinishedRunning
AMDCallbackCollection waitForFinishedRunning
Definition: MotionPlanningTaskControlInterface.h:61
armarx::MotionPlanningMultiPathWithCostTaskCI::getPath
Path getPath(const Ice::Current &=Ice::emptyCurrent) const override
Definition: MotionPlanningTaskControlInterface.h:101
armarx::MotionPlanningTaskCI::waitForFinishedRunning_async
void waitForFinishedRunning_async(const AMD_MotionPlanningTaskControlInterface_waitForFinishedRunningPtr &cb, const Ice::Current &=Ice::emptyCurrent) override
Definition: MotionPlanningTaskControlInterface.h:44
armarx::MotionPlanningTaskCI::finishedRunning
bool finishedRunning(const Ice::Current &=Ice::emptyCurrent) const override
Returns whether the task has finished planning.
Definition: MotionPlanningTaskControlInterface.cpp:47
armarx::MotionPlanningTaskCI::waitForFinishedPlanning_async
void waitForFinishedPlanning_async(const AMD_MotionPlanningTaskControlInterface_waitForFinishedPlanningPtr &cb, const Ice::Current &=Ice::emptyCurrent) override
Definition: MotionPlanningTaskControlInterface.h:40
armarx::MotionPlanningWithCostTaskCI::getPathWithCost
PathWithCost getPathWithCost(const Ice::Current &=Ice::emptyCurrent) const override=0
armarx::AMDCallbackCollection::addCallback
void addCallback(RespondFunction onRespond, ExceptFunction onExcept)
Adds an callback and processes it depending on the current mode.
Definition: AMDCallbackCollection.h:151
armarx::MotionPlanningMultiPathWithCostTaskCI::getPathWithCost
PathWithCost getPathWithCost(const Ice::Current &=Ice::emptyCurrent) const override
Definition: MotionPlanningTaskControlInterface.h:106
armarx::MotionPlanningMultiPathTaskCI
Definition: MotionPlanningTaskControlInterface.h:64
armarx::MotionPlanningWithCostTaskCI
Definition: MotionPlanningTaskControlInterface.h:77
armarx::VariantType::Long
const VariantTypeId Long
Definition: Variant.h:917
armarx::MotionPlanningMultiPathWithCostTaskCI::getNthPath
Path getNthPath(Ice::Long n, const Ice::Current &=Ice::emptyCurrent) const override
Definition: MotionPlanningTaskControlInterface.h:110
armarx::MotionPlanningWithCostTaskCI::getPath
Path getPath(const Ice::Current &=Ice::emptyCurrent) const override
Definition: MotionPlanningTaskControlInterface.h:82
armarx::MotionPlanningMultiPathTaskCI::getPath
Path getPath(const Ice::Current &=Ice::emptyCurrent) const override
Definition: MotionPlanningTaskControlInterface.h:71
armarx::MotionPlanningTaskCI::isRunning
bool isRunning(const Ice::Current &=Ice::emptyCurrent) const override
Returns whether the task is currently planning.
Definition: MotionPlanningTaskControlInterface.cpp:42
armarx::MotionPlanningTaskCI
Definition: MotionPlanningTaskControlInterface.h:31
armarx::armem::server::ltm::detail::mixin::Path
std::filesystem::path Path
Definition: DiskStorageMixin.h:17
armarx::AMDCallbackCollection
This helper-class can be used when you have an ice AMD method.
Definition: AMDCallbackCollection.h:52
AMDCallbackCollection.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::MotionPlanningMultiPathWithCostTaskCI::getAllPaths
PathSeq getAllPaths(const Ice::Current &=Ice::emptyCurrent) const override
Definition: MotionPlanningTaskControlInterface.cpp:30
armarx::MotionPlanningTaskCI::waitForFinishedPlanning
AMDCallbackCollection waitForFinishedPlanning
Definition: MotionPlanningTaskControlInterface.h:60
armarx::MotionPlanningMultiPathWithCostTaskCI
Definition: MotionPlanningTaskControlInterface.h:89