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