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 
29 #include <RobotComponents/interface/components/MotionPlanning/MotionPlanningServer.h>
30 #include <RobotComponents/interface/components/PlannedMotionProviderInterface.h>
32 
33 namespace armarx
34 {
35  /**
36  * @class PlannedMotionProviderPropertyDefinitions
37  * @brief
38  */
41  {
42  public:
45  {
46  //defineRequiredProperty<std::string>("PropertyName", "Description");
47  defineOptionalProperty<float>("JointMotionSafetyMargin", 80.0f, "Safety margin for joint arm motion in mm");
48  defineOptionalProperty<float>("PlatformMotionSafetyMargin", 100.0f, "Safety margin for platform motion in mm");
49  }
50  };
51 
52  /**
53  * @defgroup Component-PlannedMotionProvider PlannedMotionProvider
54  * @ingroup RobotComponents-Components
55  * A description of the component PlannedMotionProvider.
56  *
57  * @class PlannedMotionProvider
58  * @ingroup Component-PlannedMotionProvider
59  * @brief Brief description of class PlannedMotionProvider.
60  *
61  * Detailed description of class PlannedMotionProvider.
62  */
64  virtual public armarx::Component,
65  virtual public armarx::PlannedMotionProviderInterface
66  {
67  public:
68  /**
69  * @see armarx::ManagedIceObject::getDefaultName()
70  */
71  std::string getDefaultName() const override
72  {
73  return "PlannedMotionProvider";
74  }
75 
76  GraspingTrajectory
77  planMotion(const SimoxCSpaceBasePtr& cSpaceBase, const SimoxCSpaceBasePtr& cSpacePlatformBase,
78  const MotionPlanningData& mpd, const Ice::Current& c = Ice::emptyCurrent) override;
79  GraspingTrajectory planMotionParallel(const SimoxCSpaceBasePtr& cSpaceBase,
80  const SimoxCSpaceBasePtr& cSpacePlatformBase,
81  const MotionPlanningData& mpd,
82  const Ice::Current& c) override;
83  // does it make sense to return a GraspingTrajectory
84 
85  TrajectoryBasePtr planJointMotion(const SimoxCSpaceBasePtr& cSpaceBase, const MotionPlanningData& mpd,
86  const Ice::Current& c = Ice::emptyCurrent) override;
87 
88  TrajectoryBasePtr planPlatformMotion(const SimoxCSpaceBasePtr& cSpacePlatformBase,
89  const MotionPlanningData& mpd,
90  const Ice::Current& c = Ice::emptyCurrent) override;
91 
92  protected:
93  /**
94  * @see armarx::ManagedIceObject::onInitComponent()
95  */
96  void onInitComponent() override;
97 
98  /**
99  * @see armarx::ManagedIceObject::onConnectComponent()
100  */
101  void onConnectComponent() override;
102 
103  /**
104  * @see armarx::ManagedIceObject::onDisconnectComponent()
105  */
106  void onDisconnectComponent() override;
107 
108  /**
109  * @see armarx::ManagedIceObject::onExitComponent()
110  */
111  void onExitComponent() override;
112 
113  /**
114  * @see PropertyUser::createPropertyDefinitions()
115  */
117 
118  private:
119  std::vector<RemoteHandle<MotionPlanningTaskControlInterfacePrx>> planningTasks;
120  armarx::RobotStateComponentInterfacePrx robotStateComponent;
121  VirtualRobot::RobotPtr localRobot;
122  MotionPlanningServerInterfacePrx mps;
123  int maxPostProcessingSteps;
124 
125  // how to make those public?
126 
127  TrajectoryPtr calculateJointTrajectory(const SimoxCSpaceBasePtr& cSpaceBase, const MotionPlanningData& mpd,
128  const Ice::Current& c = Ice::emptyCurrent);
129 
130  TrajectoryPtr calculatePlatformTrajectory(const SimoxCSpaceBasePtr& cSpacePlatformBase,
131  const MotionPlanningData& mpd,
132  const Ice::Current& c = Ice::emptyCurrent);
133  void preparePlatformCSpace(SimoxCSpacePtr cSpacePlatform, const MotionPlanningData& mpd,
134  VectorXf* storeStart, VectorXf* storeGoal,
135  ScaledCSpacePtr* storeScaledCSpace, Eigen::Vector3f* storeRpyAgent);
136  void prepareJointCSpace(SimoxCSpacePtr cSpace, const MotionPlanningData& mpd,
137  VectorXf* storeStart, VectorXf* storeGoal, ScaledCSpacePtr* storeScaledCSpace);
138 
139  RemoteHandle<MotionPlanningTaskControlInterfacePrx> startBiRRT(ScaledCSpacePtr scaledCSpace, VectorXf startPos,
140  VectorXf goalPos, float dcdStep, bool doRandomShortcutPostProcessing = false);
141  Path finishBiRRT(RemoteHandle<MotionPlanningTaskControlInterfacePrx> handle, const ScaledCSpacePtr scaledCSpace,
142  const std::string roboPart);
143  };
144 }
145 
armarx::PlannedMotionProvider::onExitComponent
void onExitComponent() override
Definition: PlannedMotionProvider.cpp:112
armarx::PlannedMotionProvider::onConnectComponent
void onConnectComponent() override
Definition: PlannedMotionProvider.cpp:98
RemoteHandle.h
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
IceInternal::Handle< Trajectory >
armarx::PlannedMotionProvider::planPlatformMotion
TrajectoryBasePtr planPlatformMotion(const SimoxCSpaceBasePtr &cSpacePlatformBase, const MotionPlanningData &mpd, const Ice::Current &c=Ice::emptyCurrent) override
Definition: PlannedMotionProvider.cpp:131
armarx::PlannedMotionProvider::onDisconnectComponent
void onDisconnectComponent() override
Definition: PlannedMotionProvider.cpp:106
armarx::PlannedMotionProviderPropertyDefinitions::PlannedMotionProviderPropertyDefinitions
PlannedMotionProviderPropertyDefinitions(std::string prefix)
Definition: PlannedMotionProvider.h:43
MotionPlanningObjectFactories.h
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
armarx::PlannedMotionProvider::planJointMotion
TrajectoryBasePtr planJointMotion(const SimoxCSpaceBasePtr &cSpaceBase, const MotionPlanningData &mpd, const Ice::Current &c=Ice::emptyCurrent) override
Definition: PlannedMotionProvider.cpp:123
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:70
armarx::PlannedMotionProvider::getDefaultName
std::string getDefaultName() const override
Definition: PlannedMotionProvider.h:71
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::PlannedMotionProviderPropertyDefinitions
Definition: PlannedMotionProvider.h:39
armarx::PlannedMotionProvider::onInitComponent
void onInitComponent() override
Definition: PlannedMotionProvider.cpp:89
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:45
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:63
armarx::PlannedMotionProvider::planMotion
GraspingTrajectory planMotion(const SimoxCSpaceBasePtr &cSpaceBase, const SimoxCSpaceBasePtr &cSpacePlatformBase, const MotionPlanningData &mpd, const Ice::Current &c=Ice::emptyCurrent) override
Definition: PlannedMotionProvider.cpp:38
armarx::PlannedMotionProvider::planMotionParallel
GraspingTrajectory planMotionParallel(const SimoxCSpaceBasePtr &cSpaceBase, const SimoxCSpaceBasePtr &cSpacePlatformBase, const MotionPlanningData &mpd, const Ice::Current &c) override
Definition: PlannedMotionProvider.cpp:50
armarx::PlannedMotionProvider::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: PlannedMotionProvider.cpp:117
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18