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