Closed diegoferigo closed 2 months ago
Cool! Can you add the snippet of code that you used to test if this worked?
Cool! Can you add the snippet of code that you used to test if this worked?
Sure:
import idyntree.bindings as idt
import resolve_robotics_uri_py
urdf_path = resolve_robotics_uri_py.resolve_robotics_uri(
uri="model://ergoCubSN001/model.urdf"
)
mdl_loader = idt.ModelLoader()
assert mdl_loader.loadReducedModelFromString(
urdf_path.read_text(),
[],
{"my_joint": 3.14}
)
Great, so basically the user never needs to use the StringToDoubleUnorderedMap
type explicitly, great.
Great, so basically the user never needs to use the
StringToDoubleUnorderedMap
type explicitly, great.
Yep! SWIG automatically converts a Python dictionary to a C++ unordered map. It is not even too picky on the type, from Python the dictionary could also be dict[str, int]
and it still works.
This is necessary for the new methods introduced in #1174 to accept a dictionary from the target language and convert it to C++. I only tested that it works from Python.