DesignerTrajectoryHolder.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::Manager
19 * @author Luca Quaer
20 * @date 2018
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25#ifndef DESIGNERTRAJECTORYHOLDER_H
26#define DESIGNERTRAJECTORYHOLDER_H
27
28#include <map>
29
30#include <VirtualRobot/RobotNodeSet.h>
31
34
35//using DesignerTrajectoryPtr = std::shared_ptr<armarx::DesignerTrajectory>;
36
37namespace armarx
38{
39 /**
40 * @brief The DesignerTrajectoryHolder class enables creating, deleting and getting
41 * DesignerTrajectorManagers, which are unambiguously assigned to a RobotNodeSet.
42 *
43 * @see DesignerTrajectoryManager
44 */
45
47 {
48 private:
49 ////////////////////////////////////////////////////////////////////////////////////////////
50 /// Attributes
51 ////////////////////////////////////////////////////////////////////////////////////////////
52 /*struct mapComparator
53 {
54 bool operator()(VirtualRobot::RobotNodeSetPtr lhs, VirtualRobot::RobotNodeSetPtr rhs) const
55 {
56 return lhs->getName().compare(rhs->getName());
57 }
58 };*/
59
60 std::map<std::string, DesignerTrajectoryManagerPtr> designerTrajectories;
61 EnvironmentPtr environment;
62
63
64 TrajectoryPtr mergeTrajectories(unsigned int fps);
65
66 public:
67 ////////////////////////////////////////////////////////////////////////////////////////////
68 /// Constructor(s)
69 ////////////////////////////////////////////////////////////////////////////////////////////
71
72 ////////////////////////////////////////////////////////////////////////////////////////////
73 /// Public functions
74 ////////////////////////////////////////////////////////////////////////////////////////////
75 /**
76 * @brief If the given RobotNodeSet is not already assigned to a DesignerTrajectoryManager
77 * a DesignerTrajectoryManager is created and assigned to this RobotNodeSet,
78 * else nothing happens.
79 * @param rns RobotNodeSet
80 * @return true, if the given RobotNodeSet was not already assigned to a
81 * DesignerTrajectoryManager;
82 * false, if the given RobotNodeSet was already assigned to a
83 * DesignerTrajectoryManager.
84 */
85 bool createDesignerTrajectoryManager(std::string rnsName);
86
87 /**
88 * @brief Deletes the DesignerTrajectoryManager assigned to the given RobotNodeSet.
89 * @param rns RobotNodeSet
90 * @return true, if DesignerTrajectoryManager existed and was successfully deleted;
91 * false, if no DesignerTrajectoryManager was assigned to the given RobotNodeSet
92 */
93 bool deleteDesignerTrajectoryManager(std::string rnsName);
94
95 /**
96 * @brief Returns the DesignerTrajectoryManager assigned to the given RobotNodeSet.
97 * @param rns RobotNodeSet
98 * @return DesignerTrajectoryManager assigned to the given RobotNodeSet.
99 */
101
102 //bool import(const DesignerTrajectory& designerTrajectory, bool force);
103 /**
104 * @brief Imports the given DesignerTrajectory.
105 *
106 * The DesignerTrajectory holds a RobotNodeSet. If this RobotNodeSet is not assigned to
107 * a DesignerTrajectoryManager then a new DesignerTrajectoryManager is created with the
108 * given DesignerTrajectory (return true).
109 * If the DesignerTrajectory's RobotNodeSet is already assigned to a
110 * DesignerTrajectoryManager there are two options:
111 * - If force is true (default), the existing DesignerTrajectoryManager gets overridden by a
112 * new DesignerTrajectoryManager created with the given DesignerTrajectory (return true).
113 * - If force is false, nothing happens (return false).
114 *
115 * @param designerTrajectory new DesignerTrajectory
116 * @param force Boolean indicating wheather to force the import or not
117 * @return (see detailed function description)
118 */
119 bool import(DesignerTrajectoryPtr designerTrajectory, bool force);
120
121 /**
122 * @brief Checks if there is already a DesignerTrajectoryManager assigned to the given
123 * RobotNodeSet.
124 * @param rns RobotNodeSet
125 * @return true, if a DesignerTrajectoryManager assigned to the given RobotNodeSet exists;
126 * false, if no DesignerTrajectoryManager is assigned to the given RobotNodeSet
127 */
128 bool rnsExists(std::string rnsName);
129
130 /**
131 * @brief Checks if the given RobotNodeSet is part of a RobotNodeSet to which a
132 * DesignerTrajectoryManager is assigned to
133 * @param rns RobotNodeSet
134 * @return true, if the given RobotNodeSet is part of a existing one;
135 * false, if the given RobotNodeSet is not part of a existing one
136 */
137 bool rnsIsPartOfExistingRns(std::string rnsName);
138
139 /**
140 * @brief isInCollision Checks if the given collision models (active and body) collide
141 * for the jointangle configurations given in the trajectory
142 * @param t trajectory combining all trajectories represented by the managers
143 * @param activeColModelName the collision model of the RobotNodeSet which gets manipulated
144 * @param bodyColModelsNames the collision models to check against
145 * @param fps resolution for collision checking in frames per second
146 * @return true in case of a collision
147 */
148 bool isInCollision(std::string activeColModelName,
149 std::vector<std::string> bodyColModelsNames,
150 unsigned int fps);
151 };
152
153 ////////////////////////////////////////////////////////////////////////////////////////////////
154 /// Typedefinitions
155 ////////////////////////////////////////////////////////////////////////////////////////////////
156 using DesignerTrajectoryHolderPtr = std::shared_ptr<armarx::DesignerTrajectoryHolder>;
157} // namespace armarx
158
159#endif // DESIGNERTRAJECTORYHOLDER_H
DesignerTrajectoryManagerPtr getTrajectoryManager(std::string rnsName)
Returns the DesignerTrajectoryManager assigned to the given RobotNodeSet.
DesignerTrajectoryHolder(EnvironmentPtr environment)
Constructor(s)
bool isInCollision(std::string activeColModelName, std::vector< std::string > bodyColModelsNames, unsigned int fps)
isInCollision Checks if the given collision models (active and body) collide for the jointangle confi...
bool rnsExists(std::string rnsName)
Checks if there is already a DesignerTrajectoryManager assigned to the given RobotNodeSet.
bool deleteDesignerTrajectoryManager(std::string rnsName)
Deletes the DesignerTrajectoryManager assigned to the given RobotNodeSet.
bool rnsIsPartOfExistingRns(std::string rnsName)
Checks if the given RobotNodeSet is part of a RobotNodeSet to which a DesignerTrajectoryManager is as...
bool createDesignerTrajectoryManager(std::string rnsName)
Public functions.
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< Trajectory > TrajectoryPtr
Definition Trajectory.h:52
std::shared_ptr< armarx::DesignerTrajectoryManager > DesignerTrajectoryManagerPtr
Typedefinitions.
std::shared_ptr< armarx::DesignerTrajectoryHolder > DesignerTrajectoryHolderPtr
Typedefinitions.
std::shared_ptr< Environment > EnvironmentPtr
Definition Environment.h:29
std::shared_ptr< DesignerTrajectory > DesignerTrajectoryPtr