DesignerTrajectory.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2015-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package ArmarXGuiPlugins::RobotTrajectoryDesigner::Model
19  * @author Lukas Christ
20  * @date 2018
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 #ifndef DESIGNERTRAJECTORY_H
25 #define DESIGNERTRAJECTORY_H
26 
27 
28 #include <VirtualRobot/RobotNodeSet.h>
29 
30 #include "Transition.h"
31 #include "UserWaypoint.h"
32 
33 namespace armarx
34 {
35 
37  {
38 
39  private:
40  const unsigned int DERIVATION_COUNT = 2;
41  std::vector<TrajectoryPtr> interBreakpointTrajectories;
42  std::vector<UserWaypointPtr> userWaypoints;
43  std::vector<TransitionPtr> transitions;
44  VirtualRobot::RobotNodeSetPtr rns;
45 
46  std::vector<std::vector<double>> getDimensionDatas();
47  std::vector<double> getAllTimestamps();
48  void setLimitless(TrajectoryPtr traj, VirtualRobot::RobotNodeSetPtr rns);
49 
50 
51  public:
52  DesignerTrajectory(UserWaypointPtr& firstPoint, VirtualRobot::RobotNodeSetPtr newRns);
53 
54  /**
55  * @brief Deep copy constructor of designerTrajectory
56  * @param source designertrajectory to copy
57  */
59 
60  /**
61  * @brief add a new first userWaypoint
62  * @param point userwaypoint
63  */
65 
66  /**
67  * @brief add new last userWaypoint
68  * @param point userwaypoint
69  */
71 
72  /**
73  * @brief insert userwaypoint before index
74  * @param point userwaypoint
75  * @param index index
76  */
77  void insertUserWaypoint(UserWaypointPtr& point, unsigned int index);
78 
79  /**
80  * @brief delete the userwaypoint and remove all transitions including the userwaypoint.
81  * Creates new transition if necessary
82  * @param index index of userwaypoint
83  */
84  void deleteUserWaypoint(unsigned int index);
85 
86  /**
87  * @brief get the number of the userwaypoints
88  * @return number
89  */
90  unsigned int getNrOfUserWaypoints() const;
91 
92  /**
93  * @brief get the userWaypoint
94  * @param index index of userwaypoint
95  * @return the userwaypoint
96  */
98 
99  /**
100  * @brief get the transition
101  * @param index index of transition
102  * @return the transition
103  */
104  TransitionPtr getTransition(unsigned int index);
105 
106  /**
107  * @brief get the time optimal trajectory. Calculated out of all breakpoint trajectories.
108  * @return time optimal Trajectory
109  */
111 
112  /**
113  * @brief get one interBreakPoint trajectory
114  * @param index the index
115  * @return interBreakpointTrajectorie
116  */
118 
119  /**
120  * @brief get a copy of all userwaypoints
121  * @return all userwaypoints
122  */
123  std::vector<UserWaypointPtr> getAllUserWaypoints() const;
124 
125  /**
126  * @brief get all userwaypoints
127  * @return all userwaypoints
128  */
129  std::vector<UserWaypointPtr> getAllUserWaypoints();
130 
131  /**
132  * @brief get the final trajectory with the right durations
133  * @return trajectory
134  */
136 
137  /**
138  * @brief get the robot node set of the designertrajectory
139  * @return robotnodeset
140  */
141  VirtualRobot::RobotNodeSetPtr getRns();
142 
143  /**
144  * @brief Returns the interBreakpointTrajectories
145  * @return interBreakpointTrajectories
146  */
147  std::vector<TrajectoryPtr> getInterBreakpointTrajectories();
148 
149 
150  /**
151  * @brief set the robotnodeset
152  * @param value robotnodeset
153  */
154  void setRns(const VirtualRobot::RobotNodeSetPtr& value);
155 
156  /**
157  * @brief set the interBreakpointTrajectories
158  * @param value interBreakpointTrajectories
159  */
160  void setInterBreakpointTrajectories(const std::vector<TrajectoryPtr>& value);
161  };
162 
163  using DesignerTrajectoryPtr = std::shared_ptr<DesignerTrajectory>;
164 } // namespace armarx
165 
166 #endif // DESIGNERTRAJECTORY_H
armarx::UserWaypointPtr
std::shared_ptr< UserWaypoint > UserWaypointPtr
Definition: UserWaypoint.h:142
armarx::DesignerTrajectory::getNrOfUserWaypoints
unsigned int getNrOfUserWaypoints() const
get the number of the userwaypoints
Definition: DesignerTrajectory.cpp:223
index
uint8_t index
Definition: EtherCATFrame.h:59
armarx::DesignerTrajectory::getAllUserWaypoints
std::vector< UserWaypointPtr > getAllUserWaypoints() const
get a copy of all userwaypoints
Definition: DesignerTrajectory.cpp:280
armarx::DesignerTrajectory::addFirstUserWaypoint
void addFirstUserWaypoint(UserWaypointPtr &point)
add a new first userWaypoint
Definition: DesignerTrajectory.cpp:120
armarx::DesignerTrajectory::getRns
VirtualRobot::RobotNodeSetPtr getRns()
get the robot node set of the designertrajectory
Definition: DesignerTrajectory.cpp:9
armarx::DesignerTrajectory
Definition: DesignerTrajectory.h:36
armarx::DesignerTrajectory::getInterBreakpointTrajectories
std::vector< TrajectoryPtr > getInterBreakpointTrajectories()
Returns the interBreakpointTrajectories.
Definition: DesignerTrajectory.cpp:28
armarx::DesignerTrajectory::getTimeOptimalTrajectory
TrajectoryPtr getTimeOptimalTrajectory()
get the time optimal trajectory.
Definition: DesignerTrajectory.cpp:255
IceInternal::Handle< Trajectory >
armarx::DesignerTrajectory::deleteUserWaypoint
void deleteUserWaypoint(unsigned int index)
delete the userwaypoint and remove all transitions including the userwaypoint.
Definition: DesignerTrajectory.cpp:192
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:855
armarx::DesignerTrajectory::getTransition
TransitionPtr getTransition(unsigned int index)
get the transition
Definition: DesignerTrajectory.cpp:242
armarx::DesignerTrajectory::DesignerTrajectory
DesignerTrajectory(UserWaypointPtr &firstPoint, VirtualRobot::RobotNodeSetPtr newRns)
Definition: DesignerTrajectory.cpp:47
armarx::TransitionPtr
std::shared_ptr< Transition > TransitionPtr
Definition: Transition.h:143
boost::source
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:661
armarx::DesignerTrajectory::getFinalTrajectory
TrajectoryPtr getFinalTrajectory()
get the final trajectory with the right durations
Definition: DesignerTrajectory.cpp:298
armarx::DesignerTrajectory::getUserWaypoint
UserWaypointPtr getUserWaypoint(unsigned int index)
get the userWaypoint
Definition: DesignerTrajectory.cpp:229
armarx::DesignerTrajectory::getTrajectorySegment
TrajectoryPtr getTrajectorySegment(unsigned int index)
get one interBreakPoint trajectory
Definition: DesignerTrajectory.cpp:267
armarx::DesignerTrajectoryPtr
std::shared_ptr< DesignerTrajectory > DesignerTrajectoryPtr
Definition: DesignerTrajectory.h:163
Transition.h
armarx::DesignerTrajectory::addLastUserWaypoint
void addLastUserWaypoint(UserWaypointPtr &point)
add new last userWaypoint
Definition: DesignerTrajectory.cpp:139
armarx::DesignerTrajectory::setRns
void setRns(const VirtualRobot::RobotNodeSetPtr &value)
set the robotnodeset
Definition: DesignerTrajectory.cpp:15
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::DesignerTrajectory::setInterBreakpointTrajectories
void setInterBreakpointTrajectories(const std::vector< TrajectoryPtr > &value)
set the interBreakpointTrajectories
Definition: DesignerTrajectory.cpp:34
UserWaypoint.h
armarx::DesignerTrajectory::insertUserWaypoint
void insertUserWaypoint(UserWaypointPtr &point, unsigned int index)
insert userwaypoint before index
Definition: DesignerTrajectory.cpp:157