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
92} // namespace armarx::view_selection::statecharts::view_selection_group
static DateTime Now()
Current time on the virtual clock.
Definition Clock.cpp:93
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
Definition Duration.cpp:48
static Duration MilliSecondsDouble(double milliSeconds)
Constructs a duration in milliseconds.
Definition Duration.cpp:54
The memory name system (MNS) client.
void commitGazeTarget(const gaze_targets::GazeTarget &target)
Business Object (BO) class of GazeTarget.
Definition GazeTarget.h:23
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
#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...
#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...
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
#define ARMARX_IMPORTANT
The logging level for always important information, but expected behaviour (in contrast to ARMARX_WAR...
Definition Logging.h:190
@ TaskDriven
Task-Driven attention has highest priority.
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
Definition XMLState.h:64