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
33namespace armarx
34{
35 /**
36 * @class PlannedMotionProviderPropertyDefinitions
37 * @brief
38 */
40 {
41 public:
44 {
45 //defineRequiredProperty<std::string>("PropertyName", "Description");
47 "JointMotionSafetyMargin", 80.0f, "Safety margin for joint arm motion in mm");
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
constexpr T c
Default component property definition container.
Definition Component.h:70
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition Component.cpp:46
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
Brief description of class PlannedMotionProvider.
GraspingTrajectory planMotion(const SimoxCSpaceBasePtr &cSpaceBase, const SimoxCSpaceBasePtr &cSpacePlatformBase, const MotionPlanningData &mpd, const Ice::Current &c=Ice::emptyCurrent) override
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
TrajectoryBasePtr planPlatformMotion(const SimoxCSpaceBasePtr &cSpacePlatformBase, const MotionPlanningData &mpd, const Ice::Current &c=Ice::emptyCurrent) override
TrajectoryBasePtr planJointMotion(const SimoxCSpaceBasePtr &cSpaceBase, const MotionPlanningData &mpd, const Ice::Current &c=Ice::emptyCurrent) override
GraspingTrajectory planMotionParallel(const SimoxCSpaceBasePtr &cSpaceBase, const SimoxCSpaceBasePtr &cSpacePlatformBase, const MotionPlanningData &mpd, const Ice::Current &c) override
std::string getDefaultName() const override
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
The RemoteHandle class wrapps a ClientSideRemoteHandleControlBlock and can be used just as a Ice prox...
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< ScaledCSpace > ScaledCSpacePtr
An ice handle to a ScaledCSpace.
IceInternal::Handle< Trajectory > TrajectoryPtr
Definition Trajectory.h:52
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
::IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface > RobotStateComponentInterfacePrx
IceInternal::Handle< SimoxCSpace > SimoxCSpacePtr
An ice handle for a SimoxCSpace.
Definition SimoxCSpace.h:56