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 
35 using namespace armarx;
36 using namespace PlatformGroup;
37 
38 // DO NOT EDIT NEXT LINE
39 MovePlatform::SubClassRegistry MovePlatform::Registry(MovePlatform::GetName(),
41 
43  XMLStateTemplate<MovePlatform>(stateData), MovePlatformGeneratedBase<MovePlatform>(stateData)
44 {
45 }
46 
47 void
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 
103 void
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
118 {
119  return XMLStateFactoryBasePtr(new MovePlatform(stateData));
120 }
Client.h
armarx::PlatformGroup::MovePlatform::Registry
static SubClassRegistry Registry
Definition: MovePlatform.h:48
Path.h
armarx::PlatformGroup::MovePlatform::CreateInstance
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
Definition: MovePlatform.cpp:117
armarx::PlatformGroup::MovePlatform::onExit
void onExit() override
Definition: MovePlatform.cpp:104
armarx::XMLStateConstructorParams
Definition: XMLState.h:49
armarx::viz::ScopedClient
viz::Client that will delete (clear) committed layers when destroyed.
Definition: ScopedClient.h:42
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
StatechartContext.h
armarx::XMLStateFactoryBasePtr
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
Definition: XMLState.h:64
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:146
armarx::Vector3
The Vector3 class.
Definition: Pose.h:112
MovePlatform.h
PlatformContext.h
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:181
armarx::PlatformGroup::MovePlatform::onEnter
void onEnter() override
Definition: MovePlatform.cpp:48
armarx::PlatformContext::platformUnitPrx
PlatformUnitInterfacePrx platformUnitPrx
Definition: PlatformContext.h:143
armarx::PlatformContext
Definition: PlatformContext.h:77
armarx::viz::Path
Definition: Path.h:31
armarx::viz::Client
Definition: Client.h:117
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::PlatformGroup::MovePlatform
Definition: MovePlatform.h:37