RobotPoseUnit.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 Nikolaus Vahrenkamp (vahrenkamp at kit dot edu)
20  * @date 2016
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/units/RobotPoseUnitInterface.h>
34 
35 namespace armarx
36 {
37  /**
38  * \class RobotPoseUnitPropertyDefinitions
39  * \brief Defines all necessary properties for armarx::RobotPoseUnit
40  */
42  {
43  public:
45  {
46  defineOptionalProperty<std::string>(
47  "RobotName",
48  "Robot",
49  "Name of the Robot (will publish values on RobotName + '6DPoseState')");
50  }
51  };
52 
53  /**
54  * \defgroup Component-RobotPoseUnit RobotPoseUnit
55  * \ingroup RobotAPI-SensorActorUnits
56  * \brief Base unit for high-level access to robot poses.
57  *
58  * This class defines an interface for providing high level access to the robot's pose in the world.
59  * This unit usually does not exiust on a real robot (instead, use the @see PlatformUnit for moving a platform based robot around).
60  * In simulated worlds, this unit allows to position the robot globally in the envirnoment (@see RobotPoseUnitDynamicSimulation).
61  * It uses the RobotPoseUnitListener Ice interface to report updates of its current state.
62  */
63 
64  /**
65  * @ingroup Component-RobotPoseUnit
66  * @brief The RobotPoseUnit class
67  */
68  class RobotPoseUnit : virtual public RobotPoseUnitInterface, virtual public SensorActorUnit
69  {
70  public:
71  // inherited from Component
72  std::string
73  getDefaultName() const override
74  {
75  return "RobotPoseUnit";
76  }
77 
78  /**
79  * Retrieve proxy for publishing State information and call
80  * armarx::RobotPoseUnit::onInitRobotPoseUnit().
81  * \see armarx::Component::onInitComponent()
82  */
83  void onInitComponent() override;
84  /**
85  * Calls armarx::RobotPoseUnit::onStartRobotPoseUnit().
86  * \see armarx::Component::onConnectComponent()
87  */
88  void onConnectComponent() override;
89 
90  void onDisconnectComponent() override;
91  /**
92  * Calls armarx::RobotPoseUnit::onExitRobotPoseUnit().
93  * \see armarx::Component::onExitComponent()
94  */
95  void onExitComponent() override;
96 
97  virtual void onInitRobotPoseUnit() = 0;
98  virtual void onStartRobotPoseUnit() = 0;
99 
100  virtual void
102  {
103  }
104 
105  virtual void onExitRobotPoseUnit() = 0;
106 
107  /**
108  * moveTo moves the robot to a global pose specified by:
109  * @param targetPose Global target pose
110  * @param postionalAccuracy Robot stops translating if distance to target position gets lower than this threshhold.
111  * @param orientationalAccuracy Robot stops rotating if distance from current to target orientation gets lower than this threshhold.
112  **/
113  virtual void moveTo(PoseBasePtr targetPose,
114  Ice::Float positionalAccuracy,
115  Ice::Float orientationalAccuracy,
116  const Ice::Current& c = Ice::emptyCurrent);
117 
118  void
119  stopMovement(const Ice::Current& c = Ice::emptyCurrent) override
120  {
121  }
122 
123  /**
124  * \see armarx::PropertyUser::createPropertyDefinitions()
125  */
127 
128  protected:
129  /**
130  * RobotPoseUnitListener proxy for publishing state updates
131  */
132  RobotPoseUnitListenerPrx listenerPrx;
133  /**
134  * Ice Topic name on which armarx::RobotPoseUnit::listenerPrx publishes information
135  */
136  std::string listenerChannelName;
137  };
138 } // namespace armarx
armarx::RobotPoseUnit::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: RobotPoseUnit.h:73
armarx::RobotPoseUnit::stopMovement
void stopMovement(const Ice::Current &c=Ice::emptyCurrent) override
Definition: RobotPoseUnit.h:119
armarx::VariantType::Float
const VariantTypeId Float
Definition: Variant.h:919
armarx::RobotPoseUnit::onExitRobotPoseUnit
virtual void onExitRobotPoseUnit()=0
Properties.h
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
armarx::RobotPoseUnit::listenerChannelName
std::string listenerChannelName
Ice Topic name on which armarx::RobotPoseUnit::listenerPrx publishes information.
Definition: RobotPoseUnit.h:136
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
armarx::RobotPoseUnit::listenerPrx
RobotPoseUnitListenerPrx listenerPrx
RobotPoseUnitListener proxy for publishing state updates.
Definition: RobotPoseUnit.h:132
SensorActorUnit.h
armarx::RobotPoseUnit::moveTo
virtual void moveTo(PoseBasePtr targetPose, Ice::Float positionalAccuracy, Ice::Float orientationalAccuracy, const Ice::Current &c=Ice::emptyCurrent)
moveTo moves the robot to a global pose specified by:
Definition: RobotPoseUnit.cpp:66
armarx::RobotPoseUnit::onExitComponent
void onExitComponent() override
Calls armarx::RobotPoseUnit::onExitRobotPoseUnit().
Definition: RobotPoseUnit.cpp:60
armarx::RobotPoseUnit
The RobotPoseUnit class.
Definition: RobotPoseUnit.h:68
armarx::RobotPoseUnit::onStartRobotPoseUnit
virtual void onStartRobotPoseUnit()=0
armarx::RobotPoseUnit::onInitRobotPoseUnit
virtual void onInitRobotPoseUnit()=0
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:69
armarx::RobotPoseUnitPropertyDefinitions
Defines all necessary properties for armarx::RobotPoseUnit.
Definition: RobotPoseUnit.h:41
IceUtil::Handle
Definition: forward_declarations.h:30
armarx::SensorActorUnit
Base Class for SensorActorUnits.
Definition: SensorActorUnit.h:43
armarx::RobotPoseUnit::onStopRobotPoseUnit
virtual void onStopRobotPoseUnit()
Definition: RobotPoseUnit.h:101
armarx::RobotPoseUnit::onConnectComponent
void onConnectComponent() override
Calls armarx::RobotPoseUnit::onStartRobotPoseUnit().
Definition: RobotPoseUnit.cpp:43
armarx::RobotPoseUnit::createPropertyDefinitions
PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: RobotPoseUnit.cpp:74
armarx::RobotPoseUnit::onInitComponent
void onInitComponent() override
Retrieve proxy for publishing State information and call armarx::RobotPoseUnit::onInitRobotPoseUnit()...
Definition: RobotPoseUnit.cpp:31
armarx::RobotPoseUnit::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: RobotPoseUnit.cpp:52
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::RobotPoseUnitPropertyDefinitions::RobotPoseUnitPropertyDefinitions
RobotPoseUnitPropertyDefinitions(std::string prefix)
Definition: RobotPoseUnit.h:44
ImportExportComponent.h