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
27#include <VirtualRobot/Robot.h>
28#include <VirtualRobot/RobotNodeSet.h>
29
31
32using namespace armarx;
33using namespace FindAndGraspObjectGroup;
34
35// DO NOT EDIT NEXT LINE
36GraspingWithTorques::SubClassRegistry
39
44
45void
47{
48 ARMARX_VERBOSE << "Entering GraspingWithTorques::onEnter()";
49
51 //setLocal("jointVelocityChannel", context->getChannelRef(context->getKinematicUnitObserverName(),"jointvelocities"));
52 ChannelRefPtr tempChannelRef =
53 context->getChannelRef(context->getKinematicUnitObserverName(), "jointvelocities");
54
55 VirtualRobot::RobotNodeSetPtr nodeSet =
56 context->remoteRobot->getRobotNodeSet(getInput<std::string>(
57 "robotNodeSetName")); //woher robotNodeSetName holen? (Argument für getRobotNodeSet())
58
61
62 for (size_t i = 0; i < nodeSet->getSize(); i++)
63 {
64 jointNames.addVariant(nodeSet->getNode(i)->getName()); //nodes = joints
65 dataFields.addVariant(
66 context->getDatafieldRef(tempChannelRef, nodeSet->getNode(i)->getName()));
67 }
68
69 setLocal("jointNames", jointNames);
70 setLocal("jointVelocitiesDatafields", dataFields);
71}
72
73void
75{
76 ARMARX_VERBOSE << "Done GraspingWithTorques::onExit()";
77}
78
79// DO NOT EDIT NEXT FUNCTION
80std::string
82{
83 return "GraspingWithTorques";
84}
85
86// DO NOT EDIT NEXT FUNCTION
void onEnter() override
Virtual function, in which the behaviour of state is defined, when it is entered. Can be overridden,...
void onExit() override
Virtual function, in which the behaviour of state is defined, when it is exited. Can be overridden,...
GraspingWithTorques(XMLStateConstructorParams stateData)
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
The SingleTypeVariantList class is a subclass of VariantContainer and is comparable to a std::vector<...
void addVariant(const Variant &variant)
ContextType * getContext() const
Definition StateBase.h:71
std::enable_if_t< std::is_base_of_v< VariantDataClass, T >, IceInternal::Handle< T > > getInput(const std::string &key) const
getInput can be used to access a specific input parameter.
Definition State.h:620
void setLocal(std::string const &key, const Variant &value)
setLocal() sets a local parameter.
Definition State.cpp:464
DatafieldRefPtr getDatafieldRef(const DataFieldIdentifier &datafieldIdentifier) override
ChannelRefPtr getChannelRef(const std::string &observerName, const std::string &channelName) override
XMLStateTemplate(const XMLStateConstructorParams &params)
Definition XMLState.h:149
#define ARMARX_VERBOSE
The logging level for verbose information.
Definition Logging.h:187
const VariantTypeId String
Definition Variant.h:921
const VariantTypeId DatafieldRef
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< ChannelRef > ChannelRefPtr
Definition ChannelRef.h:40
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
Definition XMLState.h:64