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
30namespace 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 {
45 waitForFinishedPlanning.addCallback(cb);
46 }
47
48 void
50 const AMD_MotionPlanningTaskControlInterface_waitForFinishedRunningPtr& cb,
51 const Ice::Current& = Ice::emptyCurrent) override
52 {
53 waitForFinishedRunning.addCallback(cb);
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
This helper-class can be used when you have an ice AMD method.
Path getPath(const Ice::Current &=Ice::emptyCurrent) const override
Path getPath(const Ice::Current &=Ice::emptyCurrent) const override
Path getNthPath(Ice::Long n, const Ice::Current &=Ice::emptyCurrent) const override
PathSeq getAllPaths(const Ice::Current &=Ice::emptyCurrent) const override
PathWithCost getPathWithCost(const Ice::Current &=Ice::emptyCurrent) const override
void waitForFinishedPlanning_async(const AMD_MotionPlanningTaskControlInterface_waitForFinishedPlanningPtr &cb, const Ice::Current &=Ice::emptyCurrent) override
bool isRunning(const Ice::Current &=Ice::emptyCurrent) const override
Returns whether the task is currently planning.
bool finishedRunning(const Ice::Current &=Ice::emptyCurrent) const override
Returns whether the task has finished planning.
void waitForFinishedRunning_async(const AMD_MotionPlanningTaskControlInterface_waitForFinishedRunningPtr &cb, const Ice::Current &=Ice::emptyCurrent) override
PathWithCost getPathWithCost(const Ice::Current &=Ice::emptyCurrent) const override=0
Path getPath(const Ice::Current &=Ice::emptyCurrent) const override
This file offers overloads of toIce() and fromIce() functions for STL container types.