Select.cpp
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package RobotSkillTemplates::MotionControlGroup
17 * @author Raphael Grimm ( raphael dot grimm at kit dot edu )
18 * @date 2018
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23#include "Select.h"
24
25//#include <ArmarXCore/core/time/TimeUtil.h>
26//#include <ArmarXCore/observers/variant/DatafieldRef.h>
27
28using namespace armarx;
29using namespace MotionControlGroup;
30
31// DO NOT EDIT NEXT LINE
32Select::SubClassRegistry Select::Registry(Select::GetName(), &Select::CreateInstance);
33
34void
36{
37 ARMARX_CHECK_GREATER_EQUAL(in.getIndex(), 0);
38
39 out.setIndex(in.getIndex() + 1);
40 out.setHoldPositionAfterwards(in.getHoldPositionAfterwardsForWaypoints());
41 out.setSetVelocitiesToZeroAtEnd(false);
42
43 if (in.getIndex() < in.getStopIndex())
44 {
45 out.setJointValues(in.getJointValueWaypoints().at(in.getIndex())->toStdMap<float>());
46
47 if (!(out.getIndex() < in.getStopIndex()))
48 {
49 ARMARX_INFO << "last waypoint " << in.getIndex() << ": " << out.getJointValues();
50 out.setHoldPositionAfterwards(in.getHoldPositionAfterwardsForLast());
51 out.setSetVelocitiesToZeroAtEnd(in.getSetVelocitiesToZeroAtEnd());
52 }
53 else
54 {
55 ARMARX_INFO << "waypoint " << in.getIndex() << ": " << out.getJointValues();
56 }
57 emitNext();
58 }
59 else
60 {
61 ARMARX_INFO << "all waypoints are done";
62 emitDone();
63 }
64}
65
66// DO NOT EDIT NEXT FUNCTION
static SubClassRegistry Registry
Definition Select.h:46
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
Definition Select.cpp:68
Select(const XMLStateConstructorParams &stateData)
Definition Select.h:31
#define ARMARX_CHECK_GREATER_EQUAL(lhs, rhs)
This macro evaluates whether lhs is greater or equal (>=) rhs and if it turns out to be false it will...
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
Definition XMLState.h:64