MovePlatform.cpp
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2014-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 RobotSkillTemplates::MovePlatformToLandmarkGroup
19 * @author Valerij Wittenbeck ( valerij dot wittenbeck at student dot kit dot edu )
20 * @date 2014
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25#include "MovePlatform.h"
26
28
31
32#include "PlatformContext.h"
33#include "PlatformGroupStatechartContext.generated.h"
34
35using namespace armarx;
36using namespace PlatformGroup;
37
38// DO NOT EDIT NEXT LINE
39MovePlatform::SubClassRegistry MovePlatform::Registry(MovePlatform::GetName(),
41
43 XMLStateTemplate<MovePlatform>(stateData), MovePlatformGeneratedBase<MovePlatform>(stateData)
44{
45}
46
47void
49{
50 PlatformContext* c = getContext<PlatformContext>();
51 ChannelRefPtr counter = ChannelRefPtr::dynamicCast(
52 c->systemObserverPrx->startCounter(0, "PlatformPositionCounter"));
53 local.setpositionCounter(counter);
54
55 ARMARX_INFO << "getinput";
56 SingleTypeVariantListPtr points = getInput<SingleTypeVariantList>("targetPositions");
57
58 std::vector<Eigen::Vector3f> path;
59
60 ARMARX_INFO << "access points";
61
62 path.reserve(points->getSize());
63
64 ARMARX_INFO << "Conversion";
65
66 for (int i = 0; i < points->getSize(); i++)
67 {
68 Vector3Ptr point = points->getVariant(i)->get<Vector3>();
69 if (point)
70 {
71 path.emplace_back(Eigen::Vector3f{point->x, point->y, point->z});
72 }
73 }
74
75 ARMARX_INFO << "Arviz";
76
77 ARMARX_INFO << "arviz connecting...";
78
79
80 ARMARX_INFO << __LINE__;
81
82 ARMARX_INFO << __LINE__;
83
84 viz::Client arviz(*c);
85
86
87 ARMARX_INFO << __LINE__;
88
89 // const auto& arviz = getArvizTopic();
90 ARMARX_INFO << "arviz connecting2...";
91
92 // auto client = viz::Client::createFromTopic("MovePlatform", getArvizTopic());
93
94 arvizClient.reset(new viz::ScopedClient(arviz));
95
96 ARMARX_INFO << "arviz connected.";
97
98 auto layer = arvizClient->layer("path");
99 layer.add(viz::Path("path").points(path));
100 arvizClient->commit({layer});
101}
102
103void
105{
106 PlatformContext* c = getContext<PlatformContext>();
107
108
109 ChannelRefPtr r = local.getpositionCounter();
110 c->systemObserverPrx->removeCounter(r);
111 PlatformContext* context = getContext<PlatformContext>();
112 context->platformUnitPrx->move(0, 0, 0);
113}
114
115// DO NOT EDIT NEXT FUNCTION
constexpr T c
PlatformUnitInterfacePrx platformUnitPrx
static SubClassRegistry Registry
MovePlatform(XMLStateConstructorParams stateData)
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
The Vector3 class.
Definition Pose.h:113
Class for legacy to stay compatible with old statecharts.
Definition XMLState.h:147
viz::Client that will delete (clear) committed layers when destroyed.
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< SingleTypeVariantList > SingleTypeVariantListPtr
IceInternal::Handle< Vector3 > Vector3Ptr
Definition Pose.h:165
IceInternal::Handle< ChannelRef > ChannelRefPtr
Definition ChannelRef.h:40
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
Definition XMLState.h:64