PlatformUnit.cpp
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 
26 #include "PlatformUnit.h"
27 
28 #include <SimoxUtility/math/convert/mat4f_to_rpy.h>
29 
31 
32 namespace armarx
33 {
36  {
39 
40  def->topic(odometryPrx);
41  def->topic(globalPosePrx);
42  def->topic(listenerPrx, "PlatformState");
43 
44  def->component(robotStateComponent);
45 
46  return def;
47  }
48 
49  void
51  {
52  std::string platformName = getProperty<std::string>("PlatformName").getValue();
53 
54  this->onInitPlatformUnit();
55  }
56 
57  void
59  {
60  this->onStartPlatformUnit();
61  }
62 
63  void
65  {
66  this->onStopPlatformUnit();
67  }
68 
69  void
71  {
72  this->onExitPlatformUnit();
73  }
74 
75  void
76  PlatformUnit::moveTo(Ice::Float targetPlatformPositionX,
77  Ice::Float targetPlatformPositionY,
78  Ice::Float targetPlatformRotation,
79  Ice::Float positionalAccuracy,
80  Ice::Float orientationalAccuracy,
81  const Ice::Current& c)
82  {
83  }
84 
85  PlatformPose
86  toPlatformPose(const TransformStamped& transformStamped)
87  {
88  const float yaw = simox::math::mat4f_to_rpy(transformStamped.transform).z();
89  const Eigen::Affine3f pose(transformStamped.transform);
90 
91  PlatformPose platformPose;
92  platformPose.x = pose.translation().x();
93  platformPose.y = pose.translation().y();
94  platformPose.rotationAroundZ = yaw;
95  platformPose.timestampInMicroSeconds = transformStamped.header.timestampInMicroSeconds;
96 
97  return platformPose;
98  }
99 
100 } // 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
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::onConnectComponent
void onConnectComponent() override
Calls armarx::PlatformUnit::onStartPlatformUnit().
Definition: PlatformUnit.cpp:58
armarx::Component::getConfigIdentifier
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition: Component.cpp:79
armarx::channels::PlatformUnitObserver::platformPose
const PlatformUnitDatafieldCreator platformPose("platformPose")
armarx::PlatformUnit::robotStateComponent
RobotStateComponentInterfacePrx robotStateComponent
Definition: PlatformUnit.h:139
PropertyDefinitionContainer.h
PlatformUnit.h
IceUtil::Handle< class PropertyDefinitionContainer >
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::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:35
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