ConfigureBodyTracking.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 VisionX::AzureKinectGroup
17  * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
18  * @date 2023
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #include "ConfigureBodyTracking.h"
24 
25 //#include <ArmarXCore/core/time/TimeUtil.h>
26 //#include <ArmarXCore/observers/variant/DatafieldRef.h>
27 
29 {
30  // DO NOT EDIT NEXT LINE
31  ConfigureBodyTracking::SubClassRegistry
32  ConfigureBodyTracking::Registry(ConfigureBodyTracking::GetName(),
34 
35  void
37  {
38  // put your user code for the enter-point here
39  // execution time should be short (<100ms)
40  }
41 
42  void
44  {
45  std::stringstream warn;
46 
47  AzureKinectPointCloudProviderInterfacePrx ak = getAzureKinectPointCloudProvider();
48 
49  if (in.isMaxDepthInMillimetersSet())
50  {
51  ak->setMaxDepthBodyTracking(in.getMaxDepthInMillimeters());
52  }
53 
54  const bool isMinSet = in.isWidthMinPixelSet();
55  const bool isMaxSet = in.isWidthMinPixelSet();
56  if (isMinSet and isMaxSet)
57  {
58  ak->setWidthBodyTracking(in.getWidthMinPixel(), in.getWidthMaxPixel());
59  }
60  else if (isMinSet != isMaxSet)
61  {
62  if (isMinSet and not isMaxSet)
63  {
64  warn << "WidthMinPixel is set, but WidthMaxPixel is not.";
65  }
66  else
67  {
68  ARMARX_CHECK(not isMinSet);
69  ARMARX_CHECK(isMaxSet);
70  warn << "WidthMaxPixel is set, but WidthMinPixel is not.";
71  }
72  warn << "\nThese parameters only have an effect if set together.";
73  }
74 
75  if (not warn.str().empty())
76  {
77  ARMARX_WARNING << warn.str();
78  }
79 
80  emitSuccess();
81  }
82 
83  //void ConfigureBodyTracking::onBreak()
84  //{
85  // // put your user code for the breaking point here
86  // // execution time should be short (<100ms)
87  //}
88 
89  void
91  {
92  // put your user code for the exit point here
93  // execution time should be short (<100ms)
94  }
95 
96  // DO NOT EDIT NEXT FUNCTION
99  {
100  return XMLStateFactoryBasePtr(new ConfigureBodyTracking(stateData));
101  }
102 } // namespace armarx::AzureKinectGroup
armarx::XMLStateConstructorParams
Definition: XMLState.h:50
armarx::AzureKinectGroup::ConfigureBodyTracking::onEnter
void onEnter() override
Definition: ConfigureBodyTracking.cpp:36
ARMARX_CHECK
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
Definition: ExpressionException.h:82
IceInternal::Handle
Definition: forward_declarations.h:8
armarx::AzureKinectGroup::ConfigureBodyTracking::run
void run() override
Definition: ConfigureBodyTracking.cpp:43
ConfigureBodyTracking.h
armarx::AzureKinectGroup
Definition: AzureKinectGroupRemoteStateOfferer.cpp:25
armarx::XMLStateFactoryBasePtr
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
Definition: XMLState.h:65
armarx::AzureKinectGroup::ConfigureBodyTracking::CreateInstance
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
Definition: ConfigureBodyTracking.cpp:98
armarx::AzureKinectGroup::ConfigureBodyTracking::onExit
void onExit() override
Definition: ConfigureBodyTracking.cpp:90
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:186
armarx::AzureKinectGroup::ConfigureBodyTracking::Registry
static SubClassRegistry Registry
Definition: ConfigureBodyTracking.h:45
armarx::AzureKinectGroup::ConfigureBodyTracking::ConfigureBodyTracking
ConfigureBodyTracking(const XMLStateConstructorParams &stateData)
Definition: ConfigureBodyTracking.h:31