Transition.cpp
Go to the documentation of this file.
1 #include "Transition.h"
2 
3 using namespace armarx;
4 
6 {
7  return userDuration;
8 }
9 
11 {
12  if (value >= 0)
13  {
14  if (value < timeOptimalDuration)
15  {
16  throw InvalidArgumentException("User duration must be greater than or equal timeOptimalDuration");
17  }
18  else
19  {
20  userDuration = value;
21  getEnd()->setUserTimestamp(getStart()->getUserTimestamp() + userDuration);
22  }
23  }
24  else
25  {
26  throw InvalidArgumentException("User duration must be greater than or equal 0");
27  }
28 }
29 
31 {
32  return timeOptimalDuration;
33 }
34 
36 {
37  if (value >= 0)
38  {
39  timeOptimalDuration = value;
40  getEnd()->setTimeOptimalTimestamp(getStart()->getTimeOptimalTimestamp()
41  + timeOptimalDuration);
42  if (userDuration == 0 || userDuration < timeOptimalDuration)
43  {
44  setUserDuration(timeOptimalDuration);
45  }
46  }
47  else
48  {
49  throw InvalidArgumentException("TimeOptimal duration must be greater than or equal 0");
50  }
51 }
52 
54 {
55  return interpolationType;
56 }
57 
59 {
60  interpolationType = value;
61 }
62 
64 {
65  return trajectory;
66 }
67 
69 {
70  trajectory = value;
71 }
72 
74 {
75  return start;
76 }
77 
79 {
80  if (value != nullptr)
81  {
82  start = value;
83  }
84  else
85  {
86  throw InvalidArgumentException("Can not setStart with nullptr");
87  }
88 }
89 
91 {
92  return end;
93 }
94 
96 {
97  if (value != nullptr)
98  {
99  end = value;
100  }
101  else
102  {
103  throw InvalidArgumentException("Can not setEnd with nullptr");
104  }
105 }
106 
108  : interpolationType(eLinearInterpolation)
109 {
110  if (newStart != nullptr)
111  {
112  start = newStart;
113  }
114  else
115  {
116  throw InvalidArgumentException("Can not construct Transition with newStart = nullptr");
117  }
118  if (newEnd != nullptr)
119  {
120  end = newEnd;
121  }
122  else
123  {
124  throw InvalidArgumentException("Can not construct Transition with newEnd = nullptr");
125  }
126  timeOptimalDuration = 0;
127  userDuration = 0;
128 }
129 
131  start(newStart),
132  end(newEnd),
133  timeOptimalDuration(source.timeOptimalDuration), userDuration(source.userDuration),
134  interpolationType(source.interpolationType),
135  trajectory(IceInternal::Handle<Trajectory>(new Trajectory(*source.trajectory)))
136 {
137 }
armarx::Transition::getTrajectory
TrajectoryPtr getTrajectory()
Returns the armarx::Trajectory of the transition.
Definition: Transition.cpp:63
armarx::UserWaypointPtr
std::shared_ptr< UserWaypoint > UserWaypointPtr
Definition: UserWaypoint.h:137
armarx::Transition::setTimeOptimalDuration
void setTimeOptimalDuration(double value)
set the time optimal duration and set the userDuration if its less than time optimal duration
Definition: Transition.cpp:35
armarx::Transition::setStart
void setStart(const UserWaypointPtr &value)
set the start userwaypoint of the transition
Definition: Transition.cpp:78
armarx::Transition::setInterpolationType
void setInterpolationType(const InterpolationType &value)
Set the intpolation type of the transition.
Definition: Transition.cpp:58
armarx::Transition::setEnd
void setEnd(const UserWaypointPtr &value)
set the end userwaypoint of the transition
Definition: Transition.cpp:95
armarx::Transition::setTrajectory
void setTrajectory(const TrajectoryPtr &value)
set the time optimal trajectory of the transition
Definition: Transition.cpp:68
armarx::Transition::getEnd
UserWaypointPtr getEnd()
Returns the end UserWaypoint of the transition.
Definition: Transition.cpp:90
IceInternal::Handle< Trajectory >
armarx::Transition::getTimeOptimalDuration
double getTimeOptimalDuration() const
Returns the time optimal duration calculated by TrajectoryCalculation.
Definition: Transition.cpp:30
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
armarx::InterpolationType
InterpolationType
The InterpolationType enum lists all available interpolation types eLinearInterpolation: represents l...
Definition: InterpolationType.h:32
IceInternal
Definition: InstrumentationI.h:16
armarx::Transition
Definition: Transition.h:36
boost::source
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:681
Transition.h
armarx::Transition::Transition
Transition(UserWaypointPtr &newStart, UserWaypointPtr &newEnd)
Transition.
Definition: Transition.cpp:107
armarx::Trajectory
The Trajectory class represents n-dimensional sampled trajectories.
Definition: Trajectory.h:76
armarx::eLinearInterpolation
@ eLinearInterpolation
Definition: InterpolationType.h:34
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::Transition::getInterpolationType
InterpolationType getInterpolationType() const
Returns the interpolation type of the transition.
Definition: Transition.cpp:53
armarx::Transition::getUserDuration
double getUserDuration() const
Returns the user duration of the transition.
Definition: Transition.cpp:5
armarx::Transition::setUserDuration
void setUserDuration(double value)
Set the user duration of the transition and tests if it is greater than the time optimal duration.
Definition: Transition.cpp:10
armarx::Transition::getStart
UserWaypointPtr getStart()
Returns the start UserWaypoint of the transition.
Definition: Transition.cpp:73