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
32namespace 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
62
63 void
68
69 void
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
constexpr T c
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition Component.cpp:90
Property< PropertyType > getProperty(const std::string &name)
Defines all necessary properties for armarx::PlatformUnit.
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 onExitComponent() override
Calls armarx::PlatformUnit::onExitPlatformUnit().
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.