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 
28 using namespace armarx;
29 using namespace MotionControlGroup;
30 
31 // DO NOT EDIT NEXT LINE
32 Select::SubClassRegistry Select::Registry(Select::GetName(), &Select::CreateInstance);
33 
35 {
36  ARMARX_CHECK_GREATER_EQUAL(in.getIndex(), 0);
37 
38  out.setIndex(in.getIndex() + 1);
39  out.setHoldPositionAfterwards(in.getHoldPositionAfterwardsForWaypoints());
40  out.setSetVelocitiesToZeroAtEnd(false);
41 
42  if (in.getIndex() < in.getStopIndex())
43  {
44  out.setJointValues(in.getJointValueWaypoints().at(in.getIndex())->toStdMap<float>());
45 
46  if (!(out.getIndex() < in.getStopIndex()))
47  {
48  ARMARX_INFO << "last waypoint " << in.getIndex() << ": " << out.getJointValues();
49  out.setHoldPositionAfterwards(in.getHoldPositionAfterwardsForLast());
50  out.setSetVelocitiesToZeroAtEnd(in.getSetVelocitiesToZeroAtEnd());
51  }
52  else
53  {
54  ARMARX_INFO << "waypoint " << in.getIndex() << ": " << out.getJointValues();
55  }
56  emitNext();
57  }
58  else
59  {
60  ARMARX_INFO << "all waypoints are done";
61  emitDone();
62  }
63 }
64 
65 // DO NOT EDIT NEXT FUNCTION
67 {
68  return XMLStateFactoryBasePtr(new Select(stateData));
69 }
70 
armarx::XMLStateConstructorParams
Definition: XMLState.h:50
IceInternal::Handle
Definition: forward_declarations.h:8
Select.h
armarx::MotionControlGroup::Select::CreateInstance
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
Definition: Select.cpp:66
armarx::MotionControlGroup::Select::Registry
static SubClassRegistry Registry
Definition: Select.h:43
armarx::MotionControlGroup::Select::Select
Select(const XMLStateConstructorParams &stateData)
Definition: Select.h:32
ARMARX_CHECK_GREATER_EQUAL
#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...
Definition: ExpressionException.h:123
armarx::XMLStateFactoryBasePtr
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
Definition: XMLState.h:65
armarx::MotionControlGroup::Select::onEnter
void onEnter() override
Definition: Select.cpp:34
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28