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
36namespace armarx
37{
38
39 /**
40 * \class PlatformUnitPropertyDefinitions
41 * \brief Defines all necessary properties for armarx::PlatformUnit
42 */
44 {
45 public:
47 {
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
constexpr T c
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition Component.cpp:46
PlatformUnitPropertyDefinitions(std::string prefix)
The PlatformUnit class.
void onInitComponent() override
Retrieve proxy for publishing State information and call armarx::PlatformUnit::onInitPlatformUnit().
PlatformUnitListenerPrx listenerPrx
PlatformUnitListener proxy for publishing state updates.
virtual void onExitPlatformUnit()=0
virtual void onStartPlatformUnit()=0
void onDisconnectComponent() override
Hook for subclass.
RobotStateComponentInterfacePrx robotStateComponent
virtual void onInitPlatformUnit()=0
OdometryListenerPrx odometryPrx
GlobalRobotPoseLocalizationListenerPrx globalPosePrx
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.
void onConnectComponent() override
Calls armarx::PlatformUnit::onStartPlatformUnit().
PropertyDefinitionsPtr createPropertyDefinitions() override
virtual void onStopPlatformUnit()
void stopPlatform(const Ice::Current &c=Ice::emptyCurrent) override
void onExitComponent() override
Calls armarx::PlatformUnit::onExitPlatformUnit().
std::string getDefaultName() const override
Retrieve default name of component.
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)
SensorActorUnit()
Constructs a SensorActorUnit.
This file offers overloads of toIce() and fromIce() functions for STL container types.
PlatformPose toPlatformPose(const TransformStamped &transformStamped)
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
::IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface > RobotStateComponentInterfacePrx