CartesianMultipleRelativePositionsControl.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::MotionControlGroup
19 * @author Simon Ottenhaus ( simon dot ottenhaus at kit dot edu )
20 * @date 2015
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
26#include <VirtualRobot/RobotNodeSet.h>
27
29
30using namespace armarx;
31using namespace MotionControlGroup;
32
33// DO NOT EDIT NEXT LINE
34CartesianMultipleRelativePositionsControl::SubClassRegistry
36 CartesianMultipleRelativePositionsControl::GetName(),
38
46
47void
49{
50 if (!in.isTcpRelativeOrientationsSet() && !in.isTcpRelativePositionsSet())
51 {
52 ARMARX_ERROR << "TcpRelativeOrientations and/or TcpRelativePositions has to be set, but "
53 "none has been set.";
54 emitFailure();
55 return;
56 }
57 local.setIndex(0);
58
60 getContext<MotionControlGroupStatechartContext>();
61 auto robot = context->getRobot();
62 Eigen::Matrix4f initialTcpPose =
63 robot->getRobotNodeSet(in.getKinematicChainName())->getTCP()->getPoseInRootFrame();
64 std::string rootFrameName = robot->getRootNode()->getName();
65 FramedPositionPtr initialTcpPositionPtr =
66 new FramedPosition(initialTcpPose, rootFrameName, robot->getName());
67 FramedOrientationPtr initialTcpOrientationPtr =
68 new FramedOrientation(initialTcpPose, rootFrameName, robot->getName());
69
70 local.setInitialTcpOrientation(initialTcpOrientationPtr);
71 local.setInitialTcpPosition(initialTcpPositionPtr);
72 local.setTcpOrientation(initialTcpOrientationPtr);
73 local.setTcpPosition(initialTcpPositionPtr);
74}
75
76void
78{
79 /*while (!isRunningTaskStopped()) // stop run function if returning true
80 {
81 if (local.isIndexSet())
82 {
83 ARMARX_IMPORTANT << "index: " << local.getIndex();
84 }
85 else
86 {
87 ARMARX_WARNING << "index not set!";
88 }
89 usleep(100000);
90 }*/
91}
92
93void
95{
96 // put your user code for the breaking point here
97 // execution time should be short (<100ms)
98}
99
100void
102{
103 // put your user code for the exit point here
104 // execution time should be short (<100ms)
105}
106
107// DO NOT EDIT NEXT FUNCTION
The FramedOrientation class.
Definition FramedPose.h:216
The FramedPosition class.
Definition FramedPose.h:158
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
custom implementation of the StatechartContext for a statechart
Class for legacy to stay compatible with old statecharts.
Definition XMLState.h:147
#define ARMARX_ERROR
The logging level for unexpected behaviour, that must be fixed.
Definition Logging.h:196
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< FramedPosition > FramedPositionPtr
Definition FramedPose.h:149
IceInternal::Handle< FramedOrientation > FramedOrientationPtr
Definition FramedPose.h:207
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
Definition XMLState.h:64