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 
27 
28 #include <RobotComponents/interface/components/MotionPlanning/Tasks/MotionPlanningTask.h>
29 
30 namespace armarx
31 {
32  class MotionPlanningTaskCI : 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
42  const AMD_MotionPlanningTaskControlInterface_waitForFinishedPlanningPtr& cb,
43  const Ice::Current& = Ice::emptyCurrent) override
44  {
46  }
47 
48  void
50  const AMD_MotionPlanningTaskControlInterface_waitForFinishedRunningPtr& cb,
51  const Ice::Current& = Ice::emptyCurrent) override
52  {
54  }
55 
56  /**
57  * @brief Returns whether the task is currently planning.
58  * @return Whether the task is currently planning.
59  */
60  bool isRunning(const Ice::Current& = Ice::emptyCurrent) const override;
61 
62  /**
63  * @brief Returns whether the task has finished planning.
64  * @return Whether the task has finished planning.
65  */
66  bool finishedRunning(const Ice::Current& = Ice::emptyCurrent) const override;
67 
68  protected:
71  };
72 
73  class MotionPlanningMultiPathTaskCI : virtual public MotionPlanningMultiPathTaskControlInterface
74  {
75  public:
76  // virtual Ice::Long getPathCount(const Ice::Current& = Ice::emptyCurrent) const = 0;
77  // virtual Path getNthPath(Ice::Long n, const Ice::Current& = Ice::emptyCurrent) const = 0;
78  // virtual PathSeq getAllPaths(const Ice::Current& = Ice::emptyCurrent) const = 0;
79  Path
80  getPath(const Ice::Current& = Ice::emptyCurrent) const override
81  {
82  return getNthPath(0);
83  }
84  };
85 
86  class MotionPlanningWithCostTaskCI : virtual public MotionPlanningWithCostTaskControlInterface
87  {
88  public:
89  PathWithCost getPathWithCost(const Ice::Current& = Ice::emptyCurrent) const override = 0;
90 
91  Path
92  getPath(const Ice::Current& = Ice::emptyCurrent) const override
93  {
94  auto p = getPathWithCost();
95  return {std::move(p.nodes), std::move(p.pathName)};
96  }
97  };
98 
100  virtual public MotionPlanningMultiPathWithCostTaskControlInterface,
101  virtual public MotionPlanningMultiPathTaskCI,
102  virtual public MotionPlanningWithCostTaskCI
103  {
104  public:
105  // virtual Ice::Long getPathCount(const Ice::Current& = Ice::emptyCurrent) const = 0;
106  // virtual PathWithCost getBestPath(const Ice::Current& = Ice::emptyCurrent) const = 0;
107  // virtual PathWithCost getNthPathWithCost(Ice::Long, const Ice::Current& = Ice::emptyCurrent) const = 0;
108  // virtual PathWithCostSeq getAllPathsWithCost(const Ice::Current& = Ice::emptyCurrent) const = 0;
109 
110  //default impl
111  Path
112  getPath(const Ice::Current& = Ice::emptyCurrent) const override
113  {
115  }
116 
117  PathWithCost
118  getPathWithCost(const Ice::Current& = Ice::emptyCurrent) const override
119  {
120  return getNthPathWithCost(0);
121  }
122 
123  Path
124  getNthPath(Ice::Long n, const Ice::Current& = Ice::emptyCurrent) const override
125  {
126  auto p = getNthPathWithCost(n);
127  return {std::move(p.nodes), std::move(p.pathName)};
128  }
129 
130  PathSeq getAllPaths(const Ice::Current& = Ice::emptyCurrent) const override;
131  };
132 } // namespace armarx
armarx::MotionPlanningTaskCI::waitForFinishedRunning
AMDCallbackCollection waitForFinishedRunning
Definition: MotionPlanningTaskControlInterface.h:70
armarx::MotionPlanningMultiPathWithCostTaskCI::getPath
Path getPath(const Ice::Current &=Ice::emptyCurrent) const override
Definition: MotionPlanningTaskControlInterface.h:112
armarx::MotionPlanningTaskCI::waitForFinishedRunning_async
void waitForFinishedRunning_async(const AMD_MotionPlanningTaskControlInterface_waitForFinishedRunningPtr &cb, const Ice::Current &=Ice::emptyCurrent) override
Definition: MotionPlanningTaskControlInterface.h:49
armarx::MotionPlanningTaskCI::finishedRunning
bool finishedRunning(const Ice::Current &=Ice::emptyCurrent) const override
Returns whether the task has finished planning.
Definition: MotionPlanningTaskControlInterface.cpp:53
armarx::MotionPlanningTaskCI::waitForFinishedPlanning_async
void waitForFinishedPlanning_async(const AMD_MotionPlanningTaskControlInterface_waitForFinishedPlanningPtr &cb, const Ice::Current &=Ice::emptyCurrent) override
Definition: MotionPlanningTaskControlInterface.h:41
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:152
armarx::MotionPlanningMultiPathWithCostTaskCI::getPathWithCost
PathWithCost getPathWithCost(const Ice::Current &=Ice::emptyCurrent) const override
Definition: MotionPlanningTaskControlInterface.h:118
armarx::MotionPlanningMultiPathTaskCI
Definition: MotionPlanningTaskControlInterface.h:73
armarx::MotionPlanningWithCostTaskCI
Definition: MotionPlanningTaskControlInterface.h:86
armarx::VariantType::Long
const VariantTypeId Long
Definition: Variant.h:918
armarx::MotionPlanningMultiPathWithCostTaskCI::getNthPath
Path getNthPath(Ice::Long n, const Ice::Current &=Ice::emptyCurrent) const override
Definition: MotionPlanningTaskControlInterface.h:124
armarx::MotionPlanningWithCostTaskCI::getPath
Path getPath(const Ice::Current &=Ice::emptyCurrent) const override
Definition: MotionPlanningTaskControlInterface.h:92
armarx::MotionPlanningMultiPathTaskCI::getPath
Path getPath(const Ice::Current &=Ice::emptyCurrent) const override
Definition: MotionPlanningTaskControlInterface.h:80
armarx::MotionPlanningTaskCI::isRunning
bool isRunning(const Ice::Current &=Ice::emptyCurrent) const override
Returns whether the task is currently planning.
Definition: MotionPlanningTaskControlInterface.cpp:47
armarx::MotionPlanningTaskCI
Definition: MotionPlanningTaskControlInterface.h:32
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:27
armarx::MotionPlanningMultiPathWithCostTaskCI::getAllPaths
PathSeq getAllPaths(const Ice::Current &=Ice::emptyCurrent) const override
Definition: MotionPlanningTaskControlInterface.cpp:32
armarx::MotionPlanningTaskCI::waitForFinishedPlanning
AMDCallbackCollection waitForFinishedPlanning
Definition: MotionPlanningTaskControlInterface.h:69
armarx::MotionPlanningMultiPathWithCostTaskCI
Definition: MotionPlanningTaskControlInterface.h:99