7 from .
import pinocchio_pywrap
as pin
8 from .
import WITH_HPP_FCL, WITH_HPP_FCL_BINDINGS
10 nle = pin.nonLinearEffects
12 def buildModelsFromUrdf(filename, package_dirs=None, root_joint=None, verbose=False, meshLoader=None, geometry_types=[pin.GeometryType.COLLISION,pin.GeometryType.VISUAL]):
13 """Parse the URDF file given in input and return a Pinocchio Model followed by corresponding GeometryModels of types specified by geometry_types, in the same order as listed. 15 # load model, collision model, and visual model, in this order (default) 16 model, collision_model, visual_model = buildModelsFromUrdf(filename[, ...], geometry_types=[pin.GeometryType.COLLISION,pin.GeometryType.VISUAL]) 17 model, collision_model, visual_model = buildModelsFromUrdf(filename[, ...]) # same as above 19 model, collision_model = buildModelsFromUrdf(filename[, ...], geometry_types=[pin.GeometryType.COLLISION]) # only load the model and the collision model 20 model, collision_model = buildModelsFromUrdf(filename[, ...], geometry_types=pin.GeometryType.COLLISION) # same as above 21 model, visual_model = buildModelsFromUrdf(filename[, ...], geometry_types=pin.GeometryType.VISUAL) # only load the model and the visual model 23 model = buildModelsFromUrdf(filename[, ...], geometry_types=[]) # equivalent to buildModelFromUrdf(filename[, root_joint]) 26 if root_joint
is None:
27 model = pin.buildModelFromUrdf(filename)
29 model = pin.buildModelFromUrdf(filename, root_joint)
31 if verbose
and not WITH_HPP_FCL
and meshLoader
is not None:
32 print(
'Info: MeshLoader is ignored. Pinocchio has not been compiled with HPP-FCL.')
33 if verbose
and not WITH_HPP_FCL_BINDINGS
and meshLoader
is not None:
34 print(
'Info: MeshLoader is ignored. The HPP-FCL Python bindings have not been installed.')
35 if package_dirs
is None:
40 if not hasattr(geometry_types,
'__iter__'):
41 geometry_types = [geometry_types]
43 for geometry_type
in geometry_types:
44 if meshLoader
is None or (
not WITH_HPP_FCL
and not WITH_HPP_FCL_BINDINGS):
45 geom_model = pin.buildGeomFromUrdf(model, filename, geometry_type, package_dirs)
47 geom_model = pin.buildGeomFromUrdf(model, filename, geometry_type, package_dirs, meshLoader)
48 lst.append(geom_model)
53 """Call createData() on each Model or GeometryModel in input and return the results in a tuple. 54 If one of the models is None, the corresponding data object in the result is also None. 56 return tuple([
None if model
is None else model.createData()
for model
in models])
def buildModelsFromUrdf(filename, package_dirs=None, root_joint=None, verbose=False, meshLoader=None, geometry_types=[pin.GeometryType.COLLISION, pin, GeometryType, VISUAL)