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