GazeTarget.cpp
Go to the documentation of this file.
1#include "GazeTarget.h"
2
3#include <iostream>
4#include <optional>
5#include <string>
6
10
12
15
17{
18 GazeTarget::GazeTarget() = default;
19
38
39 bool
41 {
42 return activationTimestamp.isValid();
43 }
44
45 bool
47 {
48 return reachedTimestamp.isValid();
49 }
50
51 bool
53 {
54 return releasedTimestamp.isValid();
55 }
56
57 bool
59 {
60 return abortedTimestamp.isValid();
61 }
62
63 bool
64 GazeTarget::isExpired(std::optional<DateTime> reference) const
65 {
66 // TODO: Expiry time point should actually be the target reached time point + duration, but
67 // since target reached cannot be assessed at this point, we use the activation as
68 // surrogate.
70
71 return reached.isValid() and duration.isPositive() and
72 reached + duration < reference.value_or(Clock::Now());
73 }
74
75 ::std::ostream&
76 operator<<(::std::ostream& os, const GazeTarget& target)
77 {
78 return os << "<GazeTarget name=" << target.name << ", creation=" << target.creationTimestamp
79 << ", priority=" << target.priority << ", duration=" << target.duration
80 << ", status=" << TargetStatusNames.to_name(target.status)
81 << ", position=" << target.position.toEigen().transpose() << " (frame "
82 << target.position.agent << "/" << target.position.frame << ")>";
83 }
84} // namespace armarx::view_selection::gaze_targets
static DateTime Now()
Current time on the virtual clock.
Definition Clock.cpp:93
static DateTime Invalid()
Definition DateTime.cpp:57
The FramedPosition class.
Definition FramedPose.h:158
Represents a point in time.
Definition DateTime.h:25
Represents a duration.
Definition Duration.h:17
bool isExpired(std::optional< DateTime > reference=std::nullopt) const
const simox::meta::EnumNames< TargetStatus > TargetStatusNames
::std::ostream & operator<<(::std::ostream &os, const GazeTarget &target)