PlatformUnit.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2012-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 ArmarXCore::units
19  * @author Manfred Kroehnert (Manfred dot Kroehnert at kit dot edu)
20  * @date 2013
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 #pragma once
26 
27 #include <vector>
28 
31 
33 #include <RobotAPI/interface/core/RobotState.h>
34 #include <RobotAPI/interface/units/PlatformUnitInterface.h>
35 
36 namespace armarx
37 {
38 
39  /**
40  * \class PlatformUnitPropertyDefinitions
41  * \brief Defines all necessary properties for armarx::PlatformUnit
42  */
44  {
45  public:
47  {
48  defineOptionalProperty<std::string>(
49  "PlatformName",
50  "Platform",
51  "Name of the platform (will publish values on PlatformName + 'State')");
52  }
53  };
54 
55  /**
56  * \defgroup Component-PlatformUnit PlatformUnit
57  * \ingroup RobotAPI-SensorActorUnits
58  * \brief Base unit for high-level access to robot platforms.
59  *
60  * This class defines an interface for providing high level access to robot platforms
61  * An instance of a PlatformUnit provides means to set target positions.
62  * It uses the PlatformUnitListener Ice interface to report updates of its current state.
63  */
64 
65  /**
66  * @ingroup Component-PlatformUnit
67  * @brief The PlatformUnit class
68  */
69  class PlatformUnit : virtual public PlatformUnitInterface, virtual public SensorActorUnit
70  {
71  public:
72  // inherited from Component
73  std::string
74  getDefaultName() const override
75  {
76  return "PlatformUnit";
77  }
78 
79  /**
80  * Retrieve proxy for publishing State information and call
81  * armarx::PlatformUnit::onInitPlatformUnit().
82  * \see armarx::Component::onInitComponent()
83  */
84  void onInitComponent() override;
85  /**
86  * Calls armarx::PlatformUnit::onStartPlatformUnit().
87  * \see armarx::Component::onConnectComponent()
88  */
89  void onConnectComponent() override;
90 
91  void onDisconnectComponent() override;
92  /**
93  * Calls armarx::PlatformUnit::onExitPlatformUnit().
94  * \see armarx::Component::onExitComponent()
95  */
96  void onExitComponent() override;
97 
98  virtual void onInitPlatformUnit() = 0;
99  virtual void onStartPlatformUnit() = 0;
100 
101  virtual void
103  {
104  }
105 
106  virtual void onExitPlatformUnit() = 0;
107 
108  /**
109  * Set a new target position and orientation for the platform.
110  * The platform will move until it reaches the specified target with the specified accuracy.
111  */
112  void moveTo(Ice::Float targetPlatformPositionX,
113  Ice::Float targetPlatformPositionY,
114  Ice::Float targetPlatformRotation,
115  Ice::Float positionalAccuracy,
116  Ice::Float orientationalAccuracy,
117  const Ice::Current& c = Ice::emptyCurrent) override;
118 
119  void
120  stopPlatform(const Ice::Current& c = Ice::emptyCurrent) override
121  {
122  }
123 
124  /**
125  * \see armarx::PropertyUser::createPropertyDefinitions()
126  */
128 
129  protected:
130  // std::string listenerChannelName;
131  /**
132  * PlatformUnitListener proxy for publishing state updates
133  */
134  PlatformUnitListenerPrx listenerPrx;
135 
136  GlobalRobotPoseLocalizationListenerPrx globalPosePrx;
137  OdometryListenerPrx odometryPrx;
138 
140  };
141 
142  PlatformPose toPlatformPose(const TransformStamped& transformStamped);
143 } // namespace armarx
armarx::PlatformUnit::moveTo
void moveTo(Ice::Float targetPlatformPositionX, Ice::Float targetPlatformPositionY, Ice::Float targetPlatformRotation, Ice::Float positionalAccuracy, Ice::Float orientationalAccuracy, const Ice::Current &c=Ice::emptyCurrent) override
Set a new target position and orientation for the platform.
Definition: PlatformUnit.cpp:76
armarx::PlatformUnit::onExitPlatformUnit
virtual void onExitPlatformUnit()=0
armarx::VariantType::Float
const VariantTypeId Float
Definition: Variant.h:919
armarx::PlatformUnit::onStartPlatformUnit
virtual void onStartPlatformUnit()=0
Properties.h
armarx::PlatformUnit::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: PlatformUnit.h:74
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
armarx::PlatformUnit::listenerPrx
PlatformUnitListenerPrx listenerPrx
PlatformUnitListener proxy for publishing state updates.
Definition: PlatformUnit.h:134
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
armarx::PlatformUnit::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: PlatformUnit.cpp:64
armarx::PlatformUnitPropertyDefinitions
Defines all necessary properties for armarx::PlatformUnit.
Definition: PlatformUnit.h:43
armarx::PlatformUnit::stopPlatform
void stopPlatform(const Ice::Current &c=Ice::emptyCurrent) override
Definition: PlatformUnit.h:120
armarx::PlatformUnit
The PlatformUnit class.
Definition: PlatformUnit.h:69
armarx::PlatformUnit::onConnectComponent
void onConnectComponent() override
Calls armarx::PlatformUnit::onStartPlatformUnit().
Definition: PlatformUnit.cpp:58
SensorActorUnit.h
armarx::PlatformUnit::robotStateComponent
RobotStateComponentInterfacePrx robotStateComponent
Definition: PlatformUnit.h:139
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:69
IceUtil::Handle
Definition: forward_declarations.h:30
IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface >
armarx::SensorActorUnit
Base Class for SensorActorUnits.
Definition: SensorActorUnit.h:43
armarx::PlatformUnit::odometryPrx
OdometryListenerPrx odometryPrx
Definition: PlatformUnit.h:137
armarx::PlatformUnit::onStopPlatformUnit
virtual void onStopPlatformUnit()
Definition: PlatformUnit.h:102
armarx::toPlatformPose
PlatformPose toPlatformPose(const TransformStamped &transformStamped)
Definition: PlatformUnit.cpp:86
armarx::PlatformUnitPropertyDefinitions::PlatformUnitPropertyDefinitions
PlatformUnitPropertyDefinitions(std::string prefix)
Definition: PlatformUnit.h:46
armarx::PlatformUnit::onInitPlatformUnit
virtual void onInitPlatformUnit()=0
armarx::PlatformUnit::onExitComponent
void onExitComponent() override
Calls armarx::PlatformUnit::onExitPlatformUnit().
Definition: PlatformUnit.cpp:70
armarx::PlatformUnit::createPropertyDefinitions
PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: PlatformUnit.cpp:35
armarx::PlatformUnit::onInitComponent
void onInitComponent() override
Retrieve proxy for publishing State information and call armarx::PlatformUnit::onInitPlatformUnit().
Definition: PlatformUnit.cpp:50
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::PlatformUnit::globalPosePrx
GlobalRobotPoseLocalizationListenerPrx globalPosePrx
Definition: PlatformUnit.h:136
ImportExportComponent.h