Public Member Functions | Private Member Functions | Private Attributes
world_canvas_client.annotation_collection.AnnotationCollection Class Reference

List of all members.

Public Member Functions

def __init__
def add
def filter_by
def get_annotations
def get_data
def get_data_of_type
def get_world_list
def is_saved
def load_data
def publish
def publish_markers
def remove
def save
def update

Private Member Functions

def _get_service_handle

Private Attributes

 _annotations
 _annots_data
 _annots_to_delete
 _saved
 _srv_namespace

Detailed Description

A collection of annotations and its associated data, initially empty. Annotations
and data are retrieved from the world canvas server, filtered by a set of selection
criteria (see constructor parameters).
The collection can be reloaded with different filter criteria. There're also methods
to add and delete individual annotations (an "update" method is TODO). But changes are
only saved to database by calling "save" method. 
This class can also publish the retrieved annotations and RViz visualization markers,
mostly for debug purposes.

Definition at line 51 of file annotation_collection.py.


Constructor & Destructor Documentation

def world_canvas_client.annotation_collection.AnnotationCollection.__init__ (   self,
  world = None,
  uuids = [],
  names = [],
  types = [],
  keywords = [],
  relationships = [],
  srv_namespace = '' 
)
Creates a collection of annotations and its associated data, initially empty.
Annotations and data are retrieved from the world canvas server, filtered by
the described parameters.

@param world:         Annotations in this collection belong to this world.
@param uuids:         Filter annotations by their uuid.
@param names:         Filter annotations by their name.
@param types:         Filter annotations by their type.
@param keywords:      Filter annotations by their keywords.
@param relationships: Filter annotations by their relationships.
@param srv_namespace: World canvas handles can be found under this namespace.
@raise WCFError:      If something went wrong.

Definition at line 63 of file annotation_collection.py.


Member Function Documentation

def world_canvas_client.annotation_collection.AnnotationCollection._get_service_handle (   self,
  service_name,
  service_type,
  timeout = 5.0 
) [private]
Create a service client and wait until the service is available.

@param service_name: ROS service name to get, without namespace.
@param service_type: ROS service type.
@param timeout: Timeout to wait for the service to come up.

@returns: Service handle.
@rtypes: rospy.ServiceProxy.

@raise  WCFError: If specified timeout is exceeded or shutdown interrupts wait.

Definition at line 564 of file annotation_collection.py.

def world_canvas_client.annotation_collection.AnnotationCollection.add (   self,
  annotation,
  msg = None,
  gen_uuid = True 
)
Add a new annotation with a new associated data or for an existing data.

@param annotation: The new annotation.
@param msg:        Its associated data. If None, we assume that we are adding an annotation to existing data.
@param gen_uuid:   Generate an unique id for the new annotation or use the received one.
@raise WCFError:   If something went wrong.

Definition at line 375 of file annotation_collection.py.

def world_canvas_client.annotation_collection.AnnotationCollection.filter_by (   self,
  world,
  uuids = [],
  names = [],
  types = [],
  keywords = [],
  relationships = [] 
)
Reload annotations collection, filtered by new selection criteria.

@param world:         Annotations in this collection belong to this world.
@param uuids:         Filter annotations by their uuid.
@param names:         Filter annotations by their name.
@param types:         Filter annotations by their type.
@param keywords:      Filter annotations by their keywords.
@param relationships: Filter annotations by their relationships.
@raise WCFError:      If something went wrong.

Definition at line 91 of file annotation_collection.py.

def world_canvas_client.annotation_collection.AnnotationCollection.get_annotations (   self,
  name = None,
  type = None 
)
Return the currently loaded annotations, optionally restricted to the given name and/or type.

@param name: Get only annotation(s) with the given name. Can be more than one, as we don't
enforce uniqueness on annotation names.
@param type: Get only annotation(s) with the given type.
@returns Currently loaded annotations matching name and type, or empty string if none.

Definition at line 127 of file annotation_collection.py.

Get the associated data (ROS message) of a given annotation.

@returns The ROS message associated to the given annotation or None if it was not found.
@raise WCFError: If something else went wrong.

Definition at line 183 of file annotation_collection.py.

Get all associated data (ROS messages) of a given type.

@returns The list of ROS messages of the given type.

Definition at line 210 of file annotation_collection.py.

TODO: temporally here until we create a WorldCollection class, as on C++ library.

@returns Currently available world list in the world canvas server

Definition at line 553 of file annotation_collection.py.

Definition at line 550 of file annotation_collection.py.

Load associated data for the current annotations collection.

@returns Number of annotations retrieved.
@raise WCFError: If something went wrong.

Definition at line 153 of file annotation_collection.py.

def world_canvas_client.annotation_collection.AnnotationCollection.publish (   self,
  topic_name,
  topic_type = None,
  by_server = False,
  as_list = False,
  list_attribute = None 
)
Publish the current collection of annotations, by this client or by the server.
As we use just one topic, all annotations must be of the same type (function will return
with error otherwise).

@param topic_name: Where we must publish annotations data.
@param topic_type: The message type to publish annotations data.
           Mandatory if as_list is true; ignored otherwise.
@param by_server:  Request the server to publish the annotations instead of this client.
@param as_list:    If true, annotations will be packed in a list before publishing,
           so topic_type must be an array of currently loaded annotations.
@raise WCFError:   If something went wrong.

Definition at line 281 of file annotation_collection.py.

Publish RViz visualization markers for the current collection of annotations.

@param topic: Where we must publish annotations markers.

Definition at line 234 of file annotation_collection.py.

Delete an annotation with its associated data.
WARN/TODO: we are ignoring the case of N annotations - 1 data!

@param uuid: The uuid of the annotation to delete.
@returns True if successfully removed, False if the annotation was not found.
@raise WCFError: If something else went wrong.

Definition at line 458 of file annotation_collection.py.

Save to database current annotations list with their associated data. Also remove from database
the annotations doomed by delete method, if any.
WARN/TODO: we are ignoring the case of N annotations - 1 data!

@raise WCFError: If something went wrong.

Definition at line 499 of file annotation_collection.py.

def world_canvas_client.annotation_collection.AnnotationCollection.update (   self,
  annotation,
  msg = None 
)
Update an existing annotation and optionally its associated data.

@param annotation: The modified annotation.
@param msg:        Its associated data. If None, just the annotation is updated.
@raise WCFError:   If something went wrong.

Definition at line 419 of file annotation_collection.py.


Member Data Documentation

Definition at line 76 of file annotation_collection.py.

Definition at line 76 of file annotation_collection.py.

Definition at line 76 of file annotation_collection.py.

Definition at line 76 of file annotation_collection.py.

Definition at line 76 of file annotation_collection.py.


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


world_canvas_client_py
Author(s): Jorge Santos
autogenerated on Thu Jun 6 2019 18:32:44