hpp-affordance-corba  5.0.0
Corba server for Humanoid Path Planner Affordance applications
affordance.affordance.AffordanceTool Class Reference

Public Member Functions

def __init__ (self, context=None, port=13331)
 
def removeObstacleFromJoint (self, objectName, jointName, collision, distance)
 
def resetAffordanceConfig (self)
 
def setAffordanceConfig (self, affType, config)
 
def getAffordanceConfig (self, affType)
 
def setMargin (self, affType, margin)
 
def setNeighbouringTriangleMargin (self, affType, nbTriMargin)
 
def setMinimumArea (self, affType, minArea)
 
def analyseAll (self, reduceSizes=[])
 
def analyseObject (self, objectName, reduceSizes)
 
def getAffordancePoints (self, affordanceType)
 
def getAffordanceTypes (self)
 
def getAffRefObstacles (self, affType)
 
def loadObstacleModel (self, filename, prefix, Viewer, guiOnly=False, reduceSizes=[])
 
def visualiseAllAffordances (self, affType, Viewer, colour)
 
def visualiseAffordances (self, affType, Viewer, colour, obstacleName="")
 
def deleteAffordances (self, Viewer, obstacleName="")
 
def deleteAffordancesFromViewer (self, Viewer, obstacleName="")
 
def deleteAffordancesByType (self, affordanceType, Viewer, obstacleName="")
 
def deleteAffordancesByTypeFromViewer (self, affordanceType, Viewer, obstacleName="")
 
def deleteNode (self, nodeName, all, Viewer)
 
def getObstacleNames (self, collision, distance)
 

Public Attributes

 client
 

Detailed Description

\\brief Load and handle an AffordanceTool for analysis of the environment.

 AffordanceTool offers a set of helper functions that combines the affordance
analysis on the C++ side with visualisation tools. The objective is to make the
analysis tools more intuitive for the user.

Constructor & Destructor Documentation

◆ __init__()

def affordance.affordance.AffordanceTool.__init__ (   self,
  context = None,
  port = 13331 
)

Member Function Documentation

◆ analyseAll()

def affordance.affordance.AffordanceTool.analyseAll (   self,
  reduceSizes = [] 
)
\\brief Analyse all loaded obstacles in the problem solver.

 All found affordance objects are added to their corresponding
 container in problem solver.
 \\param reduceSizes : dimension of the reduction applied to the plan (to shrink
 the borders of each affordances plans).
   The order of the value in the vector correspond to the order of the
   affordance type creation in affordance.impl.cc : Afford::createOperations ().

◆ analyseObject()

def affordance.affordance.AffordanceTool.analyseObject (   self,
  objectName,
  reduceSizes 
)
\\biref Analyse one object by name

 Found affordance objects are added to a container in problem solver.

 \\param objectName name of the object to analyse.
 \\param reduceSizes : dimension of the reduction applied to the plan (to shrink
 the borders of each affordances plans).
   The order of the value in the vector correspond to the order of the
   affordance type creation in affordance.impl.cc : Afford::createOperations ().

◆ deleteAffordances()

def affordance.affordance.AffordanceTool.deleteAffordances (   self,
  Viewer,
  obstacleName = "" 
)
\\brief Delete affordances for given object.

 Deletes affordance objects both from problem solver and from viewer.
 If no objectName provided, all affordances will be deleted.

 \\param Viewer viewer object to erase affordance objects from visualiser
 \\param obstacleName name of obstacle the affordances of which will
be deleted.

◆ deleteAffordancesByType()

def affordance.affordance.AffordanceTool.deleteAffordancesByType (   self,
  affordanceType,
  Viewer,
  obstacleName = "" 
)
\\brief Delete affordances of given type for a collisionObstacle.

 If no objectName provided, all affordances of given type will be
 deleted. Deleted affordance objects from problem solver and viewer.

 \\param affordanceType type of affordance to be deleted
 \\param Viewer viewer object to erase affordance objects from visualiser
 \\param obstacleName name of obstacle the affordances of which will
be deleted.

◆ deleteAffordancesByTypeFromViewer()

def affordance.affordance.AffordanceTool.deleteAffordancesByTypeFromViewer (   self,
  affordanceType,
  Viewer,
  obstacleName = "" 
)
\\brief Delete affordance objects of given type from viewer for a
collisionObstacle

 For a given collisionObstacle, delete nodes in viewer that correspond
 to a specific affordance type. The function goes through, for all
 affordance types, the list of nodes in the group, and deletes the
 nodes that have obstacleName as part of their name. If no obstacleName
 is given, all affordance ojbects of type affordanceType are deleted
 from viewer.

 \\param affordanceType type of affordance to be deleted
   \\param Viewer viewer object to erase affordance objects from visualiser
 \\param obstacleName name of obstacle the affordances of which will
be deleted.

◆ deleteAffordancesFromViewer()

def affordance.affordance.AffordanceTool.deleteAffordancesFromViewer (   self,
  Viewer,
  obstacleName = "" 
)
\\brief Delete affordance surfaces from viewer.

 For a given collisionObstacle, delete all nodes in viewer that
 correspond to its affordance surfaces. The function goes through,
 for all affordance types, the list of nodes in the group, and deletes
 the nodes that have obstacleName as part of their name.

\\param Viewer viewer object to erase affordance objects from visualiser
\\param obstacleName Name of collision obstacle for which affordances
       will be deleted

◆ deleteNode()

def affordance.affordance.AffordanceTool.deleteNode (   self,
  nodeName,
  all,
  Viewer 
)
\\brief Delete node from visualiser

\\param nodeName name of node to be deleted
\\param all boolean that determines ...?
\\param Viewer viewer object used to execute deletion function

◆ getAffordanceConfig()

def affordance.affordance.AffordanceTool.getAffordanceConfig (   self,
  affType 
)
\\brief Returns the configuration of the given affordance type requirement

 \\param affType affordance type for which the configuration is requested

◆ getAffordancePoints()

def affordance.affordance.AffordanceTool.getAffordancePoints (   self,
  affordanceType 
)
\\brief Get vertex points of all triangles of an affordance type.

  Returns the global position of of all vertices of the triangles
  of individual affordance obstacles of given type. Useful for
  visualisation purposes. The size of the return variable is the number
 of affordance obstacles of the requested type. The order of the
 returned objects is the same as that returned by the function
 getAffRefObstacles. Useful for visualisation.

 \\param affordanceType name of the affordance type for which
the triangle points will be provided.

◆ getAffordanceTypes()

def affordance.affordance.AffordanceTool.getAffordanceTypes (   self)
\\brief Get list of affordance types used in affordance analysis.

 Helper function that returns a list of strings. Useful as many
 functions require an affordance type as input parameter, and the
 spelling (capital letters etc.) matters.

◆ getAffRefObstacles()

def affordance.affordance.AffordanceTool.getAffRefObstacles (   self,
  affType 
)
\\brief Get list of CollisionObstacle names corresponding to affordance objects
 of a scpecific type.

 Helper function that returns a list of the reference collisionObstacles
 (as string type) for all affordance object of given affordance type. The
 return variable has the same size as the number of affordance obstacles
 of the requested type, and the order matches that of the affordance objects
 returned by function getAffordancePoints. Useful for visualisation.

 \\param affType The affordance type for which the reference obstacles will
be provided.

◆ getObstacleNames()

def affordance.affordance.AffordanceTool.getObstacleNames (   self,
  collision,
  distance 
)
get list of obstacles in problem solver.

\\param collision  whether to return obstacle for collision (boolean)
\\param distance whether to return obstacles for distance
 computation (boolean).

◆ loadObstacleModel()

def affordance.affordance.AffordanceTool.loadObstacleModel (   self,
  filename,
  prefix,
  Viewer,
  guiOnly = False,
  reduceSizes = [] 
)
\\brief Load obstacles, visualise them in viewer and analyse them for
affordances.

 Loads obstacle model and saves it in problem solver. The obstacle is
 also shown in the viewer, and subsequently searched for affordance
 objects. To do the affordance analysis on the added object, it is
 searched for in the list of existing obstacles in problem solver.
 This search works without problems only if the prefix parameter
 does not contain the '/' character!

 \\param filename name of the urdf file, may contain "package://"
 \\param prefix prefix added to object names in case the same file
is loaded several times. It should not cointain the '/' character
 \\param Viewer viewer object to load loaded obstacles to visualiser
 \\param guiOnly whether to control only gepetto-viewer-server

◆ removeObstacleFromJoint()

def affordance.affordance.AffordanceTool.removeObstacleFromJoint (   self,
  objectName,
  jointName,
  collision,
  distance 
)
\\brief Remove an obstacle from outer objects of a joint body.

 This function also deletes all affordance objects created
 for the given obstacle, both from the problem solver and
 from the viewer.

 \\param objectName name of the object to remove,
 \\param jointName name of the joint owning the body,
 \\param collision whether collision with object should be computed,
 \\param distance whether distance to object should be computed.

◆ resetAffordanceConfig()

def affordance.affordance.AffordanceTool.resetAffordanceConfig (   self)
\\brief Reset the current configuration of the given affordance
 type requirement to default values.

◆ setAffordanceConfig()

def affordance.affordance.AffordanceTool.setAffordanceConfig (   self,
  affType,
  config 
)
\\brief  changes the default configuration of the given affordance type
requirement

 The configuration vector has size 3 and comprises the error margin,
 the angle margin for neighbouring triangles and the minimum area,
 in that order.

 \\param affType affordance type for which the change is made
 \\param conf configuration vector of size 3

◆ setMargin()

def affordance.affordance.AffordanceTool.setMargin (   self,
  affType,
  margin 
)
\\brief Changes the error margin used to evaluate the affordance requirement
 of a given affordance type

 \\param affType affordance type for which the change is made
 \\param margin new value for the error margin

◆ setMinimumArea()

def affordance.affordance.AffordanceTool.setMinimumArea (   self,
  affType,
  minArea 
)
\\brief Changes the minimum area used to evaluate the affordance requirement
  of a given affordance type
 \\param affType affordance type for which the change is made
 \\param nimArea new value for the minimum accepted area

◆ setNeighbouringTriangleMargin()

def affordance.affordance.AffordanceTool.setNeighbouringTriangleMargin (   self,
  affType,
  nbTriMargin 
)
\\brief Changes the angle margin used to evaluate whether neighbouring
 triangles form part of the potential affordance as the current
 triangle.

 \\param affType affordance type for which the change is made
 \\param nbTriMargin new value for the neighbouring triangle margin

◆ visualiseAffordances()

def affordance.affordance.AffordanceTool.visualiseAffordances (   self,
  affType,
  Viewer,
  colour,
  obstacleName = "" 
)
\\brief Visualise affordance surfaces of given type for one obstacle.

 For a given affordance type and collisionObstacle, this function
 visualised the affordance surfaces and adds them as triangles into
 the viewer. If no obstacleName is provided, the visualiseAllAffordances
 function is executed instead.
 If a name is given, the affordance surfaces for the corresponding
 obstacle are first deleted, and if no node of the name affType is
 found, it is created. Then, the function adds nodes to this group.
 The nodes correspond to the triangles (and their global position)
 of all affordance objects of the given affordance type. The naming
 convention is as follows:
 "AffordanceType-ReferenceObstacleName.indexInAffObjectVector.triangleIndex"
 where indexInAffObjectVector is the index of one affordance object in the
 vector corresponding to the given affordance type (within a container in
 problem solver). triangleIndex is the index of one triangle within the
 current affordance object.

 \\param affType the type of affordance to be visualised
 \\param Viewer viewer object to load affordance objects to visualiser
 \\param colour vector of length 4 (normalized rgba),
defined in the interval [0, 1]
 \\param obstacleName Name of collision obstacle for which affordances
will be visualised

◆ visualiseAllAffordances()

def affordance.affordance.AffordanceTool.visualiseAllAffordances (   self,
  affType,
  Viewer,
  colour 
)
\\brief Visualise all found affordance surfaces for an affordance type.

 For a given type of affordance, this function creates
 a group node of the same name, and adds nodes to this group.
 The nodes correspond to the triangles (and their global position)
 of all affordance objects of the given affordance type. The naming
 convention is as follows:
 "AffordanceType-ReferenceObstacleName.indexInAffObjectVector.triangleIndex"
 where indexInAffObjectVector is the index of one affordance object in the
 vector corresponding to the given affordance type (within a container in
 problem solver). triangleIndex is the index of one triangle within the
 current affordance object.
 Before creating the group node, any node with the same name is deleted.


 \\param affType the type of affordance to be visualised
 \\Viewer viewer object to load affordance objects to visualiser
 \\groupName name of group in the viewer that the objects will be added to
 \\colour vector of length 4 (normalized rgba)  defined in the interval [0, 1]

Member Data Documentation

◆ client

affordance.affordance.AffordanceTool.client

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