Home › Forum › SOFA › Programming with SOFA › ArticulatedSystemMapping: Breaking changes or misconception?
- This topic has 2 replies, 2 voices, and was last updated 4 years ago by Scheikl.
-
AuthorPosts
-
29 November 2020 at 17:29 #17808ScheiklBlocked
Dear Sofa Community,
in v20.06 I used theArticulatedSystemMapping
to build robot kinematics.
I heavily leaned on the Tripod tutorial from the SoftRobots plugin to understand how to build nice rotational joints with the SofaPython3 plugin.Last week I tried to updated my code base to commit
fdb0dcaad4a4cea3214d43a589db7f9f206bb58b
. The code that ran smoothly before now throws an error during the creation of theArticulatedSystemMapping
.As a “minimal” reproducible example I implemented the Documentation example in Python:
base_frame = rootNode.addChild("base") base_frame.addObject("MechanicalObject", name="dofs", template="Rigid3d", position=[0, 0, 0, 0, 0, 0, 1]) articulation = base_frame.addChild("articulation") articulation.addObject("MechanicalObject", name="Articulations", template="Vec1d", position=[0, 0, 0, 0]) mechanics = articulation.addChild("Mechanics") mechanics.addObject("MechanicalObject", template="Rigid3d", name="dofs", position=[ [0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [3, 0, 0, 0, 0, 0, 1], [5, 0, 0, 0, 0, 0, 1], [7, 0, 0, 0, 0, 0, 1] ]) mechanics.addObject("BeamFEMForceField", name="FEM", radius=0.1, youngModulus=1e8, poissonRatio=0.45) mechanics.addObject("MeshTopology", name="lines", lines="0 1 1 2 2 3 3 4 ") mechanics.addObject("UniformMass", template="Rigid3d", name="mass", vertexMass="0.1 0.1 [1 0 0,0 1 0,0 0 1]") mechanics.addObject("FixedConstraint", template="Rigid3d", name="fixOrigin", indices=0) mechanics.addObject("ArticulatedSystemMapping", input1=articulation.Articulations.getLinkPath(), input2=base_frame.dofs.getLinkPath(), output=mechanics.DOFs.getLinkPath()) articulation.addObject("ArticulatedHierarchyContainer") centers = articulation.addChild("articulationCenters") center1 = centers.addChild("center1") center1.addObject("ArticulationCenter", parentIndex=0, childIndex=1, posOnParent=[0, 0, 0], posOnChild=[-1, 0, 0]) rotation1 = center1.addChild("articulations") rotation1.addObject("Articulation", translation=False, rotation=True, rotationAxis=[0, 0, 1], articulationIndex=0) center2 = centers.addChild("center2") center2.addObject("ArticulationCenter", parentIndex=1, childIndex=2, posOnParent=[1, 0, 0], posOnChild=[-1, 0, 0], articulationProcess=2) rotation2 = center2.addChild("articulations") rotation2.addObject("Articulation", translation=False, rotation=True, rotationAxis=[0, 0, 1], articulationIndex=1) center3 = centers.addChild("center3") center3.addObject("ArticulationCenter", parentIndex=2, childIndex=3, posOnParent=[1, 0, 0], posOnChild=[-1, 0, 0], articulationProcess=0) rotation3 = center3.addChild("articulations") rotation3.addObject("Articulation", translation=False, rotation=True, rotationAxis=[0, 0, 1], articulationIndex=2) center4 = centers.addChild("center4") center4.addObject("ArticulationCenter", parentIndex=3, childIndex=4, posOnParent=[1, 0, 0], posOnChild=[-1, 0, 0], articulationProcess=1) rotation4 = center4.addChild("articulations") rotation4.addObject("Articulation", translation=False, rotation=True, rotationAxis=[0, 0, 1], articulationIndex=3) rootNode.init()
On creation, this results in the following error:
[ERROR] [ArticulatedSystemMapping(ArticulatedSystemMapping)] ArticulationCenters 'ArticulatedHierarchyContainer' size: 8 is bigger than the size of input model 'Articulations' position vector: 4
The same code runs fine in v20.06.
From what I understand, the 4 is perfectly fine, as we actually want to implement 4 rotational joints. The 8, however, is a bit cryptic to me. With only one center and one value in
Articulations
the error is still there, but withsize: 2
andvector: 1
respectively.My understanding was, that for n serial joints, I need n+1 positions in
mechanics.dofs
.So my questions are:
– Do I have a fundamental misconception about the topic?
– What changed between v20.06 and the soon to be v20.12?
– Is there a way to fix that? I kind of hacked my way around it by dirtily duplicating the entries inArticulations
and only using every second entry.Cheers,
Paul18 December 2020 at 22:32 #18055HugoKeymaster18 December 2020 at 22:38 #18057 -
AuthorPosts
- You must be logged in to reply to this topic.