GraspingWithTorques.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::FindAndGraspObjectGroup
19  * @author Valerij Wittenbeck ( valerij dot wittenbeck at student dot 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 "GraspingWithTorques.h"
26 #include <VirtualRobot/RobotNodeSet.h>
27 #include <VirtualRobot/Robot.h>
29 
30 using namespace armarx;
31 using namespace FindAndGraspObjectGroup;
32 
33 // DO NOT EDIT NEXT LINE
35 
36 
37 
40 {
41 }
42 
44 {
45  ARMARX_VERBOSE << "Entering GraspingWithTorques::onEnter()";
46 
47  RobotStatechartContext* context = getContext<RobotStatechartContext>();
48  //setLocal("jointVelocityChannel", context->getChannelRef(context->getKinematicUnitObserverName(),"jointvelocities"));
49  ChannelRefPtr tempChannelRef = context->getChannelRef(context->getKinematicUnitObserverName(), "jointvelocities");
50 
51  VirtualRobot::RobotNodeSetPtr nodeSet = context->remoteRobot->getRobotNodeSet(getInput<std::string>("robotNodeSetName")); //woher robotNodeSetName holen? (Argument für getRobotNodeSet())
52 
55 
56  for (size_t i = 0; i < nodeSet->getSize(); i++)
57  {
58  jointNames.addVariant(nodeSet->getNode(i)->getName()); //nodes = joints
59  dataFields.addVariant(context->getDatafieldRef(tempChannelRef, nodeSet->getNode(i)->getName()));
60  }
61 
62  setLocal("jointNames", jointNames);
63  setLocal("jointVelocitiesDatafields", dataFields);
64 }
65 
67 {
68  ARMARX_VERBOSE << "Done GraspingWithTorques::onExit()";
69 }
70 
71 // DO NOT EDIT NEXT FUNCTION
73 {
74  return "GraspingWithTorques";
75 }
76 
77 // DO NOT EDIT NEXT FUNCTION
79 {
80  return XMLStateFactoryBasePtr(new GraspingWithTorques(stateData));
81 }
82 
armarx::FindAndGraspObjectGroup::GraspingWithTorques::onExit
void onExit() override
Virtual function, in which the behaviour of state is defined, when it is exited. Can be overridden,...
Definition: GraspingWithTorques.cpp:66
ARMARX_VERBOSE
#define ARMARX_VERBOSE
Definition: Logging.h:180
armarx::RobotStatechartContext::getKinematicUnitObserverName
std::string getKinematicUnitObserverName()
Definition: RobotStatechartContext.h:88
armarx::FindAndGraspObjectGroup::GraspingWithTorques
Definition: GraspingWithTorques.h:33
armarx::XMLStateConstructorParams
Definition: XMLState.h:50
armarx::FindAndGraspObjectGroup::GraspingWithTorques::GetName
static std::string GetName()
Definition: GraspingWithTorques.cpp:72
armarx::State::setLocal
void setLocal(std::string const &key, const Variant &value)
setLocal() sets a local parameter.
Definition: State.cpp:417
armarx::StatechartContext::getChannelRef
ChannelRefPtr getChannelRef(const std::string &observerName, const std::string &channelName) override
Definition: StatechartContext.cpp:142
GraspingWithTorques.h
IceInternal::Handle< ChannelRef >
DatafieldRef.h
armarx::RobotStatechartContext
Definition: RobotStatechartContext.h:66
armarx::XMLStateTemplate
Class for legacy to stay compatible with old statecharts.
Definition: XMLState.h:137
armarx::FindAndGraspObjectGroup::GraspingWithTorques::Registry
static SubClassRegistry Registry
Definition: GraspingWithTorques.h:47
armarx::SingleTypeVariantList
The SingleTypeVariantList class is a subclass of VariantContainer and is comparable to a std::vector<...
Definition: SingleTypeVariantList.h:47
armarx::StatechartContext::getDatafieldRef
DatafieldRefPtr getDatafieldRef(const DataFieldIdentifier &datafieldIdentifier) override
Definition: StatechartContext.cpp:169
armarx::FindAndGraspObjectGroup::GraspingWithTorques::onEnter
void onEnter() override
Virtual function, in which the behaviour of state is defined, when it is entered. Can be overridden,...
Definition: GraspingWithTorques.cpp:43
armarx::VariantType::DatafieldRef
const VariantTypeId DatafieldRef
Definition: DatafieldRef.h:169
armarx::XMLStateFactoryBasePtr
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
Definition: XMLState.h:65
armarx::FindAndGraspObjectGroup::GraspingWithTorques::GraspingWithTorques
GraspingWithTorques(XMLStateConstructorParams stateData)
Definition: GraspingWithTorques.cpp:38
armarx::FindAndGraspObjectGroup::GraspingWithTorques::CreateInstance
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
Definition: GraspingWithTorques.cpp:78
armarx::VariantType::String
const VariantTypeId String
Definition: Variant.h:920
armarx::RobotStatechartContext::remoteRobot
VirtualRobot::RobotPtr remoteRobot
Definition: RobotStatechartContext.h:100
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::SingleTypeVariantList::addVariant
void addVariant(const Variant &variant)
Definition: SingleTypeVariantList.cpp:100