VerifyObjectExistenceCertaintyCalc.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 ( 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 
27 
28 using namespace armarx;
29 using namespace BringObjectGroup;
30 
31 // DO NOT EDIT NEXT LINE
32 VerifyObjectExistenceCertaintyCalc::SubClassRegistry VerifyObjectExistenceCertaintyCalc::Registry(VerifyObjectExistenceCertaintyCalc::GetName(), &VerifyObjectExistenceCertaintyCalc::CreateInstance);
33 
34 
35 
37  XMLStateTemplate<VerifyObjectExistenceCertaintyCalc>(stateData), VerifyObjectExistenceCertaintyCalcGeneratedBase<VerifyObjectExistenceCertaintyCalc>(stateData)
38 {
39 }
40 
42 {
43  // put your user code for the enter-point here
44  // execution time should be short (<100ms)
45  float certainty = in.getObjectInstanceChannel()->get<float>("existenceCertainty");
47  ARMARX_INFO << "Current certainty " << certainty << " (Minimum: " << in.getMinimumObjectExistenceCertainty() << ") ";
48 
49  while ((TimeUtil::GetTime() - start).toMilliSeconds() < in.getTimeout() &&
50  !isRunningTaskStopped() &&
51  in.getObjectInstanceChannel()->get<float>("existenceCertainty") < in.getMinimumObjectExistenceCertainty())
52  {
54  ARMARX_INFO << deactivateSpam(0.3) << "existenceCertainty: " << in.getObjectInstanceChannel()->get<float>("existenceCertainty");
55  }
56 
57  if (certainty >= in.getMinimumObjectExistenceCertainty())
58  {
59  emitObjectCertain();
60  }
61  else
62  {
63  emitObjectUncertain();
64  }
65 
66 }
67 
68 
70 {
71  // put your user code for the exit point here
72  // execution time should be short (<100ms)
73 
74 }
75 
76 
77 // DO NOT EDIT NEXT FUNCTION
79 {
81 }
82 
armarx::BringObjectGroup::VerifyObjectExistenceCertaintyCalc::run
void run() override
Definition: VerifyObjectExistenceCertaintyCalc.cpp:41
armarx::BringObjectGroup::VerifyObjectExistenceCertaintyCalc::onExit
void onExit() override
Definition: VerifyObjectExistenceCertaintyCalc.cpp:69
armarx::TimeUtil::MSSleep
static void MSSleep(int durationMS)
lock the calling thread for a given duration (like usleep(...) but using Timeserver time)
Definition: TimeUtil.cpp:94
armarx::XMLStateConstructorParams
Definition: XMLState.h:50
armarx::BringObjectGroup::VerifyObjectExistenceCertaintyCalc::VerifyObjectExistenceCertaintyCalc
VerifyObjectExistenceCertaintyCalc(const XMLStateConstructorParams &stateData)
Definition: VerifyObjectExistenceCertaintyCalc.cpp:36
armarx::BringObjectGroup::VerifyObjectExistenceCertaintyCalc
Definition: VerifyObjectExistenceCertaintyCalc.h:31
IceInternal::Handle
Definition: forward_declarations.h:8
deactivateSpam
SpamFilterDataPtr deactivateSpam(SpamFilterDataPtr const &spamFilter, float deactivationDurationSec, const std::string &identifier, bool deactivate)
Definition: Logging.cpp:72
armarx::XMLStateTemplate
Class for legacy to stay compatible with old statecharts.
Definition: XMLState.h:137
VerifyObjectExistenceCertaintyCalc.h
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::TimeUtil::GetTime
static IceUtil::Time GetTime(TimeMode timeMode=TimeMode::VirtualTime)
Get the current time.
Definition: TimeUtil.cpp:42
armarx::XMLStateFactoryBasePtr
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
Definition: XMLState.h:65
armarx::BringObjectGroup::VerifyObjectExistenceCertaintyCalc::CreateInstance
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
Definition: VerifyObjectExistenceCertaintyCalc.cpp:78
TimeUtil.h
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
armarx::BringObjectGroup::VerifyObjectExistenceCertaintyCalc::Registry
static SubClassRegistry Registry
Definition: VerifyObjectExistenceCertaintyCalc.h:43
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28