hpp-manipulation-corba  4.9.0
Corba server for manipulation planning
manipulation.constraint_graph.ConstraintGraph Class Reference

This class wraps the Corba client to the server implemented by libhpp-manipulation-corba.so. More...

Inheritance diagram for manipulation.constraint_graph.ConstraintGraph:
Collaboration diagram for manipulation.constraint_graph.ConstraintGraph:

Public Member Functions

def __init__ (self, robot, graphName, makeGraph=True)
 
def addTextToTeXTranslation (self, text, tex)
 Add entry to the local dictionnary. More...
 
def setTextToTeXTranslation (self, textToTex)
 Set the local dictionnary. More...
 
def setSecurityMarginForEdge (self, edge, joint1, joint2, margin)
 Set collision security margin for a pair of joints along an edge. More...
 
Working with the constraint graph
def display (self, dotOut='/tmp/constraintgraph.dot', pdfOut='/tmp/constraintgraph', format='pdf', open=True)
 Display the current graph. More...
 
def getNodesConnectedByEdge (self, edge)
 Get nodes connected by an edge. More...
 
def applyNodeConstraints (self, node, input)
 Apply constaints to a configuration. More...
 
def applyEdgeLeafConstraints (self, edge, qfrom, input)
 Apply edge constaints to a configuration. More...
 
def generateTargetConfig (self, edge, qfrom, input)
 Generate configuration in destination state on a given leaf. More...
 
def buildAndProjectPath (self, edge, qb, qe)
 Build a path from qb to qe using the Edge::build. More...
 
def getConfigErrorForNode (self, nodeId, config)
 Get error of a config with respect to a node constraint. More...
 
def getNode (self, config)
 Get the node corresponding to the state of the configuration. More...
 
def getConfigErrorForEdge (self, edgeId, config)
 Get error of a config with respect to a edge constraint. More...
 
def getConfigErrorForEdgeLeaf (self, edgeId, leafConfig, config)
 Get error of a config with respect to an edge foliation leaf. More...
 
def getConfigErrorForEdgeTarget (self, edgeId, leafConfig, config)
 Get error of a config with respect to the target of an edge foliation leaf. More...
 
def displayNodeConstraints (self, node)
 Print set of constraints relative to a node in a string. More...
 
def displayEdgeConstraints (self, edge)
 Print set of constraints relative to an edge in a string. More...
 
def displayEdgeTargetConstraints (self, edge)
 Print set of constraints relative to an edge in a string. More...
 

Public Attributes

 robot
 
 client
 
 clientBasic
 
 graph
 
 name
 
 grasps
 
 pregrasps
 
 nodes
 A dictionnary mapping the node names to their ID. More...
 
 edges
 A dictionnary mapping the edge names to their ID. More...
 
 graphId
 
 textToTex
 

Static Public Attributes

dictionary cmdDot
 
dictionary cmdViewer
 

Building the constraint graph

def createNode (self, node, waypoint=False, priority=None)
 Create one or several node. More...
 
def createEdge (self, nodeFrom, nodeTo, name, weight=1, isInNode=None)
 Create an edge. More...
 
def setContainingNode (self, edge, node)
 Set in which node an edge is. More...
 
def getContainingNode (self, edge)
 Get in which node an edge is. More...
 
def setShort (self, edge, isShort)
 Set that an edge is short. More...
 
def isShort (self, edge)
 
def createWaypointEdge (self, nodeFrom, nodeTo, name, nb=1, weight=1, isInNode=None, automaticBuilder=True)
 Create a WaypointEdge. More...
 
def createLevelSetEdge (self, nodeFrom, nodeTo, name, weight=1, isInNode=None)
 Create a LevelSetEdge. More...
 
def createGrasp (self, name, gripper, handle, passiveJoints="")
 Create grasp constraints between robot gripper and object handle. More...
 
def createPreGrasp (self, name, gripper, handle, passiveJoints="")
 Create pre-grasp constraints between robot gripper and object handle. More...
 
def setProblemConstraints (self, name, target)
 Set the problem constraints to the specified constraint. More...
 
def addConstraints (self, graph=False, node=None, edge=None, constraints=None, passiveJoints=[])
 Add the constraints to an edge, a node or the whole graph. More...
 
def removeCollisionPairFromEdge (self, edge, joint1, joint2)
 Remove collision pairs from an edge. More...
 
def addLevelSetFoliation (self, edge, condGrasps=None, condPregrasps=None, condNC=[], condLJ=[], paramGrasps=None, paramPregrasps=None, paramNC=[], paramPassiveJoints=[], paramLJ=[])
 Add the numerical constraints to a LevelSetEdge that create the foliation. More...
 
def getWeight (self, edge)
 Get weight of an edge. More...
 
def setWeight (self, edge, weight)
 Set weight of an edge. More...
 

Automatic building

def initialize (self)
 
def buildGenericGraph (robot, name, grippers, objects, handlesPerObjects, shapesPerObjects, envNames, rules=[])
 Build a graph. More...
 

Detailed Description

This class wraps the Corba client to the server implemented by libhpp-manipulation-corba.so.

Some method implemented by the server can be considered as private. The goal of this class is to hide them and to expose those that can be considered as public.

Constructor & Destructor Documentation

◆ __init__()

def manipulation.constraint_graph.ConstraintGraph.__init__ (   self,
  robot,
  graphName,
  makeGraph = True 
)

Member Function Documentation

◆ addConstraints()

def manipulation.constraint_graph.ConstraintGraph.addConstraints (   self,
  graph = False,
  node = None,
  edge = None,
  constraints = None,
  passiveJoints = [] 
)

Add the constraints to an edge, a node or the whole graph.

This method adds the constraints to an element of the graph and handles the special cases of grasp and pregrasp constraints.

Parameters
graphset to true if you are defining constraints for every nodes,
nodeedge name of a component of the graph,
constraintsset of constraints containing grasps, pregrasps, numerical constraints and locked joints. It must be of type hpp.corbaserver.manipulation.Constraints.
passiveJointspassive joints (not modified by constraint resolution)
Note
Exaclty one of the parameter graph, node and edge must be set.
Add the constraints to an edge, a node or the whole graph

  This method adds the constraints to an element of the graph and
  handles the special cases of grasp and pregrasp constraints.

  input
    graph: set to true if you are defining constraints for every nodes,
    node, edge: name of a component of the graph,
    constraints: set of constraints containing grasps, pregrasps,
         numerical constraints and locked joints.
         It must be of type hpp.corbaserver.manipulation.Constraints.
    passiveJoints: passive joints (not modified by constraint
           resolution)
  note: Exaclty one of the parameter graph, node and edge must be set.

◆ addLevelSetFoliation()

def manipulation.constraint_graph.ConstraintGraph.addLevelSetFoliation (   self,
  edge,
  condGrasps = None,
  condPregrasps = None,
  condNC = [],
  condLJ = [],
  paramGrasps = None,
  paramPregrasps = None,
  paramNC = [],
  paramPassiveJoints = [],
  paramLJ = [] 
)

Add the numerical constraints to a LevelSetEdge that create the foliation.

Parameters
edgename of a LevelSetEdge of the graph.
condGrasps,condPregraspsname, or list of names, of grasp or pregrasp that define the foliated manifold
condNC,condLJnumerical constraints and locked joints that define the foliated manifold
paramGrasps,paramPregraspsname, or list of names, of grasp or pregrasp that parametrize the foliation
paramNC,paramPassiveJoints,paramLJnumerical constraints and locked joints that parametrize the foliation
Note
If passiveDofsNames is a shorter list than numConstraints, passiveDofsNames is extended with an empty string, which corresponds to an empty vector of passive dofs.

◆ addTextToTeXTranslation()

def manipulation.constraint_graph.ConstraintGraph.addTextToTeXTranslation (   self,
  text,
  tex 
)

Add entry to the local dictionnary.

Parameters
textplain text
texits latex translation
See also
ConstraintGraph.setTextToTeXTranslation

◆ applyEdgeLeafConstraints()

def manipulation.constraint_graph.ConstraintGraph.applyEdgeLeafConstraints (   self,
  edge,
  qfrom,
  input 
)

Apply edge constaints to a configuration.

Parameters
edgename of the edge
qfromconfiguration defining the right hand side of the edge constraint,
inputinput configuration,
Return values
outputoutput configuration,
errornorm of the residual error.

If success, the output configuration is reachable from qfrom along the transition.

◆ applyNodeConstraints()

def manipulation.constraint_graph.ConstraintGraph.applyNodeConstraints (   self,
  node,
  input 
)

Apply constaints to a configuration.

Parameters
nodename of the node the constraints of which to apply
inputinput configuration,
Return values
outputoutput configuration,
errornorm of the residual error.

◆ buildAndProjectPath()

def manipulation.constraint_graph.ConstraintGraph.buildAndProjectPath (   self,
  edge,
  qb,
  qe 
)

Build a path from qb to qe using the Edge::build.

Parameters
edgename of the edge to use.
qbconfiguration at the beginning of the path
qeconfiguration at the end of the path
Return values
returntrue if the path is built and fully projected.
indexNotProj-1 is the path could not be built. The index of the built path (before projection) in the in the ProblemSolver path vector.
indexProj-1 is the path could not be fully projected. The index of the built path (before projection) in the in the ProblemSolver path vector. No path validation is made. The paths can be retrieved using corbaserver::Problem::configAtParam

◆ buildGenericGraph()

def manipulation.constraint_graph.ConstraintGraph.buildGenericGraph (   robot,
  name,
  grippers,
  objects,
  handlesPerObjects,
  shapesPerObjects,
  envNames,
  rules = [] 
)
static

Build a graph.

Returns
a Initialized ConstraintGraph object
See also
hpp::corbaserver::manipulation::Graph::autoBuild for complete documentation.

◆ createEdge()

def manipulation.constraint_graph.ConstraintGraph.createEdge (   self,
  nodeFrom,
  nodeTo,
  name,
  weight = 1,
  isInNode = None 
)

Create an edge.

Parameters
nodeFrom,nodeTothe extremities of the edge,
namename of the edge,
weightsee note,
isInNodename of the node in which paths of the edge are included. if None, it consists of the node coming the latest in the list of nodes.
Note
The weights define the probability of selecting an edge among all the outgoing edges of a node. The probability of an edge is $ \frac{w_i}{\sum_j{w_j}} $, where each $ w_j $ corresponds to an outgoing edge from a given node. To have an edge that cannot be selected by the M-RRT algorithm but is still acceptable, set its weight to zero.

◆ createGrasp()

def manipulation.constraint_graph.ConstraintGraph.createGrasp (   self,
  name,
  gripper,
  handle,
  passiveJoints = "" 
)

Create grasp constraints between robot gripper and object handle.

Creates two contraints between a handle and a gripper.

  • The first constraint named "${name}" is defined by the type of handle. For instance, an axial handle defines a five degree of freedom constraint with free rotation around the x-axis.
  • the second constraint named "${name}/complement" is the complement to the full transformation constraint. For the axial handle, it corresponds to the rotation around x.
Parameters
nameprefix of the constraint names for storing in ProblemSolver map,
grippername of the gripper used when it has been created
handlename of the handle in the form "object/handle" where object is the name of the object owning the handle and handle is the name of the handle in this object.
passiveJointsname of the set of passive joints associated to the grasp constraints as register in ProblemSolver
See also
manipulation.problem_solver.ProblemSolver::addPassiveDofs.
method hpp::corbaserver::manipulation::Problem::createGrasp.
Note
Passive joints are only used for path constraints and are for computational optimization only.

◆ createLevelSetEdge()

def manipulation.constraint_graph.ConstraintGraph.createLevelSetEdge (   self,
  nodeFrom,
  nodeTo,
  name,
  weight = 1,
  isInNode = None 
)

Create a LevelSetEdge.

Parameters
nodeFrom,nodeTo,name,weight,isInNodesee createEdge note.
Note
See documentation of class hpp::manipulation::graph::LevelSetEdge for more information.

◆ createNode()

def manipulation.constraint_graph.ConstraintGraph.createNode (   self,
  node,
  waypoint = False,
  priority = None 
)

Create one or several node.

Parameters
nodename (resp. list of names) of the node(s) to be created.
waypointset to True when creating waypoint nodes.
priorityinteger (resp. list of) used to order the states. If two states have the same priority, then the order is the order of creation.
Note
The order is important. The first should be the most restrictive one as a configuration will be in the first node for which the constraint are satisfied.

◆ createPreGrasp()

def manipulation.constraint_graph.ConstraintGraph.createPreGrasp (   self,
  name,
  gripper,
  handle,
  passiveJoints = "" 
)

Create pre-grasp constraints between robot gripper and object handle.

Creates two contraints between a handle and a gripper.

  • The first constraint named "${name}" is the same as the grasp defined in createGrasp, except that the translation along x is not constrained. For instance, an axial handle defines a four degree of freedom constraint with free rotation and translation around/along the x-axis,
  • the second constraint named "${name}/double_ineq" is a double inequality on the relative x-position of the handle and of the gripper. the bounds of the inequality are for now [-.001 c, 2.001 c].
Parameters
nameprefix of the constraint names for storing in ProblemSolver map,
grippername of the gripper used when it has been created
handlename of the handle in the form "object/handle" where object is the name of the object owning the handle and handle is the name of the handle in this object,
passiveJointsname of the set of passive joints associated to the pre-grasp constraints as register in ProblemSolver.
See also
manipulation.problem_solver.ProblemSolver::addPassiveDofs.
hpp::corbaserver::manipulation::Problem::createPreGrasp
Note
Passive joints are only used for path constraints and are for computational optimization only.

◆ createWaypointEdge()

def manipulation.constraint_graph.ConstraintGraph.createWaypointEdge (   self,
  nodeFrom,
  nodeTo,
  name,
  nb = 1,
  weight = 1,
  isInNode = None,
  automaticBuilder = True 
)

Create a WaypointEdge.

Parameters
nodeFrom,nodeTo,name,weight,isInNodesee createEdge note,
nbnumber of waypoints,
Note
See documentation of class hpp::manipulation::graph::WaypointEdge for more information.
Warning
Waypoint are now specified by hand to allow finer handling of edge types between waypoints. This function has been updated to be backward compatible but except for the return value. For a finer control of what you are doing, set automaticBuilder to False.

◆ display()

def manipulation.constraint_graph.ConstraintGraph.display (   self,
  dotOut = '/tmp/constraintgraph.dot',
  pdfOut = '/tmp/constraintgraph',
  format = 'pdf',
  open = True 
)

Display the current graph.

The graph is printed in DOT format. Command dot must be available.

Parameters
dotOutfull path of the generated DOT file.
pdfOutfill path of the generated PDF document.
openPDFset to False if you just want to generate the PDF.
Note
DOT and PDF files will be overwritten and are not automatically deleted so you can keep them.

◆ displayEdgeConstraints()

def manipulation.constraint_graph.ConstraintGraph.displayEdgeConstraints (   self,
  edge 
)

Print set of constraints relative to an edge in a string.

Parameters
configConfiguration,
edgeIdid of the edge.
Returns
string displaying path constraints of the edge

◆ displayEdgeTargetConstraints()

def manipulation.constraint_graph.ConstraintGraph.displayEdgeTargetConstraints (   self,
  edge 
)

Print set of constraints relative to an edge in a string.

Parameters
configConfiguration,
edgeIdid of the edge.
Returns
string displaying constraints of the edge and of the target node

◆ displayNodeConstraints()

def manipulation.constraint_graph.ConstraintGraph.displayNodeConstraints (   self,
  node 
)

Print set of constraints relative to a node in a string.

Parameters
configConfiguration,
nodeIdid of the node.
Returns
string displaying constraints

◆ generateTargetConfig()

def manipulation.constraint_graph.ConstraintGraph.generateTargetConfig (   self,
  edge,
  qfrom,
  input 
)

Generate configuration in destination state on a given leaf.

Parameters
edgename of the edge
qfromconfiguration defining the right hand side of the edge constraint,
inputinput configuration,
Return values
outputoutput configuration,
errornorm of the residual error.

Compute a configuration in the destination node of the edge, reachable from qFrom.

◆ getConfigErrorForEdge()

def manipulation.constraint_graph.ConstraintGraph.getConfigErrorForEdge (   self,
  edgeId,
  config 
)

Get error of a config with respect to a edge constraint.

Parameters
edgename of the edge.
configConfiguration,
Return values
errorthe error of the edge constraint for the configuration
Returns
whether the configuration belongs to the edge. Call methods core::ConfigProjector::rightHandSideFromConfig with the input configuration and then core::ConstraintSet::isSatisfied on the edge constraints.

◆ getConfigErrorForEdgeLeaf()

def manipulation.constraint_graph.ConstraintGraph.getConfigErrorForEdgeLeaf (   self,
  edgeId,
  leafConfig,
  config 
)

Get error of a config with respect to an edge foliation leaf.

Parameters
edgeIdid of the edge.
leafConfigConfiguration that determines the foliation leaf,
configConfiguration the error of which is computed
Return values
errorthe error
Returns
whether config can be the end point of a path of the edge starting at leafConfig Call methods core::ConfigProjector::rightHandSideFromConfig with leafConfig and then core::ConstraintSet::isSatisfied with config. on the edge constraints.

◆ getConfigErrorForEdgeTarget()

def manipulation.constraint_graph.ConstraintGraph.getConfigErrorForEdgeTarget (   self,
  edgeId,
  leafConfig,
  config 
)

Get error of a config with respect to the target of an edge foliation leaf.

Parameters
edgeIdid of the edge.
leafConfigConfiguration that determines the foliation leaf,
configConfiguration the error of which is computed
Return values
errorthe error
Returns
whether config can be the end point of a path of the edge starting at leafConfig Call methods core::ConfigProjector::rightHandSideFromConfig with leafConfig and then core::ConstraintSet::isSatisfied with config. on the edge constraints.

◆ getConfigErrorForNode()

def manipulation.constraint_graph.ConstraintGraph.getConfigErrorForNode (   self,
  nodeId,
  config 
)

Get error of a config with respect to a node constraint.

Parameters
nodename of the node.
configConfiguration,
Return values
errorthe error of the node constraint for the configuration
Returns
whether the configuration belongs to the node. Call method core::ConstraintSet::isSatisfied for the node constraints.

◆ getContainingNode()

def manipulation.constraint_graph.ConstraintGraph.getContainingNode (   self,
  edge 
)

Get in which node an edge is.

Parameters
edgethe edge, Paths satisfying the edge constraints satisfy the node constraints.

◆ getNode()

def manipulation.constraint_graph.ConstraintGraph.getNode (   self,
  config 
)

Get the node corresponding to the state of the configuration.

Parameters
dofArraythe configuration.
Returns
the name of the node

◆ getNodesConnectedByEdge()

def manipulation.constraint_graph.ConstraintGraph.getNodesConnectedByEdge (   self,
  edge 
)

Get nodes connected by an edge.

Parameters
edgename of the edge
fromname of the node the edge starts from,
toname of the node the edge finishes in.

◆ getWeight()

def manipulation.constraint_graph.ConstraintGraph.getWeight (   self,
  edge 
)

Get weight of an edge.

◆ initialize()

def manipulation.constraint_graph.ConstraintGraph.initialize (   self)

◆ isShort()

def manipulation.constraint_graph.ConstraintGraph.isShort (   self,
  edge 
)

◆ removeCollisionPairFromEdge()

def manipulation.constraint_graph.ConstraintGraph.removeCollisionPairFromEdge (   self,
  edge,
  joint1,
  joint2 
)

Remove collision pairs from an edge.

Parameters
edgename of the edge,
joint1,joint2,namesof the joints defining the pair.

◆ setContainingNode()

def manipulation.constraint_graph.ConstraintGraph.setContainingNode (   self,
  edge,
  node 
)

Set in which node an edge is.

Parameters
edgethe edge,
nodethe node. Paths satisfying the edge constraints satisfy the node constraints.

◆ setProblemConstraints()

def manipulation.constraint_graph.ConstraintGraph.setProblemConstraints (   self,
  name,
  target 
)

Set the problem constraints to the specified constraint.

Parameters
idCompID of a node or a configuration
targetignored for states. For edges:
  • true: uses the edge target constraint
  • false: uses the edge path constraint

◆ setSecurityMarginForEdge()

def manipulation.constraint_graph.ConstraintGraph.setSecurityMarginForEdge (   self,
  edge,
  joint1,
  joint2,
  margin 
)

Set collision security margin for a pair of joints along an edge.

Parameters
edgename of the edge,
joint1,joint2names of the joints or "universe" for the environment,
marginsecurity margin.

◆ setShort()

def manipulation.constraint_graph.ConstraintGraph.setShort (   self,
  edge,
  isShort 
)

Set that an edge is short.

Parameters
edgename of the edge
Trueor False

When an edge is tagged as short, extension along this edge is done differently in RRT-like algorithms. Instead of projecting a random configuration in the destination node, the configuration to extend itself is projected in the destination node. This makes the rate of success higher.

◆ setTextToTeXTranslation()

def manipulation.constraint_graph.ConstraintGraph.setTextToTeXTranslation (   self,
  textToTex 
)

Set the local dictionnary.

Parameters
textToTexa dictionnary of (plain text, TeX replacment) If the name of a node or an edges is a key of the dictionnary, it is replaced by the corresponding value.

◆ setWeight()

def manipulation.constraint_graph.ConstraintGraph.setWeight (   self,
  edge,
  weight 
)

Set weight of an edge.

Member Data Documentation

◆ client

manipulation.constraint_graph.ConstraintGraph.client

◆ clientBasic

manipulation.constraint_graph.ConstraintGraph.clientBasic

◆ cmdDot

dictionary manipulation.constraint_graph.ConstraintGraph.cmdDot
static
Initial value:
= {
'pdf': ['dot', '-Gsize=7.5,10', '-Tpdf'],
'svg': ['dot', '-Gsize=7.5,10', '-Tsvg']
}

◆ cmdViewer

dictionary manipulation.constraint_graph.ConstraintGraph.cmdViewer
static
Initial value:
= {
'pdf': ['evince'],
'svg': ['firefox']
}

◆ edges

manipulation.constraint_graph.ConstraintGraph.edges

A dictionnary mapping the edge names to their ID.

◆ graph

manipulation.constraint_graph.ConstraintGraph.graph

◆ graphId

manipulation.constraint_graph.ConstraintGraph.graphId

◆ grasps

manipulation.constraint_graph.ConstraintGraph.grasps

◆ name

manipulation.constraint_graph.ConstraintGraph.name

◆ nodes

manipulation.constraint_graph.ConstraintGraph.nodes

A dictionnary mapping the node names to their ID.

◆ pregrasps

manipulation.constraint_graph.ConstraintGraph.pregrasps

◆ robot

manipulation.constraint_graph.ConstraintGraph.robot

◆ textToTex

manipulation.constraint_graph.ConstraintGraph.textToTex

The documentation for this class was generated from the following file: