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 #include "PlatformContext.h"
28 
31 
32 #include "PlatformGroupStatechartContext.generated.h"
33 
34 using namespace armarx;
35 using namespace PlatformGroup;
36 
37 // DO NOT EDIT NEXT LINE
38 MovePlatform::SubClassRegistry MovePlatform::Registry(MovePlatform::GetName(), &MovePlatform::CreateInstance);
39 
40 
41 
43  XMLStateTemplate<MovePlatform>(stateData),
44  MovePlatformGeneratedBase<MovePlatform> (stateData)
45 {
46 
47 
48 
49 }
50 
52 {
53  PlatformContext* c = getContext<PlatformContext>();
54  ChannelRefPtr counter = ChannelRefPtr::dynamicCast(c->systemObserverPrx->startCounter(0, "PlatformPositionCounter"));
55  local.setpositionCounter(counter);
56 
57  ARMARX_INFO << "getinput";
58  SingleTypeVariantListPtr points = getInput<SingleTypeVariantList>("targetPositions");
59 
60  std::vector<Eigen::Vector3f> path;
61 
62  ARMARX_INFO << "access points";
63 
64  path.reserve(points->getSize());
65 
66  ARMARX_INFO << "Conversion";
67 
68  for (int i = 0; i < points->getSize(); i++)
69  {
70  Vector3Ptr point = points->getVariant(i)->get<Vector3>();
71  if (point)
72  {
73  path.emplace_back(Eigen::Vector3f{point->x, point->y, point->z});
74  }
75  }
76 
77  ARMARX_INFO << "Arviz";
78 
79  ARMARX_INFO << "arviz connecting...";
80 
81 
82 
83  ARMARX_INFO << __LINE__;
84 
85  ARMARX_INFO << __LINE__;
86 
87  viz::Client arviz(*c);
88 
89 
90 
91  ARMARX_INFO << __LINE__;
92 
93  // const auto& arviz = getArvizTopic();
94  ARMARX_INFO << "arviz connecting2...";
95 
96  // auto client = viz::Client::createFromTopic("MovePlatform", getArvizTopic());
97 
98  arvizClient.reset(new viz::ScopedClient(arviz));
99 
100  ARMARX_INFO << "arviz connected.";
101 
102  auto layer = arvizClient->layer("path");
103  layer.add(viz::Path("path").points(path));
104  arvizClient->commit({layer});
105 }
106 
108 {
109  PlatformContext* c = getContext<PlatformContext>();
110 
111 
112  ChannelRefPtr r = local.getpositionCounter();
113  c->systemObserverPrx->removeCounter(r);
114  PlatformContext* context = getContext<PlatformContext>();
115  context->platformUnitPrx->move(0, 0, 0);
116 }
117 
118 
119 // DO NOT EDIT NEXT FUNCTION
121 {
122  return XMLStateFactoryBasePtr(new MovePlatform(stateData));
123 }
124 
Client.h
armarx::PlatformGroup::MovePlatform::Registry
static SubClassRegistry Registry
Definition: MovePlatform.h:49
Path.h
armarx::PlatformGroup::MovePlatform::CreateInstance
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
Definition: MovePlatform.cpp:120
armarx::PlatformGroup::MovePlatform::onExit
void onExit() override
Definition: MovePlatform.cpp:107
armarx::XMLStateConstructorParams
Definition: XMLState.h:50
armarx::viz::ScopedClient
viz::Client that will delete (clear) committed layers when destroyed.
Definition: ScopedClient.h:42
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
StatechartContext.h
armarx::PlatformGroup::MovePlatform::MovePlatform
MovePlatform(XMLStateConstructorParams stateData)
Definition: MovePlatform.cpp:42
IceInternal::Handle< ChannelRef >
armarx::XMLStateTemplate
Class for legacy to stay compatible with old statecharts.
Definition: XMLState.h:137
armarx::Vector3
The Vector3 class.
Definition: Pose.h:112
MovePlatform.h
armarx::XMLStateFactoryBasePtr
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
Definition: XMLState.h:65
PlatformContext.h
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
armarx::PlatformGroup::MovePlatform::onEnter
void onEnter() override
Definition: MovePlatform.cpp:51
armarx::PlatformContext::platformUnitPrx
PlatformUnitInterfacePrx platformUnitPrx
Definition: PlatformContext.h:120
armarx::PlatformContext
Definition: PlatformContext.h:64
armarx::viz::Path
Definition: Path.h:31
armarx::viz::Client
Definition: Client.h:109
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::PlatformGroup::MovePlatform
Definition: MovePlatform.h:37