[Python] Can't set the transparency of models

Discussão em 'Python' iniciado por Stack, Março 23, 2025.

  1. Stack

    Stack Membro Participativo

    When I reproduced gcs-science-robotics in the latest version of drake and ran prm_comparison.ipynb, I met this problem.

    RuntimeError Traceback (most recent call last)
    /tmp/ipykernel_16980/4066659220.py in <module>
    ----> 1 visualize_trajectory(meshcat, [linear_gcs_traj],
    2 show_path=True,
    3 robot_configurations=execute_task,
    4 transparency=0.3)

    ~/lhc-gcs-science-robotics/reproduction/prm_comparison/helpers.py in visualize_trajectory(meshcat, trajectories, show_path, robot_configurations, transparency, regions)
    246
    247 # Set transparency of main arm and gripper.
    --> 248 set_transparency_of_models(plant,
    249 [iiwa.model_instance, wsg.model_instance],
    250 transparency, scene_graph)

    ~/lhc-gcs-science-robotics/reproduction/prm_comparison/helpers.py in set_transparency_of_models(plant, model_instances, alpha, scene_graph)
    122 Role.kIllustration):
    123 properties = inspector.GetIllustrationProperties(geometry_id)
    --> 124 phong = properties.GetProperty("phong", "diffuse")
    125 phong.set(phong.r(), phong.g(), phong.b(), alpha)
    126 properties.UpdateProperty("phong", "diffuse", phong)

    RuntimeError: GetProperty(): Trying to read property ('phong', 'diffuse'), but the group does not exist.


    then I found that properties group name was '__default__'. I want to know that if API changed what should I do to change the transparency of models.

    Continue reading...

Compartilhe esta Página