| Line |
Branch |
Exec |
Source |
| 1 |
|
|
// Copyright (c) 2014, LAAS-CNRS |
| 2 |
|
|
// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) |
| 3 |
|
|
// |
| 4 |
|
|
|
| 5 |
|
|
// Redistribution and use in source and binary forms, with or without |
| 6 |
|
|
// modification, are permitted provided that the following conditions are |
| 7 |
|
|
// met: |
| 8 |
|
|
// |
| 9 |
|
|
// 1. Redistributions of source code must retain the above copyright |
| 10 |
|
|
// notice, this list of conditions and the following disclaimer. |
| 11 |
|
|
// |
| 12 |
|
|
// 2. Redistributions in binary form must reproduce the above copyright |
| 13 |
|
|
// notice, this list of conditions and the following disclaimer in the |
| 14 |
|
|
// documentation and/or other materials provided with the distribution. |
| 15 |
|
|
// |
| 16 |
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 |
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 |
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 |
|
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 |
|
|
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 |
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 |
|
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 |
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 |
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 |
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 |
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
| 27 |
|
|
// DAMAGE. |
| 28 |
|
|
|
| 29 |
|
|
#ifndef HPP_MANIPULATION_CORBA_GRAPH_IMPL_HH |
| 30 |
|
|
#define HPP_MANIPULATION_CORBA_GRAPH_IMPL_HH |
| 31 |
|
|
|
| 32 |
|
|
#include <hpp/manipulation/graph/graph.hh> |
| 33 |
|
|
#include <hpp/manipulation/problem-solver.hh> |
| 34 |
|
|
|
| 35 |
|
|
#include "hpp/corbaserver/manipulation/fwd.hh" |
| 36 |
|
|
#include "hpp/corbaserver/manipulation/graph-idl.hh" |
| 37 |
|
|
|
| 38 |
|
|
namespace hpp { |
| 39 |
|
|
namespace manipulation { |
| 40 |
|
|
namespace impl { |
| 41 |
|
|
using CORBA::Long; |
| 42 |
|
|
using hpp::corbaserver::manipulation::Namess_t; |
| 43 |
|
|
using hpp::corbaserver::manipulation::Rules; |
| 44 |
|
|
|
| 45 |
|
|
class Graph : public virtual POA_hpp::corbaserver::manipulation::Graph { |
| 46 |
|
|
public: |
| 47 |
|
|
Graph(); |
| 48 |
|
✗ |
void setServer(Server* server) { server_ = server; } |
| 49 |
|
|
|
| 50 |
|
|
virtual Long createGraph(const char* graphName); |
| 51 |
|
|
|
| 52 |
|
|
virtual void deleteGraph(const char* graphName); |
| 53 |
|
|
|
| 54 |
|
|
virtual void selectGraph(const char* graphName); |
| 55 |
|
|
|
| 56 |
|
|
virtual void createSubGraph(const char* subgraphName); |
| 57 |
|
|
|
| 58 |
|
|
virtual void setTargetNodeList(const ID graphId, const hpp::IDseq& nodes); |
| 59 |
|
|
|
| 60 |
|
|
virtual Long createNode(const Long subGraphId, const char* nodeName, |
| 61 |
|
|
const bool waypoint, const Long priority); |
| 62 |
|
|
|
| 63 |
|
|
virtual Long createEdge(const Long nodeFromId, const Long nodeToId, |
| 64 |
|
|
const char* edgeName, const Long weight, |
| 65 |
|
|
const Long isInNodeId); |
| 66 |
|
|
|
| 67 |
|
|
virtual Long createWaypointEdge(const Long nodeFromId, const Long nodeToId, |
| 68 |
|
|
const char* edgeBaseName, const Long number, |
| 69 |
|
|
const Long weight, const Long isInNodeId); |
| 70 |
|
|
|
| 71 |
|
|
virtual void setWaypoint(const ID waypointEdgeId, const Long index, |
| 72 |
|
|
const ID edgeId, const ID nodeId); |
| 73 |
|
|
|
| 74 |
|
|
virtual void getGraph(GraphComp_out graph, GraphElements_out elmts); |
| 75 |
|
|
|
| 76 |
|
|
virtual void getEdgeStat(ID edgeId, Names_t_out reasons, intSeq_out freqs); |
| 77 |
|
|
|
| 78 |
|
|
virtual Long getFrequencyOfNodeInRoadmap( |
| 79 |
|
|
ID nodeId, intSeq_out freqPerConnectedComponent); |
| 80 |
|
|
|
| 81 |
|
|
virtual bool getConfigProjectorStats(ID elmt, ConfigProjStat_out config, |
| 82 |
|
|
ConfigProjStat_out path); |
| 83 |
|
|
|
| 84 |
|
|
virtual Long getWaypoint(const Long edgeId, const Long index, |
| 85 |
|
|
hpp::ID_out nodeId); |
| 86 |
|
|
|
| 87 |
|
|
virtual Long createLevelSetEdge(const Long nodeFromId, const Long nodeToId, |
| 88 |
|
|
const char* edgeName, const Long w, |
| 89 |
|
|
const Long isInNodeId); |
| 90 |
|
|
|
| 91 |
|
|
virtual void setContainingNode(const ID edgeId, const ID nodeId); |
| 92 |
|
|
|
| 93 |
|
|
virtual char* getContainingNode(const ID edgeId); |
| 94 |
|
|
|
| 95 |
|
|
virtual void addLevelSetFoliation(const Long edgeId, |
| 96 |
|
|
const hpp::Names_t& condNC, |
| 97 |
|
|
const hpp::Names_t& paramNC); |
| 98 |
|
|
|
| 99 |
|
✗ |
virtual void setNumericalConstraints(const Long graphComponentId, |
| 100 |
|
|
const hpp::Names_t& constraintNames) { |
| 101 |
|
✗ |
addNumericalConstraints(graphComponentId, constraintNames); |
| 102 |
|
|
} |
| 103 |
|
|
virtual void addNumericalConstraints(const Long graphComponentId, |
| 104 |
|
|
const hpp::Names_t& constraintNames); |
| 105 |
|
|
|
| 106 |
|
|
virtual void getNumericalConstraints(const Long elmtId, |
| 107 |
|
|
hpp::Names_t_out names); |
| 108 |
|
|
|
| 109 |
|
|
virtual void resetConstraints(const Long graphComponentId); |
| 110 |
|
|
|
| 111 |
|
✗ |
virtual void setNumericalConstraintsForPath( |
| 112 |
|
|
const Long nodeId, const hpp::Names_t& constraintNames) { |
| 113 |
|
✗ |
addNumericalConstraintsForPath(nodeId, constraintNames); |
| 114 |
|
|
} |
| 115 |
|
|
virtual void addNumericalConstraintsForPath( |
| 116 |
|
|
const Long nodeId, const hpp::Names_t& constraintNames); |
| 117 |
|
|
|
| 118 |
|
|
virtual void removeCollisionPairFromEdge(ID edgeId, const char* joint1, |
| 119 |
|
|
const char* joint2); |
| 120 |
|
|
|
| 121 |
|
|
virtual void getNode(const hpp::floatSeq& dofArray, ID_out output); |
| 122 |
|
|
|
| 123 |
|
|
virtual bool applyNodeConstraints(hpp::ID id, const hpp::floatSeq& input, |
| 124 |
|
|
hpp::floatSeq_out output, |
| 125 |
|
|
double& residualError); |
| 126 |
|
|
|
| 127 |
|
|
virtual bool applyEdgeLeafConstraints(hpp::ID IDedge, |
| 128 |
|
|
const hpp::floatSeq& qleaf, |
| 129 |
|
|
const hpp::floatSeq& input, |
| 130 |
|
|
hpp::floatSeq_out output, |
| 131 |
|
|
double& residualError); |
| 132 |
|
|
|
| 133 |
|
|
virtual bool generateTargetConfig(hpp::ID IDedge, const hpp::floatSeq& qleaf, |
| 134 |
|
|
const hpp::floatSeq& input, |
| 135 |
|
|
hpp::floatSeq_out output, |
| 136 |
|
|
double& residualError); |
| 137 |
|
|
|
| 138 |
|
|
virtual CORBA::Boolean getConfigErrorForNode(ID nodeId, |
| 139 |
|
|
const hpp::floatSeq& dofArray, |
| 140 |
|
|
hpp::floatSeq_out error); |
| 141 |
|
|
|
| 142 |
|
|
virtual CORBA::Boolean getConfigErrorForEdge(ID edgeId, |
| 143 |
|
|
const hpp::floatSeq& dofArray, |
| 144 |
|
|
hpp::floatSeq_out error); |
| 145 |
|
|
|
| 146 |
|
|
virtual CORBA::Boolean getConfigErrorForEdgeLeaf( |
| 147 |
|
|
ID edgeId, const hpp::floatSeq& leafDofArray, |
| 148 |
|
|
const hpp::floatSeq& dofArray, hpp::floatSeq_out error); |
| 149 |
|
|
|
| 150 |
|
|
virtual CORBA::Boolean getConfigErrorForEdgeTarget( |
| 151 |
|
|
ID edgeId, const hpp::floatSeq& leafDofArray, |
| 152 |
|
|
const hpp::floatSeq& dofArray, hpp::floatSeq_out error); |
| 153 |
|
|
|
| 154 |
|
|
virtual void displayNodeConstraints(hpp::ID nodeId, |
| 155 |
|
|
CORBA::String_out constraints); |
| 156 |
|
|
|
| 157 |
|
|
virtual void displayEdgeConstraints(hpp::ID edgeId, |
| 158 |
|
|
CORBA::String_out constraints); |
| 159 |
|
|
|
| 160 |
|
|
virtual void displayEdgeTargetConstraints(hpp::ID edgeId, |
| 161 |
|
|
CORBA::String_out constraints); |
| 162 |
|
|
|
| 163 |
|
|
virtual void getNodesConnectedByEdge(hpp::ID edgeId, CORBA::String_out from, |
| 164 |
|
|
CORBA::String_out to); |
| 165 |
|
|
|
| 166 |
|
|
virtual void display(const char* filename); |
| 167 |
|
|
|
| 168 |
|
|
virtual void getHistogramValue(ID edgeId, hpp::floatSeq_out freq, |
| 169 |
|
|
hpp::floatSeqSeq_out values); |
| 170 |
|
|
|
| 171 |
|
|
virtual void setShort(ID edgeId, CORBA::Boolean isShort); |
| 172 |
|
|
|
| 173 |
|
|
virtual bool isShort(ID edgeId); |
| 174 |
|
|
|
| 175 |
|
|
virtual Long autoBuild(const char* graphName, const Names_t& grippers, |
| 176 |
|
|
const Names_t& objects, |
| 177 |
|
|
const Namess_t& handlesPerObject, |
| 178 |
|
|
const Namess_t& shapesPreObject, |
| 179 |
|
|
const Names_t& envNames, const Rules& rulesList); |
| 180 |
|
|
|
| 181 |
|
|
virtual void setWeight(ID edgeId, const Long weight); |
| 182 |
|
|
|
| 183 |
|
|
virtual Long getWeight(ID edgeId); |
| 184 |
|
|
|
| 185 |
|
|
virtual char* getName(ID elmtId); |
| 186 |
|
|
|
| 187 |
|
|
virtual void initialize(); |
| 188 |
|
|
|
| 189 |
|
|
virtual void getRelativeMotionMatrix(ID edgeID, intSeqSeq_out matrix); |
| 190 |
|
|
virtual void setSecurityMarginForEdge(ID edgeId, const char* joint1, |
| 191 |
|
|
const char* joint2, double margin); |
| 192 |
|
|
virtual void getSecurityMarginMatrixForEdge(ID edgeId, |
| 193 |
|
|
floatSeqSeq_out matrix); |
| 194 |
|
|
|
| 195 |
|
|
private: |
| 196 |
|
|
template <typename T> |
| 197 |
|
|
shared_ptr<T> getComp(ID id, bool throwIfWrongType = true); |
| 198 |
|
|
ProblemSolverPtr_t problemSolver(); |
| 199 |
|
|
graph::GraphPtr_t graph(bool throwIfNull = true); |
| 200 |
|
|
Server* server_; |
| 201 |
|
|
}; // class Graph |
| 202 |
|
|
} // namespace impl |
| 203 |
|
|
} // namespace manipulation |
| 204 |
|
|
} // namespace hpp |
| 205 |
|
|
|
| 206 |
|
|
#endif // HPP_MANIPULATION_CORBA_GRAPH_IMPL_HH |
| 207 |
|
|
|