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