Skip to content

Visualizing a model that uses .gltf #369

@TrevorJohst

Description

@TrevorJohst

Hi, sorry if I am missing something simple but I can't seem to figure out how to visualize a model that uses .gltf meshes instead of .obj. I made a copy of the iiwa manipulator example, and tried to load my own urdf with a parser. It seemingly works fine looking at rqt_graph and echoing the visualization topic, but if I try to open rviz I get a segmentation fault.

When I tried replacing the .gltf files with an .obj, it worked perfectly fine. I would think .gltf simply doesn't work, but looking at the multirobot example, it seems to be loading this urdf, which uses .gltf.

My file is the same as the iiwa manipulator example, but I removed the manipulation_station and replaced it with this:

plant, scene_graph = AddMultibodyPlantSceneGraph(builder, time_step=0.1)

parser = Parser(plant)
parser.AddModels("path/to/urdf")
link_1_frame = plant.GetFrameByName("link-1")
plant.WeldFrames(plant.world_frame(), link_1_frame)
plant.Finalize()

rviz_visualizer = builder.AddSystem(
    RvizVisualizer(ros_interface_system.get_ros_interface()))

rviz_visualizer.RegisterMultibodyPlant(plant)
rviz_visualizer.ComputeFrameHierarchy()

builder.Connect(
    scene_graph.GetOutputPort('query'),
    rviz_visualizer.get_graph_query_input_port()
)

I have confirmed that the urdf works normally in Drake, as I was able to load it in Meshcat in a separate notebook.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions