SofaDefrost / SofaGym

Machine Learning framework for Sofa
68 stars 10 forks source link

[Gripper Env] the postion and orientation of gripper won't change #31

Closed MingshanHe closed 10 months ago

MingshanHe commented 1 year ago

Actually, I don't get familiar with the structure of the sofagym, And I try my best to describe my issue. I think the executeAnimation is the function of operating the gripper, and setPos is to update the position which is gotten from the getPos function to update the value of the position.

I print the value in the executeAnimation.

Why this function is actuated 5 times in one step? And Why each actuated previous position is initialized? (Not save the previous value)

image `

def executeAnimation(fingers, factor):

    # print("In ExecuteAnimation")
    # self.dofs.append(self.node.getChild('PneumaticGripper').getChild('PneumaticFinger'+str(i+1)).mecaObj)
    results0 = moveRestPos(fingers[0].mecaObj.position.value, -1.0, -1.0, -1.0)
    results1 = moveRestPos(fingers[1].mecaObj.position.value, -1.0, -1.0, -1.0)
    print("============")
    print(fingers[0].mecaObj.position.value[0])
    print(results0[0])
    fingers[0].mecaObj.position.value = results0
    print(fingers[0].mecaObj.position.value[0])
    fingers[1].mecaObj.position.value = results1

` The code may a little different from the Gripper to which I referred. Moreover, when I run the gripper env, the gripper also not changed position and orientation.

EtienneMenager commented 11 months ago

Hello,

Sorry for the very late answer. The setPos and getPos are used only for the visualisation. The number of call depends on the number of simulation step required for one learning step. Hope it helps !

Etienne

alxbilger commented 10 months ago

Hi @MingshanHe,

Did @EtienneMenager answer your question?