PlannedMotionProvider.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package RobotComponents::ArmarXObjects::PlannedMotionProvider
17  * @author Adrian Knobloch ( adrian dot knobloch at student dot kit dot edu )
18  * @date 2017
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 
28 
30 #include <RobotComponents/interface/components/MotionPlanning/MotionPlanningServer.h>
31 #include <RobotComponents/interface/components/PlannedMotionProviderInterface.h>
32 
33 namespace armarx
34 {
35  /**
36  * @class PlannedMotionProviderPropertyDefinitions
37  * @brief
38  */
40  {
41  public:
44  {
45  //defineRequiredProperty<std::string>("PropertyName", "Description");
46  defineOptionalProperty<float>(
47  "JointMotionSafetyMargin", 80.0f, "Safety margin for joint arm motion in mm");
48  defineOptionalProperty<float>(
49  "PlatformMotionSafetyMargin", 100.0f, "Safety margin for platform motion in mm");
50  }
51  };
52 
53  /**
54  * @defgroup Component-PlannedMotionProvider PlannedMotionProvider
55  * @ingroup RobotComponents-Components
56  * A description of the component PlannedMotionProvider.
57  *
58  * @class PlannedMotionProvider
59  * @ingroup Component-PlannedMotionProvider
60  * @brief Brief description of class PlannedMotionProvider.
61  *
62  * Detailed description of class PlannedMotionProvider.
63  */
65  virtual public armarx::Component,
66  virtual public armarx::PlannedMotionProviderInterface
67  {
68  public:
69  /**
70  * @see armarx::ManagedIceObject::getDefaultName()
71  */
72  std::string
73  getDefaultName() const override
74  {
75  return "PlannedMotionProvider";
76  }
77 
78  GraspingTrajectory planMotion(const SimoxCSpaceBasePtr& cSpaceBase,
79  const SimoxCSpaceBasePtr& cSpacePlatformBase,
80  const MotionPlanningData& mpd,
81  const Ice::Current& c = Ice::emptyCurrent) override;
82  GraspingTrajectory planMotionParallel(const SimoxCSpaceBasePtr& cSpaceBase,
83  const SimoxCSpaceBasePtr& cSpacePlatformBase,
84  const MotionPlanningData& mpd,
85  const Ice::Current& c) override;
86  // does it make sense to return a GraspingTrajectory
87 
88  TrajectoryBasePtr planJointMotion(const SimoxCSpaceBasePtr& cSpaceBase,
89  const MotionPlanningData& mpd,
90  const Ice::Current& c = Ice::emptyCurrent) override;
91 
92  TrajectoryBasePtr planPlatformMotion(const SimoxCSpaceBasePtr& cSpacePlatformBase,
93  const MotionPlanningData& mpd,
94  const Ice::Current& c = Ice::emptyCurrent) override;
95 
96  protected:
97  /**
98  * @see armarx::ManagedIceObject::onInitComponent()
99  */
100  void onInitComponent() override;
101 
102  /**
103  * @see armarx::ManagedIceObject::onConnectComponent()
104  */
105  void onConnectComponent() override;
106 
107  /**
108  * @see armarx::ManagedIceObject::onDisconnectComponent()
109  */
110  void onDisconnectComponent() override;
111 
112  /**
113  * @see armarx::ManagedIceObject::onExitComponent()
114  */
115  void onExitComponent() override;
116 
117  /**
118  * @see PropertyUser::createPropertyDefinitions()
119  */
121 
122  private:
123  std::vector<RemoteHandle<MotionPlanningTaskControlInterfacePrx>> planningTasks;
124  armarx::RobotStateComponentInterfacePrx robotStateComponent;
125  VirtualRobot::RobotPtr localRobot;
126  MotionPlanningServerInterfacePrx mps;
127  int maxPostProcessingSteps;
128 
129  // how to make those public?
130 
131  TrajectoryPtr calculateJointTrajectory(const SimoxCSpaceBasePtr& cSpaceBase,
132  const MotionPlanningData& mpd,
133  const Ice::Current& c = Ice::emptyCurrent);
134 
135  TrajectoryPtr calculatePlatformTrajectory(const SimoxCSpaceBasePtr& cSpacePlatformBase,
136  const MotionPlanningData& mpd,
137  const Ice::Current& c = Ice::emptyCurrent);
138  void preparePlatformCSpace(SimoxCSpacePtr cSpacePlatform,
139  const MotionPlanningData& mpd,
140  VectorXf* storeStart,
141  VectorXf* storeGoal,
142  ScaledCSpacePtr* storeScaledCSpace,
143  Eigen::Vector3f* storeRpyAgent);
144  void prepareJointCSpace(SimoxCSpacePtr cSpace,
145  const MotionPlanningData& mpd,
146  VectorXf* storeStart,
147  VectorXf* storeGoal,
148  ScaledCSpacePtr* storeScaledCSpace);
149 
151  startBiRRT(ScaledCSpacePtr scaledCSpace,
152  VectorXf startPos,
153  VectorXf goalPos,
154  float dcdStep,
155  bool doRandomShortcutPostProcessing = false);
157  const ScaledCSpacePtr scaledCSpace,
158  const std::string roboPart);
159  };
160 } // namespace armarx
armarx::PlannedMotionProvider::onExitComponent
void onExitComponent() override
Definition: PlannedMotionProvider.cpp:121
armarx::PlannedMotionProvider::onConnectComponent
void onConnectComponent() override
Definition: PlannedMotionProvider.cpp:106
RemoteHandle.h
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
IceInternal::Handle< Trajectory >
armarx::PlannedMotionProvider::planPlatformMotion
TrajectoryBasePtr planPlatformMotion(const SimoxCSpaceBasePtr &cSpacePlatformBase, const MotionPlanningData &mpd, const Ice::Current &c=Ice::emptyCurrent) override
Definition: PlannedMotionProvider.cpp:142
armarx::PlannedMotionProvider::onDisconnectComponent
void onDisconnectComponent() override
Definition: PlannedMotionProvider.cpp:115
armarx::PlannedMotionProviderPropertyDefinitions::PlannedMotionProviderPropertyDefinitions
PlannedMotionProviderPropertyDefinitions(std::string prefix)
Definition: PlannedMotionProvider.h:42
MotionPlanningObjectFactories.h
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:91
armarx::PlannedMotionProvider::planJointMotion
TrajectoryBasePtr planJointMotion(const SimoxCSpaceBasePtr &cSpaceBase, const MotionPlanningData &mpd, const Ice::Current &c=Ice::emptyCurrent) override
Definition: PlannedMotionProvider.cpp:133
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:69
armarx::PlannedMotionProvider::getDefaultName
std::string getDefaultName() const override
Definition: PlannedMotionProvider.h:73
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::PlannedMotionProviderPropertyDefinitions
Definition: PlannedMotionProvider.h:39
armarx::PlannedMotionProvider::onInitComponent
void onInitComponent() override
Definition: PlannedMotionProvider.cpp:98
IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface >
armarx::RemoteHandle
The RemoteHandle class wrapps a ClientSideRemoteHandleControlBlock and can be used just as a Ice prox...
Definition: RemoteHandle.h:46
armarx::armem::server::ltm::detail::mixin::Path
std::filesystem::path Path
Definition: DiskStorageMixin.h:17
armarx::PlannedMotionProvider
Brief description of class PlannedMotionProvider.
Definition: PlannedMotionProvider.h:64
armarx::PlannedMotionProvider::planMotion
GraspingTrajectory planMotion(const SimoxCSpaceBasePtr &cSpaceBase, const SimoxCSpaceBasePtr &cSpacePlatformBase, const MotionPlanningData &mpd, const Ice::Current &c=Ice::emptyCurrent) override
Definition: PlannedMotionProvider.cpp:43
armarx::PlannedMotionProvider::planMotionParallel
GraspingTrajectory planMotionParallel(const SimoxCSpaceBasePtr &cSpaceBase, const SimoxCSpaceBasePtr &cSpacePlatformBase, const MotionPlanningData &mpd, const Ice::Current &c) override
Definition: PlannedMotionProvider.cpp:54
armarx::PlannedMotionProvider::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: PlannedMotionProvider.cpp:126
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:19