TestBringObjectWithArmSelection.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::BringObjectGroup
19  * @author Mirko Waechter ( mirko dot waechter 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 
26 #include "../BringObjectGroupStatechartContext.h"
27 #include <MemoryX/interface/memorytypes/MemoryEntities.h>
28 #include <RobotAPI/interface/core/FramedPoseBase.h>
31 using namespace armarx;
32 using namespace BringObjectGroup;
33 
34 // DO NOT EDIT NEXT LINE
35 TestBringObjectWithArmSelection::SubClassRegistry TestBringObjectWithArmSelection::Registry(TestBringObjectWithArmSelection::GetName(), &TestBringObjectWithArmSelection::CreateInstance);
36 
37 
38 
40  XMLStateTemplate<TestBringObjectWithArmSelection>(stateData), TestBringObjectWithArmSelectionGeneratedBase<TestBringObjectWithArmSelection>(stateData)
41 {
42 }
43 
45 {
46  // put your user code for the enter-point here
47  // execution time should be short (<100ms)
48  //BringObjectGroupStatechartContext* c = getContext<BringObjectGroupStatechartContext>();
49 
50  ARMARX_IMPORTANT << "FIXME: No direct access to the simulator here, you can start a scenario that adds an object (" << in.getObjectName() << ") via the SceneModifier component (see ArmarXSimulation)";
51  /*if(c->getSimulatorProxy())
52  {
53  std::string objectClassName = in.getObjectName();
54  memoryx::PersistentObjectClassSegmentBasePrx classesSegmentPrx = c->getPriorKnowledgeProxy()->getObjectClassesSegment();
55 
56  memoryx::EntityBasePtr classesEntity = classesSegmentPrx->getEntityByName(objectClassName);
57  if (!classesEntity)
58  {
59  ARMARX_ERROR_S << "No memory entity found with name " << objectClassName;
60  }
61  memoryx::ObjectClassBasePtr objectClass = memoryx::ObjectClassBasePtr::dynamicCast(classesEntity);
62  if (!objectClass)
63  {
64  ARMARX_ERROR_S << "Could not cast entitiy to object class, name: " << objectClassName;
65  }
66 
67  PosePtr pose = in.getObjectPose();
68  srand(IceUtil::Time::now().toMilliSeconds());
69  // pose->position->y += -200 + (double)(rand()) / RAND_MAX * 400;
70  if (!c->getSimulatorProxy()->hasObject(objectClassName))
71  {
72  ARMARX_IMPORTANT_S << "Adding object " << objectClassName << " at pose:" << *pose;
73  c->getSimulatorProxy()->addObject(objectClass, objectClassName, pose, false);
74  }
75  }*/
76 }
77 
78 
79 
81 {
82  // put your user code for the exit point here
83  // execution time should be short (<100ms)
84 
85 }
86 
87 
88 // DO NOT EDIT NEXT FUNCTION
90 {
92 }
93 
armarx::BringObjectGroup::TestBringObjectWithArmSelection
Definition: TestBringObjectWithArmSelection.h:31
ARMARX_IMPORTANT
#define ARMARX_IMPORTANT
Definition: Logging.h:183
armarx::XMLStateConstructorParams
Definition: XMLState.h:50
armarx::BringObjectGroup::TestBringObjectWithArmSelection::onEnter
void onEnter() override
Definition: TestBringObjectWithArmSelection.cpp:44
IceInternal::Handle
Definition: forward_declarations.h:8
armarx::BringObjectGroup::TestBringObjectWithArmSelection::TestBringObjectWithArmSelection
TestBringObjectWithArmSelection(XMLStateConstructorParams stateData)
Definition: TestBringObjectWithArmSelection.cpp:39
armarx::BringObjectGroup::TestBringObjectWithArmSelection::onExit
void onExit() override
Definition: TestBringObjectWithArmSelection.cpp:80
armarx::XMLStateTemplate
Class for legacy to stay compatible with old statecharts.
Definition: XMLState.h:137
armarx::BringObjectGroup::TestBringObjectWithArmSelection::CreateInstance
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
Definition: TestBringObjectWithArmSelection.cpp:89
MemoryXCoreObjectFactories.h
armarx::BringObjectGroup::TestBringObjectWithArmSelection::Registry
static SubClassRegistry Registry
Definition: TestBringObjectWithArmSelection.h:43
armarx::XMLStateFactoryBasePtr
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
Definition: XMLState.h:65
MemoryXTypesObjectFactories.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
TestBringObjectWithArmSelection.h