CreateTaskLevelGazeTarget.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 view_selection::ViewSelectionGroup
17  * @author Fabian Reister ( fabian dot reister at kit dot edu )
18  * @date 2022
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
24 
27 
29 
31 
33 {
34  // DO NOT EDIT NEXT LINE
35  CreateTaskLevelGazeTarget::SubClassRegistry
36  CreateTaskLevelGazeTarget::Registry(CreateTaskLevelGazeTarget::GetName(),
38 
39  void
41  {
42  // put your user code for the enter-point here
43  // execution time should be short (<100ms)
44  }
45 
46  void
48  {
49  ARMARX_CHECK_GREATER_EQUAL(in.getpriority(), 0);
50  ARMARX_CHECK_GREATER_EQUAL(in.getdurationMs(), 0);
51 
52  ARMARX_CHECK_NOT_NULL(in.gettarget());
53 
54  armem::client::MemoryNameSystem mns(getMemoryNameSystem());
55  client::ViewSelection viewSelection(mns, CreateTaskLevelGazeTarget::GetName());
56 
57  ARMARX_INFO << "Connecting view selection";
58  viewSelection.connect();
59 
61  target.name = "look_at_target";
62  target.position = *in.gettarget();
63  target.priority =
65  target.duration = in.getdurationMs() > 0 ? Duration::MilliSecondsDouble(in.getdurationMs())
67  target.creationTimestamp = armarx::Clock::Now();
68 
69  ARMARX_IMPORTANT << "Committing gaze target " << target;
70  viewSelection.commitGazeTarget(target);
71  }
72 
73  //void CreateTaskLevelGazeTarget::onBreak()
74  //{
75  // // put your user code for the breaking point here
76  // // execution time should be short (<100ms)
77  //}
78 
79  void
81  {
82  // put your user code for the exit point here
83  // execution time should be short (<100ms)
84  }
85 
86  // DO NOT EDIT NEXT FUNCTION
89  {
90  return {new CreateTaskLevelGazeTarget(stateData)};
91  }
92 } // namespace armarx::view_selection::statecharts::view_selection_group
ARMARX_IMPORTANT
#define ARMARX_IMPORTANT
Definition: Logging.h:190
CreateTaskLevelGazeTarget.h
armarx::view_selection::statecharts::view_selection_group::CreateTaskLevelGazeTarget::Registry
static SubClassRegistry Registry
Definition: CreateTaskLevelGazeTarget.h:47
ARMARX_CHECK_NOT_NULL
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
Definition: ExpressionException.h:206
armarx::XMLStateConstructorParams
Definition: XMLState.h:49
boost::target
Vertex target(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:668
armarx::view_selection::statecharts::view_selection_group::CreateTaskLevelGazeTarget::onEnter
void onEnter() override
Definition: CreateTaskLevelGazeTarget.cpp:40
armarx::view_selection::gaze_targets::GazeTarget
Business Object (BO) class of GazeTarget.
Definition: GazeTarget.h:39
armarx::view_selection::client::ViewSelection
Definition: ViewSelection.h:37
armarx::view_selection::gaze_targets::AttentionType::TaskDriven
@ TaskDriven
Task-Driven attention has highest priority.
IceInternal::Handle
Definition: forward_declarations.h:8
armarx::view_selection::statecharts::view_selection_group::CreateTaskLevelGazeTarget::onExit
void onExit() override
Definition: CreateTaskLevelGazeTarget.cpp:80
ViewSelection.h
armarx::view_selection::statecharts::view_selection_group
Definition: CreateTaskLevelGazeTarget.cpp:32
armarx::view_selection::statecharts::view_selection_group::CreateTaskLevelGazeTarget::run
void run() override
Definition: CreateTaskLevelGazeTarget.cpp:47
armarx::view_selection::statecharts::view_selection_group::CreateTaskLevelGazeTarget::CreateTaskLevelGazeTarget
CreateTaskLevelGazeTarget(const XMLStateConstructorParams &stateData)
Definition: CreateTaskLevelGazeTarget.h:33
armarx::core::time::Duration::MilliSecondsDouble
static Duration MilliSecondsDouble(double milliSeconds)
Constructs a duration in milliseconds.
Definition: Duration.cpp:54
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::view_selection::client::ViewSelection::commitGazeTarget
void commitGazeTarget(const gaze_targets::GazeTarget &target)
Definition: ViewSelection.cpp:88
ExpressionException.h
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:181
armarx::view_selection::statecharts::view_selection_group::CreateTaskLevelGazeTarget::CreateInstance
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
Definition: CreateTaskLevelGazeTarget.cpp:88
armarx::armem::client::MemoryNameSystem
The memory name system (MNS) client.
Definition: MemoryNameSystem.h:73
armarx::core::time::Clock::Now
static DateTime Now()
Current time on the virtual clock.
Definition: Clock.cpp:93
armarx::view_selection::client::ViewSelection::connect
void connect()
Definition: ViewSelection.cpp:47
MemoryNameSystem.h
Logging.h
armarx::view_selection::gaze_targets::TargetPriority
The Priority of a GazeTarget.
Definition: TargetPriority.h:39
armarx::core::time::Duration::MilliSeconds
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
Definition: Duration.cpp:48