GetObjectPose.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::GraspObjectGroup
19  * @author David ( david dot schiebener at 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 "GetObjectPose.h"
26 
27 #include "VisualServoGroupStatechartContext.generated.h"
28 
29 
30 using namespace armarx;
31 using namespace VisualServoGroup;
32 
33 
34 // DO NOT EDIT NEXT LINE
36 
37 
38 
40  XMLStateTemplate < GetObjectPose > (stateData),
41  GetObjectPoseGeneratedBase<GetObjectPose>(stateData)
42 {
43 }
44 
45 
46 
48 {
49  VisualServoGroupStatechartContext* context = getContext<VisualServoGroupStatechartContext>();
50 
51  ChannelRefPtr objectInstance = in.getObjectInstanceChannel();
52  ARMARX_VERBOSE << "getting Object pose from localization";
53  FramedPositionPtr position = objectInstance->get<FramedPosition>("position");
54  FramedOrientationPtr orientation = objectInstance->get<FramedOrientation>("orientation");
55  float posUncertainty = objectInstance->get<float>("uncertaintyOfPosition");
56  ARMARX_INFO << "position Uncertainty " << posUncertainty;
57  FramedPosePtr objectPose = new FramedPose(orientation->toEigen(), position->toEigen(), position->getFrame(), position->agent);
58 
59  ARMARX_VERBOSE << "Object pose from localization: " << objectPose->output();
60 
61  // convert pose to root frame
62  objectPose->changeFrame(context->getRobot(), context->getRobot()->getRootNode()->getName());
63 
64  context->getDebugDrawerTopic()->setPoseDebugLayerVisu("objectPose", objectPose->toGlobal(getRobot()));
65  out.setObjectPose(objectPose);
66  emitObjectPoseAvailable();
67 }
68 
69 
70 
71 
72 
74 {
75  // put your user code for the breaking point here
76  // execution time should be short (<100ms)
77 
78 }
79 
80 
81 
83 {
84  // put your user code for the exit point here
85  // execution time should be short (<100ms)
86 }
87 
88 
89 
90 // DO NOT EDIT NEXT FUNCTION
92 {
93  return "GetObjectPose";
94 }
95 
96 
97 
98 // DO NOT EDIT NEXT FUNCTION
100 {
101  return XMLStateFactoryBasePtr(new GetObjectPose(stateData));
102 }
103 
ARMARX_VERBOSE
#define ARMARX_VERBOSE
Definition: Logging.h:180
armarx::VisualServoGroup::GetObjectPose::Registry
static SubClassRegistry Registry
Definition: GetObjectPose.h:49
armarx::VariantType::FramedPose
const VariantTypeId FramedPose
Definition: FramedPose.h:37
armarx::XMLStateConstructorParams
Definition: XMLState.h:50
armarx::VisualServoGroup::GetObjectPose
Definition: GetObjectPose.h:35
armarx::VisualServoGroup::GetObjectPose::onExit
void onExit() override
Definition: GetObjectPose.cpp:82
armarx::VisualServoGroup::GetObjectPose::CreateInstance
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
Definition: GetObjectPose.cpp:99
IceInternal::Handle< ChannelRef >
armarx::VisualServoGroup::GetObjectPose::GetObjectPose
GetObjectPose(XMLStateConstructorParams stateData)
Definition: GetObjectPose.cpp:39
armarx::XMLStateTemplate
Class for legacy to stay compatible with old statecharts.
Definition: XMLState.h:137
armarx::FramedPosition
The FramedPosition class.
Definition: FramedPose.h:142
GetObjectPose.h
armarx::FramedOrientation
The FramedOrientation class.
Definition: FramedPose.h:199
armarx::VisualServoGroup::GetObjectPose::onEnter
void onEnter() override
Definition: GetObjectPose.cpp:47
armarx::XMLStateFactoryBasePtr
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
Definition: XMLState.h:65
armarx::VisualServoGroup::GetObjectPose::GetName
static std::string GetName()
Definition: GetObjectPose.cpp:91
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
armarx::VisualServoGroup::GetObjectPose::onBreak
void onBreak() override
Definition: GetObjectPose.cpp:73
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28