open-dynamic-robot-initiative / robot_properties_solo

BSD 3-Clause "New" or "Revised" License
40 stars 20 forks source link

Parent Link Collisions on Solo12 #46

Open Danfoa opened 3 years ago

Danfoa commented 3 years ago

Good day,

For a learning project, I am working with Solo8 and Solo12. During the learning process, I have found it very useful to enable self-collisions during simulation, as the impacts generated by self collisions and the resultant impact generalized forces are a strong cue to the control policy to avoid such states, simply by their energy expense. Therefore guiding the policy exploration towards safer and more energy-efficient dynamical states.

This is working properly for Solo8, however, I came to realize that the Solo12 URDF has constant links in collision and therefore self-collision cannot be enabled during simulation (because infinite forces are generated due to interpenetration).

I have not had the time to debug which links and specific points are in a constant self-collision, but I hope to do so soon and hopefully make a PR. In the meantime, I leave constancy of this issue (I believe is an issue)

MaximilienNaveau commented 2 years ago

Hi,

thank you very much for pointing out this issue!!!

Yes self-collision as an option at least is good to have. We honestly did not check this possibility before, once we know which bodys are interpenetrating I will try to get a revised version of the meshes.

Best

Danfoa commented 2 years ago

Hello @MaximilienNaveau,

I run a simple self contact detection script within a custom env with the robot base fixed above the ground. The self contacts are detected between the following links of Solo12:

Self-contact between [HL_UPPER_LEG, base] detected
Self-contact between [HR_UPPER_LEG, base] detected
Self-contact between [FL_UPPER_LEG, base] detected
Self-contact between [FR_UPPER_LEG, base] detected

If you want to reproduce this errors use:

def check_self_collision(pb, robot):
    contact_points = pb.getContactPoints(bodyA=robot.robot_id, bodyB=robot.robot_id)

    for contact_info in reversed(contact_points):
        linkA_id = contact_info[3]
        linkB_id = contact_info[4]

        link_A_name = "base" if linkA_id == -1 else pb.getJointInfo(robot.robot_id, linkA_id)[12].decode("UTF-8")
        link_B_name = "base" if linkB_id == -1 else pb.getJointInfo(robot.robot_id, linkB_id)[12].decode("UTF-8")

        print("Self-contact between [{},{}] detected".format(link_A_name, link_B_name))
MaximilienNaveau commented 2 years ago

Hi @Danfoa ,

thank you very much for the feedback!!! I appreciate your effort finding the problem. I contacted our chief of mechanics to see if he can regenerate the STL files of those part. I still need to meet with him about the subject.

Thanks again for the debugging!

Don't hesitate to share the full script for the error reproduction.

MaximilienNaveau commented 2 years ago

I added @fgrimminger and @jviereck on the subject as they might be interested by this.

jviereck commented 2 years ago

As a workaround, you could create a list of allowed self collisions and then filter the self collisions with it. That's what we setup in the srdf files: https://github.com/open-dynamic-robot-initiative/robot_properties_solo/blob/master/src/robot_properties_solo/resources/srdf/solo.srdf

fgrimminger commented 2 years ago

Thibault reported a mistake in the stl files last year. In some postures there was a collision of the upper leg motor with the hip aa support. That problem was fixed.

Issue: Undue collision due to URDF meshes placement

Does that help? Are you using the outdated stl files?