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
30using namespace armarx;
31using namespace VisualServoGroup;
32
33
34// DO NOT EDIT NEXT LINE
35GetObjectPose::SubClassRegistry GetObjectPose::Registry(GetObjectPose::GetName(),
37
39 XMLStateTemplate<GetObjectPose>(stateData), GetObjectPoseGeneratedBase<GetObjectPose>(stateData)
40{
41}
42
43void
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
68void
70{
71 // put your user code for the breaking point here
72 // execution time should be short (<100ms)
73}
74
75void
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
83std::string
85{
86 return "GetObjectPose";
87}
88
89// DO NOT EDIT NEXT FUNCTION
The FramedOrientation class.
Definition FramedPose.h:216
The FramedPose class.
Definition FramedPose.h:281
The FramedPosition class.
Definition FramedPose.h:158
GetObjectPose(XMLStateConstructorParams stateData)
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
Class for legacy to stay compatible with old statecharts.
Definition XMLState.h:147
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
#define ARMARX_VERBOSE
The logging level for verbose information.
Definition Logging.h:187
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< ChannelRef > ChannelRefPtr
Definition ChannelRef.h:40
IceInternal::Handle< FramedPosition > FramedPositionPtr
Definition FramedPose.h:149
IceInternal::Handle< FramedOrientation > FramedOrientationPtr
Definition FramedPose.h:207
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
Definition XMLState.h:64
IceInternal::Handle< FramedPose > FramedPosePtr
Definition FramedPose.h:272