sdurw_loaders module
- class sdurw_loaders.sdurw_loaders.CollisionSetupLoader(*args, **kwargs)
Bases:
object
Loader of collision setups from files.
[CollisionSetupLoader could just as well simply be a utility function.]
- The XML format is:
- <CollisionSetup>
- <Exclude>
<FramePair first=”first_frame” second=”second_frame”/> …
</Exclude> <Volatile>frame1 frame2 .. </Volatile>
</CollisionSetup>
- __init__(*args, **kwargs)
- static load(prefix, file)
Load a collision setup from the file file.
prefix is prepended to every frame name.
- Parameters
prefix (string) – [in] The context in which the setup is loaded.
file (string) – [in] The file from which to load the collision setup.
- Return type
CollisionSetup
- Returns
The collision setup.
- property thisown
The membership flag
- sdurw_loaders.sdurw_loaders.CollisionSetupLoader_load(prefix, file)
Load a collision setup from the file file.
prefix is prepended to every frame name.
- Parameters
prefix (string) – [in] The context in which the setup is loaded.
file (string) – [in] The file from which to load the collision setup.
- Return type
CollisionSetup
- Returns
The collision setup.
- class sdurw_loaders.sdurw_loaders.ExtensionPointGeometryData(id, name, plugin=None)
Bases:
object
an extension point is a class that defines a point where Extension can be added. This is typically used together with plugins, however any class may register extensions to an extension point.
- __init__(id, name, plugin=None)
Constructor :type id: string :param id: [in] unique identifier of this extension point :type name: string :param name: [in] human readable name of this extension point :type plugin:
Plugin
, optional :param plugin: [in] the plugin from which this extension point is defined, NULL if notdefined from plugin
- getExtensionDescriptors()
get all extension descriptions of this extension point
- getExtensions()
get all extensions of this extension point
- getId()
get unique identifier of this extensionpoint
- getName()
get human readable name of this extension point
- getSchema()
the schema describe the possible properties/configurations elements which is used in the PropertyMap. It contain examples of all possible configuration options. This can be used to configure any extensions that needs to attach to this extension point.
- property thisown
The membership flag
- class sdurw_loaders.sdurw_loaders.ExtensionPointGeometryFactory(id, name, plugin=None)
Bases:
object
an extension point is a class that defines a point where Extension can be added. This is typically used together with plugins, however any class may register extensions to an extension point.
- __init__(id, name, plugin=None)
Constructor :type id: string :param id: [in] unique identifier of this extension point :type name: string :param name: [in] human readable name of this extension point :type plugin:
Plugin
, optional :param plugin: [in] the plugin from which this extension point is defined, NULL if notdefined from plugin
- getExtensionDescriptors()
get all extension descriptions of this extension point
- getExtensions()
get all extensions of this extension point
- getId()
get unique identifier of this extensionpoint
- getName()
get human readable name of this extension point
- getSchema()
the schema describe the possible properties/configurations elements which is used in the PropertyMap. It contain examples of all possible configuration options. This can be used to configure any extensions that needs to attach to this extension point.
- property thisown
The membership flag
- class sdurw_loaders.sdurw_loaders.ExtensionPointImageLoader(id, name, plugin=None)
Bases:
object
an extension point is a class that defines a point where Extension can be added. This is typically used together with plugins, however any class may register extensions to an extension point.
- __init__(id, name, plugin=None)
Constructor :type id: string :param id: [in] unique identifier of this extension point :type name: string :param name: [in] human readable name of this extension point :type plugin:
Plugin
, optional :param plugin: [in] the plugin from which this extension point is defined, NULL if notdefined from plugin
- getExtensionDescriptors()
get all extension descriptions of this extension point
- getExtensions()
get all extensions of this extension point
- getId()
get unique identifier of this extensionpoint
- getName()
get human readable name of this extension point
- getSchema()
the schema describe the possible properties/configurations elements which is used in the PropertyMap. It contain examples of all possible configuration options. This can be used to configure any extensions that needs to attach to this extension point.
- property thisown
The membership flag
- class sdurw_loaders.sdurw_loaders.ExtensionPointModel3DLoader(id, name, plugin=None)
Bases:
object
an extension point is a class that defines a point where Extension can be added. This is typically used together with plugins, however any class may register extensions to an extension point.
- __init__(id, name, plugin=None)
Constructor :type id: string :param id: [in] unique identifier of this extension point :type name: string :param name: [in] human readable name of this extension point :type plugin:
Plugin
, optional :param plugin: [in] the plugin from which this extension point is defined, NULL if notdefined from plugin
- getExtensionDescriptors()
get all extension descriptions of this extension point
- getExtensions()
get all extensions of this extension point
- getId()
get unique identifier of this extensionpoint
- getName()
get human readable name of this extension point
- getSchema()
the schema describe the possible properties/configurations elements which is used in the PropertyMap. It contain examples of all possible configuration options. This can be used to configure any extensions that needs to attach to this extension point.
- property thisown
The membership flag
- class sdurw_loaders.sdurw_loaders.ExtensionPointWorkCellLoader(id, name, plugin=None)
Bases:
object
an extension point is a class that defines a point where Extension can be added. This is typically used together with plugins, however any class may register extensions to an extension point.
- __init__(id, name, plugin=None)
Constructor :type id: string :param id: [in] unique identifier of this extension point :type name: string :param name: [in] human readable name of this extension point :type plugin:
Plugin
, optional :param plugin: [in] the plugin from which this extension point is defined, NULL if notdefined from plugin
- getExtensionDescriptors()
get all extension descriptions of this extension point
- getExtensions()
get all extensions of this extension point
- getId()
get unique identifier of this extensionpoint
- getName()
get human readable name of this extension point
- getSchema()
the schema describe the possible properties/configurations elements which is used in the PropertyMap. It contain examples of all possible configuration options. This can be used to configure any extensions that needs to attach to this extension point.
- property thisown
The membership flag
- class sdurw_loaders.sdurw_loaders.GeometryFactory
Bases:
ExtensionPointGeometryData
Factory for geometric primitive
The following primitives are supported
Box: Syntax: “#Box dx dy dz” where “dx, dy, dz” are floats specifying the dimensions
Cylinder: Syntax: “#Cylinder radius height level” where “radius” and “height” are float specifying radius and height and “level” is a non-negative integer specifying the discretization level.
Sphere: Syntax: “#Sphere radi level” where radi is the radius of the sphere
Tube: Syntax: “#Tube radius height level where “radius” and “height” are float specifying radius and height and “level” is a non-negative integer specifying the discretization level.
Cone: Syntax: “#Cone radius height level where “height” is a float specifying cone height, and “radius” is a float specyfying cone radius at at the bottom.
Pyramid: Syntax: “#Pyramid dx dy height” where “dx”, “dy” are floats specifying the base dimensions, and “height” is a float specyfying the pyramid height.
Custom: Syntax: “#Custom type parameters where “type” is a custom geometry type provided by extensions, “parameters” is a space separated string with custom geometry parameters.
- __init__()
Constructor.
- static clearGeometryCache()
Clear the geometry cache.
- static getGeometry(str, useCache=True)
- static load(str, useCache=True)
Factory method for geometric primitive
The Factory takes no ownership of the Geometry objects it constructs and thus returns the geometry by smart pointer.
An exception is thrown if the string cannot be parsed correctly.
- Parameters
str (string) – [in] string to parse
useCache (boolean, optional) – [in] set true to return cached geometry if available
- Return type
Ptr
- Returns
Pointer to a new geometry object
- property thisown
The membership flag
- sdurw_loaders.sdurw_loaders.GeometryFactory_clearGeometryCache()
Clear the geometry cache.
- sdurw_loaders.sdurw_loaders.GeometryFactory_getGeometry(str, useCache=True)
- sdurw_loaders.sdurw_loaders.GeometryFactory_load(str, useCache=True)
Factory method for geometric primitive
The Factory takes no ownership of the Geometry objects it constructs and thus returns the geometry by smart pointer.
An exception is thrown if the string cannot be parsed correctly.
- Parameters
str (string) – [in] string to parse
useCache (boolean, optional) – [in] set true to return cached geometry if available
- Return type
Ptr
- Returns
Pointer to a new geometry object
- class sdurw_loaders.sdurw_loaders.ImageLoader(*args, **kwargs)
Bases:
object
Image loader interface
- __init__(*args, **kwargs)
- getImageFormats()
get the list of supported image formats (as extensions) example (PNG,PGM,GIF) :rtype: std::vector< std::string > :return:
- isImageSupported(format)
- Parameters
format (string) –
- Return type
boolean
- Returns
- loadImage(filename)
- Parameters
filename (string) – [in] name of the file that is to be loaded.
- Return type
Ptr
- Returns
if loaded successfully a pointer to the image is returned else NULL
- property thisown
The membership flag
- class sdurw_loaders.sdurw_loaders.ImageLoaderFactory
Bases:
ExtensionPointImageLoader
a factory for ImageLoader. This factory also defines an extension point for image loaders.
- __init__()
constructor
- static getImageLoader(format)
get an image loader for a specific file format :type format: string :param format: [in] image format eg. png, jpeg, … :rtype: rw::core::Ptr< rw::loaders::ImageLoader > :return:
- static getSupportedFormats()
get a list of supported formats :rtype: std::vector< std::string > :return:
- static hasImageLoader(format)
test if a imageloader for a specific fileformat exists. :type format: string :param format: [in] image format eg. png, jpeg … :rtype: boolean :return:
- static load(filename)
Loads/imports an image from a file.
An exception is thrown if the file can’t be loaded.
- Parameters
filename (string) – [in] name of image file.
- property thisown
The membership flag
- sdurw_loaders.sdurw_loaders.ImageLoaderFactory_getImageLoader(format)
get an image loader for a specific file format :type format: string :param format: [in] image format eg. png, jpeg, … :rtype: rw::core::Ptr< rw::loaders::ImageLoader > :return:
- sdurw_loaders.sdurw_loaders.ImageLoaderFactory_getSupportedFormats()
get a list of supported formats :rtype: std::vector< std::string > :return:
- sdurw_loaders.sdurw_loaders.ImageLoaderFactory_hasImageLoader(format)
test if a imageloader for a specific fileformat exists. :type format: string :param format: [in] image format eg. png, jpeg … :rtype: boolean :return:
- sdurw_loaders.sdurw_loaders.ImageLoaderFactory_load(filename)
Loads/imports an image from a file.
An exception is thrown if the file can’t be loaded.
- Parameters
filename (string) – [in] name of image file.
- class sdurw_loaders.sdurw_loaders.ImageLoaderPtr(*args)
Bases:
object
Ptr stores a pointer and optionally takes ownership of the value.
- __init__(*args)
Overload 1:
Default constructor yielding a NULL-pointer.
Overload 2:
Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
- deref()
The pointer stored in the object.
- getDeref()
Member access operator.
- getImageFormats()
get the list of supported image formats (as extensions) example (PNG,PGM,GIF) :rtype: std::vector< std::string > :return:
- isImageSupported(format)
- Parameters
format (string) –
- Return type
boolean
- Returns
- isNull()
checks if the pointer is null :rtype: boolean :return: Returns true if the pointer is null
check if this Ptr has shared ownership or none ownership :rtype: boolean :return: true if Ptr has shared ownership, false if it has no ownership.
- loadImage(filename)
- Parameters
filename (string) – [in] name of the file that is to be loaded.
- Return type
Ptr
- Returns
if loaded successfully a pointer to the image is returned else NULL
- property thisown
The membership flag
- class sdurw_loaders.sdurw_loaders.Model3DLoader(*args, **kwargs)
Bases:
object
interface for classes that are able to load 3d models
- __init__(*args, **kwargs)
- getModelFormats()
get the list of supported 3D model formats (as extensions) :rtype: std::vector< std::string > :return:
- isSupported(format)
Check if the loader support a specific format :type format: string :param format: [in] the extension to check if is supported :rtype: boolean :return: true if format is supported
- load(filename)
load a Model3D from file filename :type filename: string :param filename: [in] name of file to load :rtype:
Ptr
:return: a model3d if loaded successfully else NULL (or exception)
- setDefaultMaterial(mat)
set which material to use if the File dosen’t include a material/ texturing it self :type mat:
Material
:param mat:
- setDefaultName(name)
set a name that the loader can use, if it can’t find anyother :type name: string :param name:
- property thisown
The membership flag
- class sdurw_loaders.sdurw_loaders.Model3DLoaderFactory
Bases:
ExtensionPointModel3DLoader
a factory for Model3DLoaders. This factory defines an extension point for Model3DLoaders.
- __init__()
constructor
- static getModel3DLoader(format, skip=0)
get loader for a specific file format (extension) :type format: string :param format: [in] extension of file :type skip: int, optional :param skip: [in] skip the first few valid loaders :rtype: rw::core::Ptr< rw::loaders::Model3DLoader > :return:
- static getSupportedFormats()
get a list of supported formats :rtype: std::vector< std::string > :return:
- static hasModel3DLoader(format)
test if a loader exist for a specific file format (extension) :type format: string :param format: [in] extension of file :rtype: boolean :return:
- property thisown
The membership flag
- sdurw_loaders.sdurw_loaders.Model3DLoaderFactory_getModel3DLoader(format, skip=0)
get loader for a specific file format (extension) :type format: string :param format: [in] extension of file :type skip: int, optional :param skip: [in] skip the first few valid loaders :rtype: rw::core::Ptr< rw::loaders::Model3DLoader > :return:
- sdurw_loaders.sdurw_loaders.Model3DLoaderFactory_getSupportedFormats()
get a list of supported formats :rtype: std::vector< std::string > :return:
- sdurw_loaders.sdurw_loaders.Model3DLoaderFactory_hasModel3DLoader(format)
test if a loader exist for a specific file format (extension) :type format: string :param format: [in] extension of file :rtype: boolean :return:
- class sdurw_loaders.sdurw_loaders.PathLoader
Bases:
object
Load and store for various types of paths.
Probably, what we want to store probably is not paths, but trajectories. Perhaps each type of trajectory may have its own storage format. We will see. So far storeVelocityTimedStatePath() and loadTimedStatePath() are useful utilities to have as is.
- __init__()
- static loadPath(file)
Loads a Path of robot configuration
Load and return a path from a file. Throws an exception if an error occurs
- Parameters
file (string) – [in] file name
- Return type
rw::trajectory::QPath
- Returns
the path
- static loadStatePath(workcell, file)
Load a sequence of states for workcell from the file named
file.
An exception is thrown if the file can’t be read or is of the wrong format with respect to the work cell.
See also storeStatePath().
- static loadTimedStatePath(*args)
Overload 1:
Load a sequence of states for workcell from the file named
file.
An exception is thrown if the file can’t be read or is of the wrong format with respect to the work cell.
See also storeTimedStatePath().
Overload 2:
- static storePath(path, file)
store a QPath to file :type path: rw::trajectory::QPath :param path: :type file: string :param file:
- static storeStatePath(workcell, path, file)
Store the sequence path of workcell to the file named file.
See also loadStatePath().
- static storeTimedStatePath(workcell, path, file)
Store the sequence path of workcell to the file named file.
See also loadTimedStatePath().
- static storeVelocityTimedStatePath(workcell, path, file)
Time stamp the sequence path of workcell and store it to the file named file.
The states are given time stamps according to the maximum joint speed velocities of workcell.
The time stamped sequence can be loaded again with loadTimedStatePath().
- property thisown
The membership flag
- class sdurw_loaders.sdurw_loaders.PathLoaderCSV
Bases:
object
Loader for .csv files.
This loader differs from the standard PathLoader, in that it only considers devices in the workcell.
- The .csv format is implemented as follows. First 2 lines is setup:
3; <- first line is the path length. The loader exist after loading 3 lines of
configurations. 6; <- second line is degrees of freedom (DOF) for all devices in the workcell. (Has to match total DOF in workcell).
- Then follows the path itself, one configuration-vector at the time:
-1.5,0.0,-1.5,0.0,-1.5,0.0;
-1.0,-1.5,0.0,-1.5,0.0,-1.5; -0.8,0.0,-1.5,0.0,-1.5,0.0;
If loadTimedStatePath is used, a timestamp (in seconds) is added in the beginning of each line.
If a workcell contains more than 1 device, the first device reads the first n values, second device reads next n values etc.
An example of a file with a path length of 3, DOF of six and a timestamp is given below:
3;
6; 0.0,-1.5,0.0,-1.5,0.0,-1.5,0.0; 1.0,-1.0,-1.5,0.0,-1.5,0.0,-1.5; 1.5,-0.8,0.0,-1.5,0.0,-1.5,0.0;
- __init__()
- static loadPath(file)
Loads a Path of robot configuration
Load and return a path from a file. Throws an exception if an error occurs
- Parameters
file (string) – [in] file name
- Return type
rw::trajectory::QPath
- Returns
the path
- static loadStatePath(workcell, file)
Load a sequence of states for workcell from the file named file.
An exception is thrown if the file can’t be read or is of the wrong format with respect to the work cell.
- static loadTimedStatePath(workcell, file)
Load a sequence of states for workcell from the file named file. This loader includes timestamps in the path.
An exception is thrown if the file can’t be read or is of the wrong format with respect to the work cell.
- property thisown
The membership flag
- sdurw_loaders.sdurw_loaders.PathLoaderCSV_loadPath(file)
Loads a Path of robot configuration
Load and return a path from a file. Throws an exception if an error occurs
- Parameters
file (string) – [in] file name
- Return type
rw::trajectory::QPath
- Returns
the path
- sdurw_loaders.sdurw_loaders.PathLoaderCSV_loadStatePath(workcell, file)
Load a sequence of states for workcell from the file named file.
An exception is thrown if the file can’t be read or is of the wrong format with respect to the work cell.
- sdurw_loaders.sdurw_loaders.PathLoaderCSV_loadTimedStatePath(workcell, file)
Load a sequence of states for workcell from the file named file. This loader includes timestamps in the path.
An exception is thrown if the file can’t be read or is of the wrong format with respect to the work cell.
- sdurw_loaders.sdurw_loaders.PathLoader_loadPath(file)
Loads a Path of robot configuration
Load and return a path from a file. Throws an exception if an error occurs
- Parameters
file (string) – [in] file name
- Return type
rw::trajectory::QPath
- Returns
the path
- sdurw_loaders.sdurw_loaders.PathLoader_loadStatePath(workcell, file)
Load a sequence of states for workcell from the file named
file.
An exception is thrown if the file can’t be read or is of the wrong format with respect to the work cell.
See also storeStatePath().
- sdurw_loaders.sdurw_loaders.PathLoader_loadTimedStatePath(*args)
Overload 1:
Load a sequence of states for workcell from the file named
file.
An exception is thrown if the file can’t be read or is of the wrong format with respect to the work cell.
See also storeTimedStatePath().
Overload 2:
- sdurw_loaders.sdurw_loaders.PathLoader_storePath(path, file)
store a QPath to file :type path: rw::trajectory::QPath :param path: :type file: string :param file:
- sdurw_loaders.sdurw_loaders.PathLoader_storeStatePath(workcell, path, file)
Store the sequence path of workcell to the file named file.
See also loadStatePath().
- sdurw_loaders.sdurw_loaders.PathLoader_storeTimedStatePath(workcell, path, file)
Store the sequence path of workcell to the file named file.
See also loadTimedStatePath().
- sdurw_loaders.sdurw_loaders.PathLoader_storeVelocityTimedStatePath(workcell, path, file)
Time stamp the sequence path of workcell and store it to the file named file.
The states are given time stamps according to the maximum joint speed velocities of workcell.
The time stamped sequence can be loaded again with loadTimedStatePath().
- class sdurw_loaders.sdurw_loaders.WorkCellLoader(*args, **kwargs)
Bases:
object
Extendible interface for loading of WorkCells from files.
By default, the following formats are supported:
All file extensions will be loaded using the standard %RobWork %XML format (XMLRWLoader).
The Factory defines an extension point “rw.loaders.WorkCellLoader” that makes it possible to add loaders for other file formats than the ones above. Extensions take precedence over the default loaders.
The WorkCell loader is chosen based on a case-insensitive file extension name. So “scene.wc.xml” will be loaded by the same loader as “scene.WC.XML”
WorkCells are supposed to be loaded using the Factory::load function:
WorkCell::Ptr wc = WorkCellLoader::Factory::load("scene.wc.xml"); if (wc.isNull()) RW_TRHOW("WorkCell could not be loaded.");
Alternatively a WorkCell can be loaded in the less convenient way:
WorkCellLoader::Ptr loader = WorkCellLoader::Factory::getWorkCellLoader(".wc.xml"); WorkCell::Ptr wc = loader.loadWorkCell("scene.wc.xml"); if (wc.isNull()) RW_TRHOW("WorkCell could not be loaded.");
- __init__(*args, **kwargs)
- loadWorkCell(filename)
Load a WorkCell from a file. :type filename: string :param filename: [in] path to workcell file.
- property thisown
The membership flag
- class sdurw_loaders.sdurw_loaders.WorkCellLoaderFactory(*args, **kwargs)
Bases:
ExtensionPointWorkCellLoader
A factory for WorkCellLoader. This factory also defines the “rw.loaders.WorkCellLoader” extension point where new loaders can be registered.
- __init__(*args, **kwargs)
Constructor :type id: string :param id: [in] unique identifier of this extension point :type name: string :param name: [in] human readable name of this extension point :type plugin:
Plugin
, optional :param plugin: [in] the plugin from which this extension point is defined, NULL if notdefined from plugin
- static getWorkCellLoader(format)
Get loaders for a specific format. :type format: string :param format: [in] the extension (including initial dot).
The extension name is case-insensitive.
- Return type
rw::core::Ptr< rw::loaders::WorkCellLoader >
- Returns
a suitable loader.
- static load(filename)
Loads/imports a WorkCell from a file.
An exception is thrown if the file can’t be loaded. The %RobWork %XML format is supported by default. :type filename: string :param filename: [in] name of the WorkCell file.
- property thisown
The membership flag
- sdurw_loaders.sdurw_loaders.WorkCellLoaderFactory_getWorkCellLoader(format)
Get loaders for a specific format. :type format: string :param format: [in] the extension (including initial dot).
The extension name is case-insensitive.
- Return type
rw::core::Ptr< rw::loaders::WorkCellLoader >
- Returns
a suitable loader.
- sdurw_loaders.sdurw_loaders.WorkCellLoaderFactory_load(filename)
Loads/imports a WorkCell from a file.
An exception is thrown if the file can’t be loaded. The %RobWork %XML format is supported by default. :type filename: string :param filename: [in] name of the WorkCell file.
- class sdurw_loaders.sdurw_loaders.WorkCellLoaderPtr(*args)
Bases:
object
Ptr stores a pointer and optionally takes ownership of the value.
- __init__(*args)
Overload 1:
Default constructor yielding a NULL-pointer.
Overload 2:
Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
- deref()
The pointer stored in the object.
- getDeref()
Member access operator.
- isNull()
checks if the pointer is null :rtype: boolean :return: Returns true if the pointer is null
check if this Ptr has shared ownership or none ownership :rtype: boolean :return: true if Ptr has shared ownership, false if it has no ownership.
- loadWorkCell(filename)
Load a WorkCell from a file. :type filename: string :param filename: [in] path to workcell file.
- property thisown
The membership flag