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