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 
27 
28 using namespace armarx;
29 using namespace MotionControlGroup;
30 
31 // DO NOT EDIT NEXT LINE
32 CartesianMultipleRelativePositionsControl::SubClassRegistry CartesianMultipleRelativePositionsControl::Registry(CartesianMultipleRelativePositionsControl::GetName(), &CartesianMultipleRelativePositionsControl::CreateInstance);
33 
34 
35 
37  XMLStateTemplate<CartesianMultipleRelativePositionsControl>(stateData), CartesianMultipleRelativePositionsControlGeneratedBase<CartesianMultipleRelativePositionsControl>(stateData)
38 {
39 }
40 
42 {
43  if (!in.isTcpRelativeOrientationsSet() && !in.isTcpRelativePositionsSet())
44  {
45  ARMARX_ERROR << "TcpRelativeOrientations and/or TcpRelativePositions has to be set, but none has been set.";
46  emitFailure();
47  return;
48  }
49  local.setIndex(0);
50 
51  MotionControlGroupStatechartContext* context = getContext<MotionControlGroupStatechartContext>();
52  auto robot = context->getRobot();
53  Eigen::Matrix4f initialTcpPose = robot->getRobotNodeSet(in.getKinematicChainName())->getTCP()->getPoseInRootFrame();
54  std::string rootFrameName = robot->getRootNode()->getName();
55  FramedPositionPtr initialTcpPositionPtr = new FramedPosition(initialTcpPose, rootFrameName, robot->getName());
56  FramedOrientationPtr initialTcpOrientationPtr = new FramedOrientation(initialTcpPose, rootFrameName, robot->getName());
57 
58  local.setInitialTcpOrientation(initialTcpOrientationPtr);
59  local.setInitialTcpPosition(initialTcpPositionPtr);
60  local.setTcpOrientation(initialTcpOrientationPtr);
61  local.setTcpPosition(initialTcpPositionPtr);
62 }
63 
65 {
66  /*while (!isRunningTaskStopped()) // stop run function if returning true
67  {
68  if (local.isIndexSet())
69  {
70  ARMARX_IMPORTANT << "index: " << local.getIndex();
71  }
72  else
73  {
74  ARMARX_WARNING << "index not set!";
75  }
76  usleep(100000);
77  }*/
78 
79 }
80 
82 {
83  // put your user code for the breaking point here
84  // execution time should be short (<100ms)
85 }
86 
88 {
89  // put your user code for the exit point here
90  // execution time should be short (<100ms)
91 
92 }
93 
94 
95 // DO NOT EDIT NEXT FUNCTION
97 {
99 }
100 
armarx::MotionControlGroup::CartesianMultipleRelativePositionsControl
Definition: CartesianMultipleRelativePositionsControl.h:31
armarx::MotionControlGroup::CartesianMultipleRelativePositionsControl::CreateInstance
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
Definition: CartesianMultipleRelativePositionsControl.cpp:96
armarx::MotionControlGroup::MotionControlGroupStatechartContext
Definition: MotionControlGroupStatechartContext.h:66
armarx::MotionControlGroup::CartesianMultipleRelativePositionsControl::run
void run() override
Definition: CartesianMultipleRelativePositionsControl.cpp:64
armarx::XMLStateConstructorParams
Definition: XMLState.h:50
IceInternal::Handle< FramedPosition >
armarx::MotionControlGroup::CartesianMultipleRelativePositionsControl::onExit
void onExit() override
Definition: CartesianMultipleRelativePositionsControl.cpp:87
armarx::MotionControlGroup::MotionControlGroupStatechartContext::getRobot
const std::shared_ptr< RemoteRobot > getRobot()
Definition: MotionControlGroupStatechartContext.h:79
armarx::XMLStateTemplate
Class for legacy to stay compatible with old statecharts.
Definition: XMLState.h:137
armarx::MotionControlGroup::CartesianMultipleRelativePositionsControl::onEnter
void onEnter() override
Definition: CartesianMultipleRelativePositionsControl.cpp:41
armarx::MotionControlGroup::CartesianMultipleRelativePositionsControl::onBreak
void onBreak() override
Definition: CartesianMultipleRelativePositionsControl.cpp:81
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:189
MotionControlGroupStatechartContext.h
armarx::XMLStateFactoryBasePtr
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
Definition: XMLState.h:65
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:601
armarx::MotionControlGroup::CartesianMultipleRelativePositionsControl::Registry
static SubClassRegistry Registry
Definition: CartesianMultipleRelativePositionsControl.h:45
armarx::VariantType::FramedOrientation
const VariantTypeId FramedOrientation
Definition: FramedPose.h:40
armarx::MotionControlGroup::CartesianMultipleRelativePositionsControl::CartesianMultipleRelativePositionsControl
CartesianMultipleRelativePositionsControl(const XMLStateConstructorParams &stateData)
Definition: CartesianMultipleRelativePositionsControl.cpp:36
armarx::VariantType::FramedPosition
const VariantTypeId FramedPosition
Definition: FramedPose.h:39
CartesianMultipleRelativePositionsControl.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28