esp::io::URDF::Model class

Generic structure representing an articulated object parsed from a URDF file independent from any physics implementation.

Constructors, destructors, conversion operators

Model() defaulted

Public functions

auto m_rootTransformInWorld(Magnum::Math::IdentityInitT) -> Magnum::Matrix4
world transform of the object root if provided
void printKinematicChain() const
auto getLink(const std::string& linkName) const -> std::shared_ptr<Link>
Get a link provided its name.
auto getLink(int linkIndex) const -> std::shared_ptr<Link>
Get a link provided its index.
auto getJoint(int linkIndex) const -> std::shared_ptr<Joint>
Get a parent joint of a link provided the link index.
void setGlobalScaling(float scaling)
Set global scaling and re-scale an existing model. Modifies various internal parameters.
auto getGlobalScaling() const -> float
Get the currently configured global model scaling.
void setMassScaling(float massScaling)
Set scaling for mass from initial values configured in URDF. Modifies various internal parameters.
auto getMassScaling() const -> float
Get the currently configured mass scaling of the model.
void setRenderAsset(Cr::Containers::Optional<std::string> renderAsset)
Set the path to the render asset to attach to this URDF model.
auto getRenderAsset() const -> Cr::Containers::Optional<std::string>
Get the path to the render asset to attach to this URDF model.
void setSemanticId(int semanticId)
Set the semantic ID of the URDF model.
auto getSemanticId() const -> int
Get the semantic ID of this URDF model.
void setDebugRenderPrimitives(bool debugRenderPrimitives)
Set hint to render articulated object primitives even if a render asset is present.
auto getDebugRenderPrimitives() const -> bool
Get hint to render articulated object primitives even if a render asset is present.
auto loadJsonAttributes(const std::string& filename) -> bool
This function conditionally loads configuration data from a Json file for this Articulated Model, should an appropriate file exist. This configuration file must meet the following criteria to be loaded :
auto getUserConfiguration() const -> std::shared_ptr<core::config::Configuration>
Gets a smart pointer reference to a copy of the user-specified configuration data from a config file. Habitat does not parse or process this data, but it will be available to the user via python bindings for each object.

Public variables

std::string m_name
name of the articulated object or robot
std::string m_sourceFile
source file this model was built from (e.g. the .urdf file)
std::map<std::string, std::shared_ptr<Material>> m_materials
map of names to materials
std::map<std::string, std::shared_ptr<Link>> m_links
map of names to links
std::map<int, std::string> m_linkIndicesToNames
map of link indices to names
std::map<std::string, std::shared_ptr<Joint>> m_joints
map of names to joints
std::vector<std::shared_ptr<Link>> m_rootLinks
list of root links (usually 1)
bool m_overrideFixedBase

Protected functions

void scaleShape(Shape& shape, float scale)
Scale the transformation and parameters of a Shape.

Protected variables

std::shared_ptr<core::config::Configuration> jsonAttributes_
Json-based attributes defining characteristics of this model not specified in the source XML/URDF. Primarily to support default user-defined attributes. This data is read in from a json file with the same base name as the source XML/URDF for this model but the extension ".ao_config.json".
float m_globalScaling
float m_massScaling
Mass scaling of the model's Link inertias.
Cr::Containers::Optional<std::string> m_renderAsset
Path to a render asset associated with this articulated object.
int m_semanticId
Semantic ID of this model.
bool m_debugRenderPrimitives
Forces link primitives to be rendered even if a render asset is present.

Function documentation

void esp::io::URDF::Model::printKinematicChain() const

output a string to console listing the link|joint hierarchy of this model for debugging and investigation purposes

std::shared_ptr<Link> esp::io::URDF::Model::getLink(const std::string& linkName) const

Get a link provided its name.

Parameters
linkName The link's configured name from the URDF file.
Returns The link metadata object or nullptr if no link with provided name.

std::shared_ptr<Link> esp::io::URDF::Model::getLink(int linkIndex) const

Get a link provided its index.

Parameters
linkIndex The link's index.
Returns The link metadata object or nullptr if no link with provided index.

std::shared_ptr<Joint> esp::io::URDF::Model::getJoint(int linkIndex) const

Get a parent joint of a link provided the link index.

Parameters
linkIndex The link's index.
Returns The parent joint metadata object or nullptr if no link with provided index.

void esp::io::URDF::Model::setGlobalScaling(float scaling)

Set global scaling and re-scale an existing model. Modifies various internal parameters.

Parameters
scaling The new absolute uniform scale.

void esp::io::URDF::Model::setMassScaling(float massScaling)

Set scaling for mass from initial values configured in URDF. Modifies various internal parameters.

Parameters
massScaling The new absolute uniform mass scale.

bool esp::io::URDF::Model::loadJsonAttributes(const std::string& filename)

This function conditionally loads configuration data from a Json file for this Articulated Model, should an appropriate file exist. This configuration file must meet the following criteria to be loaded :

Parameters
filename The filename for the URDF?XML file describing this model.
Returns Whether successful or not.
  • Exist in the same directory as this model's source URDF/XML file.
  • Have the same root name as this model's source URDF/XML file.
  • Have '.ao_config.json' as an extension.

This method will construct a name candidate from the passed filename and attempt to load this file into this model's jsonAttributes_ variable. This also loads the render asset path from the json file.

Variable documentation

bool esp::io::URDF::Model::m_overrideFixedBase

if true, force this model to produce a fixed base instance (e.g. the root is not dynamic)

float esp::io::URDF::Model::m_globalScaling protected

Global euclidean scaling applied to the model's transforms, asset scales, and prismatic joint limits. Does not affect mass.