Namespaces | Classes | Typedefs | Functions
urdf2inventor Namespace Reference

Namespaces

namespace  helpers

Classes

class  ConversionParameters
class  ConversionResult
 Encapsulates all result fields for a conversion. More...
class  FileIO
 Reads and writes URDF and GraspIt! files to disk. More...
class  MeshConvertRecursionParams
 Includes parameters to be passed on in recursion when generating meshes. More...
class  Urdf2Inventor
 This class provides functions to transform a robot described in URDF to the inventor format. More...

Typedefs

typedef Eigen::Transform
< double, 3, Eigen::Affine > 
EigenTransform

Functions

void addBox (SoSeparator *addToNode, const EigenTransform &trans, float width, float height, float depth, float r, float g, float b, float a=0)
void addCylinder (SoSeparator *addToNode, const Eigen::Vector3d &pos, const Eigen::Quaterniond &rot, float radius, float height, float r, float g, float b, float a=0, const char *name=NULL)
void addCylinder (SoSeparator *addToNode, const urdf2inventor::EigenTransform &trans, float radius, float height, float r, float g, float b, float a=0, const char *name=NULL)
void addLocalAxes (SoSeparator *addToNode, float axesRadius, float axesLength)
void addSphere (SoSeparator *addToNode, const Eigen::Vector3d &pos, float radius, float r, float g, float b, float a=0)
bool addSubNode (SoNode *addAsChild, SoNode *parent, const urdf2inventor::EigenTransform &eTrans, const char *name=NULL)
bool addSubNode (SoNode *addAsChild, SoNode *parent, SoTransform *trans, const char *transName=NULL)
void addSubNode (SoNode *addAsChild, SoSeparator *parent, const EigenTransform &transform, SoMaterial *mat, const char *name=NULL)
template<class MeshFormat >
bool convertMeshes (urdf_traverser::UrdfTraverser &traverser, const std::string &fromLink, const typename urdf2inventor::MeshConvertRecursionParams< MeshFormat >::Ptr &meshParams)
bool fixTextureReferences (const std::string &relModelDir, const std::string &relTexDir, const std::map< std::string, std::set< std::string > > &textureFiles, std::map< std::string, std::string > &models, std::map< std::string, std::set< std::string > > &texturesToCopy)
SoNode * getAllGeometry (const urdf_traverser::LinkPtr link, double scale_factor, const urdf_traverser::EigenTransform &addTransform, const bool useVisuals, const bool scaleUrdfTransforms)
std::set< std::string > getAllTexturePaths (SoNode *root)
void getBoundingBox (SoNode *node, Eigen::Vector3d &minPoint, Eigen::Vector3d &maxPoint)
EigenTransform getEigenTransform (const SbMatrix &m)
SbMatrix getSbMatrix (const urdf2inventor::EigenTransform &m)
std::string printMatrix (const urdf2inventor::EigenTransform &t)
void removeTextureCopies (SoNode *root)
bool writeInventorFileString (SoNode *node, std::string &result)

Detailed Description

<ORGANIZATION> = Jennifer Buehler <COPYRIGHT holder>=""> = Jennifer Buehler

Copyright (c) 2016 Jennifer Buehler All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT holder>=""> BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------

<ORGANIZATION> = Jennifer Buehler <COPYRIGHT holder>=""> = Jennifer Buehler

Copyright (c) 2016 Jennifer Buehler All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT holder>=""> BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------ Helper functions for i/o operations.

Author:
Jennifer Buehler
Date:
last edited October 2015

Typedef Documentation

typedef Eigen::Transform<double, 3, Eigen::Affine> urdf2inventor::EigenTransform

Definition at line 45 of file IVHelpers.h.


Function Documentation

void urdf2inventor::addBox ( SoSeparator *  addToNode,
const EigenTransform trans,
float  width,
float  height,
float  depth,
float  r,
float  g,
float  b,
float  a = 0 
)

Definition at line 270 of file IVHelpers.cpp.

void urdf2inventor::addCylinder ( SoSeparator *  addToNode,
const Eigen::Vector3d &  pos,
const Eigen::Quaterniond &  rot,
float  radius,
float  height,
float  r,
float  g,
float  b,
float  a = 0,
const char *  name = NULL 
)

Add a cylinder oriented around z axis, pointed along +z, originating at pos. The rotation rot is going to be post-multiplied on the pos translation. This function is deprecated, use other addCylinder (with EigenTransform parameter) instead.

Parameters:
namename to give the child node of addToNode which is inserted (containing the cylinder)

Definition at line 341 of file IVHelpers.cpp.

void urdf2inventor::addCylinder ( SoSeparator *  addToNode,
const urdf2inventor::EigenTransform trans,
float  radius,
float  height,
float  r,
float  g,
float  b,
float  a = 0,
const char *  name = NULL 
)

Add a cylinder oriented around z axis, pointed along +z to addToNode, and transform the cylinder given trans from addToNode.

Parameters:
namename to give the child node of addToNode which is inserted (containing the cylinder)

Definition at line 301 of file IVHelpers.cpp.

void urdf2inventor::addLocalAxes ( SoSeparator *  addToNode,
float  axesRadius,
float  axesLength 
)

Definition at line 354 of file IVHelpers.cpp.

void urdf2inventor::addSphere ( SoSeparator *  addToNode,
const Eigen::Vector3d &  pos,
float  radius,
float  r,
float  g,
float  b,
float  a = 0 
)

Definition at line 286 of file IVHelpers.cpp.

bool urdf2inventor::addSubNode ( SoNode *  addAsChild,
SoNode *  parent,
const urdf2inventor::EigenTransform eTrans,
const char *  name = NULL 
)

Adds the node addAsChild as a child to parent, transformed by the given transform eTrans, which requires the insertion of an in-between transform node. The name of this in-between transform node can be tiven in name.

Returns:
false if either addAsChild or parent are SoSepartor nodes and can have children.

Definition at line 208 of file IVHelpers.cpp.

bool urdf2inventor::addSubNode ( SoNode *  addAsChild,
SoNode *  parent,
SoTransform *  trans,
const char *  transName = NULL 
)

Adds the node addAsChild as a child to parent but inserts a transform node in-between, defined by trans.

Parameters:
transNameoptional: name to give the transform node inserted in-between.
Returns:
false if either addAsChild or parent are SoSepartor nodes and can have children.

Definition at line 216 of file IVHelpers.cpp.

void urdf2inventor::addSubNode ( SoNode *  addAsChild,
SoSeparator *  parent,
const EigenTransform transform,
SoMaterial *  mat,
const char *  name = NULL 
)

Adds the node addAsChild as a child to parent, transformed by the given transform. A transform node will have to be inserted in-between parent and addAsChild. The name can be used to give the actual child added to parent a specific name.

Definition at line 247 of file IVHelpers.cpp.

template<class MeshFormat >
bool urdf2inventor::convertMeshes ( urdf_traverser::UrdfTraverser traverser,
const std::string &  fromLink,
const typename urdf2inventor::MeshConvertRecursionParams< MeshFormat >::Ptr &  meshParams 
)

Convert all meshes starting from fromLinkName into the inventor format, and store them in the given mesh files container. While converting, the mesh files can be scaled by the scale factor set in the constructor.

Note that this template function is only instantiated for MeshFormat=std::string at this point, which means returned meshes can be represented in a string (eg. XML format).

Parameters:
scaleFactora factor to scale the mesh by while converting
materialthe material to use in the converted format
file_extensionwhen the meshes are written to file, this is the extension they will have. This information may be required for generating the result meshes.
addVisualTransformthis transform will be post-multiplied on all links' **visuals** (not links!) local transform (their "origin"). This can be used to correct transformation errors which may have been introduced in converting meshes from one format to the other, losing orientation information (for example, .dae has an "up vector" definition which may have been ignored)
meshesthe resulting meshes (inventor files), indexed by the link names
textureFilesif the resultMeshes have textures, this is a list of textures (absolute file paths) referenced from the meshes. Key is the same as in resultMeshes. Convert all meshes starting from fromLinkName into the inventor format, and store them in the given mesh files container. Results will be in meshParams.

Note that this template function is only instantiated for MeshFormat=std::string at this point, which means returned meshes can be represented in a string (eg. XML format).

Definition at line 532 of file ConvertMesh.cpp.

bool urdf2inventor::fixTextureReferences ( const std::string &  relModelDir,
const std::string &  relTexDir,
const std::map< std::string, std::set< std::string > > &  textureFiles,
std::map< std::string, std::string > &  models,
std::map< std::string, std::set< std::string > > &  texturesToCopy 
)

Changes the texture references (absolute paths) in the model string descriptions so they reference the file in the output directory with a *relative* path. This is achieved by calling urdf2inventor::helpers::fixFileReferences() for each entry of textureFiles and models respectively. For documentation of parameters, please refer to this method.

The common parent directory will be determined to be the one which is parent to *all* textures used for *all* models.

Texture output directory is the relative directory relTexDir, e.g. "tex/", which is created as ``<install-prefix>/<relTexDir>``. The model output directory relModelDir is also relative, e.g. "iv/", which is then installed to ``<install-prefix>/<relModelDir>``. Each model can be stored in its own subdirectory, ``<install-prefix>/<relModelDir>/<model-path-i>``. This subdirectory ``<model-path-i> is detemined by its *key* name in the map models.

Implementation background: All textures have a common parent directory ``<common-tex>`` (worst case it's the root). So all texture paths i are of the form ``<common-tex>/<tex-path-i>``. All textures are installed in ``<install-prefix>/<relTexDir>/<tex-path-i>``. The relative distance between ``<model-path-i>`` and ``<tex-path-i>`` is used to reference textures from within the model files, e.g. "../tex/texture.png".

Parameters:
textureFilesthe texture files, as returned by convertMehes().
modelsthe models incl. meshes (inventor files) to fix, as returned by convertMeshes(). This method only works for the string model format (eg. XML representation of model).
texturesToCopyThe texture file names to copy to target directories. See also urdf2inventor::helpers::fixFileReferences().
texturesToCopyas output filesToCopy in urdf2inventor::helpers::fixFileReferences().
Returns:
false if no common parent directory could be determined for all of the texture files

Definition at line 565 of file ConvertMesh.cpp.

SoNode * urdf2inventor::getAllGeometry ( const urdf_traverser::LinkPtr  link,
double  scale_factor,
const urdf_traverser::EigenTransform addTransform,
const bool  useVisuals,
const bool  scaleUrdfTransforms 
)

Get the mesh from link, scale it up by scale_factor, and pack it into an SoNode which is also respects the scale_factor in its translations

Parameters:
scaleUrdfTransformsset to true if the transforms coming from this urdf model should be scaled up as well. If this is false, only the meshes are scaled.
addTransformthis transform will be post-multiplied on all links' **visuals** (not links!) local transform (their "origin"). This can be used to correct transformation errors which may have been introduced in converting meshes from one format to the other, losing orientation information (for example, .dae has an "up vector" definition which may have been ignored)
useVisualstrue to use the visuals as base for the geometry, false if the collision geometry should be used instead.

Definition at line 342 of file ConvertMesh.cpp.

std::set< std::string > urdf2inventor::getAllTexturePaths ( SoNode *  root)

Searches through all nodes and returns a set of absolute paths to textures which are in use.

Definition at line 103 of file IVHelpers.cpp.

void urdf2inventor::getBoundingBox ( SoNode *  node,
Eigen::Vector3d &  minPoint,
Eigen::Vector3d &  maxPoint 
)

Returns axis-aligned bounding box min and max points of the node

Definition at line 53 of file IVHelpers.cpp.

Definition at line 139 of file IVHelpers.cpp.

Definition at line 165 of file IVHelpers.cpp.

Definition at line 129 of file IVHelpers.cpp.

void urdf2inventor::removeTextureCopies ( SoNode *  root)

Removes all texture copies in the nodes.

Code from https://grey.colorado.edu/coin3d/classSoTexture2.html

Definition at line 126 of file ConvertMesh.cpp.

bool urdf2inventor::writeInventorFileString ( SoNode *  node,
std::string &  result 
)

writes the contents of SoNode into the inventor (*.iv) format and returns the file content as a string.

Definition at line 71 of file IVHelpers.cpp.



urdf2inventor
Author(s): Jennifer Buehler
autogenerated on Fri Mar 1 2019 03:38:11